Medical Imaging Interaction Toolkit  2018.4.99-87d68d9f
Medical Imaging Interaction Toolkit
mitkNavigationToolStorageTestHelper.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14  #include <mitkIOUtil.h>
18 
20  {
21  //create Tool Storage
22  mitk::NavigationToolStorage::Pointer myStorage = mitk::NavigationToolStorage::New();
23  //first tool
24  mitk::NavigationTool::Pointer myTool1 = mitk::NavigationTool::New();
25  myTool1->SetIdentifier("001");
26  myStorage->AddTool(myTool1);
27  //second tool
28  mitk::NavigationTool::Pointer myTool2 = mitk::NavigationTool::New();
29  myTool2->SetIdentifier("002");
30  myStorage->AddTool(myTool2);
31  //third tool
32  mitk::NavigationTool::Pointer myTool3 = mitk::NavigationTool::New();
33  myTool3->SetIdentifier("003");
34  myStorage->AddTool(myTool3);
35 
36  return myStorage;
37  }
38 
40  {
41  //create Tool Storage
42  mitk::NavigationToolStorage::Pointer myStorage = mitk::NavigationToolStorage::New();
43 
44  //first tool
45  mitk::NavigationTool::Pointer myTool1 = mitk::NavigationTool::New();
46  myTool1->SetIdentifier("001");
48  mitk::Point3D testPt1;
49  mitk::FillVector3D(testPt1,1,2,3);
50  CalLandmarks1->SetPoint(0,testPt1);
52  mitk::Point3D testPt2;
53  mitk::FillVector3D(testPt2,4,5,6);
54  RegLandmarks1->SetPoint(5,testPt2);
55  myTool1->SetToolControlPoints(CalLandmarks1);
56  myTool1->SetToolLandmarks(RegLandmarks1);
57  mitk::Point3D toolTipPos;
58  mitk::FillVector3D(toolTipPos,1.3423,2.323,4.332);
59  mitk::Quaternion toolTipRot = mitk::Quaternion(0.1,0.2,0.3,0.4);
60  myTool1->SetToolTipPosition(toolTipPos);
61  myTool1->SetToolAxisOrientation(toolTipRot);
62  myStorage->AddTool(myTool1);
63 
64  return myStorage;
65  }
66 
67  mitk::NavigationToolStorage::Pointer mitk::NavigationToolStorageTestHelper::CreateTestData_ComplexStorage(std::string toolFilePath, std::string toolSurfacePath1, std::string toolSurfacePath2)
68  {
69  //create first tool
70  mitk::NavigationTool::Pointer myNavigationTool = mitk::NavigationTool::New();
71  myNavigationTool->SetCalibrationFile(toolFilePath);
73  myNode->SetName("ClaronTool");
74  myNode->SetData(mitk::IOUtil::Load<mitk::Surface>(toolSurfacePath1)); //load an stl File
75  myNavigationTool->SetDataNode(myNode);
76  myNavigationTool->SetIdentifier("ClaronTool#1");
77  myNavigationTool->SetSerialNumber("0815");
78  myNavigationTool->SetTrackingDeviceType(mitk::MicronTrackerTypeInformation::GetTrackingDeviceName());
79  myNavigationTool->SetType(mitk::NavigationTool::Fiducial);
80 
81  //create second tool
82  mitk::NavigationTool::Pointer myNavigationTool2 = mitk::NavigationTool::New();
83  mitk::Surface::Pointer testSurface2;
84 
86  myNode2->SetName("AuroraTool");
87 
88  //load an stl File
89  testSurface2 = mitk::IOUtil::Load<mitk::Surface>(toolSurfacePath2);
90  myNode2->SetData(testSurface2);
91 
92  myNavigationTool2->SetDataNode(myNode2);
93  myNavigationTool2->SetIdentifier("AuroraTool#1");
94  myNavigationTool2->SetSerialNumber("0816");
95  myNavigationTool2->SetTrackingDeviceType(mitk::NDIAuroraTypeInformation::GetTrackingDeviceName());
96  myNavigationTool2->SetType(mitk::NavigationTool::Instrument);
97 
98  //create navigation tool storage
99  mitk::NavigationToolStorage::Pointer myStorage = mitk::NavigationToolStorage::New();
100  myStorage->AddTool(myNavigationTool);
101  myStorage->AddTool(myNavigationTool2);
102 
103  return myStorage;
104  }
static mitk::NavigationToolStorage::Pointer CreateTestData_SimpleStorage()
static Pointer New()
void FillVector3D(Tout &out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z)
Definition: mitkArray.h:106
static Pointer New()
static mitk::NavigationToolStorage::Pointer CreateTestData_ComplexStorage(std::string toolFilePath, std::string toolSurfacePath1, std::string toolSurfacePath2)
vnl_quaternion< ScalarType > Quaternion
static Pointer New()
Constructs a NavigationToolStorage without reference to a DataStorage. The Data Nodes of tools have t...
static Pointer New()
static mitk::NavigationToolStorage::Pointer CreateTestData_StorageWithOneTool()