23 #include <itksys/SystemTools.hxx> 52 renderWindow->GetVtkRenderWindow()->SetSize(500, 500);
53 renderWindow->GetRenderer()->Resize(500, 500);
55 renderWindow->GetRenderer()->SetDataStorage(dataStorage);
65 tracker->SetBounds(bounds);
66 tracker->AddTool(
"tool1");
70 source->SetTrackingDevice(tracker);
82 dataNode->SetData(cone);
83 dataNode->SetName(
"My tracked object");
84 dataNode->SetColor(0.0, 1.0, 1.0);
85 dataStorage->Add(dataNode);
89 visualizer->SetInput(0, source->GetOutput());
90 visualizer->SetRepresentationObject(0, cone);
97 cylinderNode->SetData(cylinder);
98 cylinderNode->SetName(
"My fixed object");
99 cylinderNode->SetColor(1.0, 0.0, 0.0);
100 dataStorage->Add(cylinderNode);
104 rotationMatrix.SetIdentity();
106 rotationMatrix[1][1] = cos(alpha);
107 rotationMatrix[1][2] = -sin(alpha);
108 rotationMatrix[2][1] = sin(alpha);
109 rotationMatrix[2][2] = cos(alpha);
114 mitk::AffineTransform3D::Pointer affineTransform3D = mitk::AffineTransform3D::New();
115 affineTransform3D->SetOffset(offset);
116 affineTransform3D->SetMatrix(rotationMatrix);
120 cylinder->GetGeometry()->SetIndexToWorldTransform(fixedNavigationData->GetAffineTransform3D());
129 auto timeGeometry = dataStorage->ComputeBoundingGeometry3D(dataStorage->GetAll());
131 geometry->SetBounds(bounds);
135 source->StartTracking();
140 for (
int i = 0; i < 75; ++i)
143 visualizer->Update();
146 renderWindow->GetVtkRenderWindow()->Render();
149 MITK_INFO <<
"Position " << source->GetOutput()->GetPosition();
151 itksys::SystemTools::Delay(100);
155 source->StopTracking();
156 source->Disconnect();
167 fixedNavigationData->Compose(source->GetOutput(),
false);
170 cylinder->GetGeometry()->SetIndexToWorldTransform(fixedNavigationData->GetAffineTransform3D());
173 renderWindow->GetVtkRenderWindow()->Render();
177 itksys::SystemTools::Delay(2000);
virtual bool InitializeViews(const BaseGeometry *geometry, RequestType type=REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace=false)
int main(int, char **)
[What we will do]
static RenderingManager * GetInstance()
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)