59 this->m_DataNode = mitk::DataNode::New();
60 this->m_DataNode->SetName(other.m_DataNode->GetName());
61 if (other.m_DataNode->GetData())
63 this->m_DataNode->SetData(dynamic_cast<mitk::BaseData*>(other.m_DataNode->GetData()->Clone().GetPointer()));
67 if (other.m_SpatialObject.IsNotNull())
68 this->m_SpatialObject = other.m_SpatialObject->Clone();
69 this->m_CalibrationFile = other.m_CalibrationFile;
70 this->m_SerialNumber = other.m_SerialNumber;
71 this->m_TrackingDeviceType = other.m_TrackingDeviceType;
72 if (other.m_ToolLandmarks.IsNotNull())
73 this->m_ToolLandmarks = other.m_ToolLandmarks->Clone();
74 if (other.m_ToolControlPoints.IsNotNull())
75 this->m_ToolControlPoints = other.m_ToolControlPoints->Clone();
76 this->m_ToolTipPosition = other.m_ToolTipPosition;
77 this->m_ToolAxisOrientation = other.m_ToolAxisOrientation;
102 mitk::Vector3D toolAxisSensorCoordinateSystem;
103 mitk::FillVector3D(toolAxisSensorCoordinateSystem, 0.0, 0.0, -1.0);
105 mitk::Vector3D toolAxisFromCalibration;
106 mitk::FillVector3D(toolAxisFromCalibration, toolAxis[0], toolAxis[1], toolAxis[2]);
107 toolAxisFromCalibration.Normalize();
109 if (toolAxisSensorCoordinateSystem == toolAxisFromCalibration)
111 m_ToolAxisOrientation = mitk::Quaternion(0,0,0,1);
116 mitk::ScalarType rotationAngle = acos(toolAxisSensorCoordinateSystem*toolAxisFromCalibration);
118 mitk::Vector3D rotationAxis = itk::CrossProduct(toolAxisSensorCoordinateSystem, toolAxisFromCalibration);
120 itk::AffineTransform<mitk::ScalarType>::Pointer sensorToToolAxisOrientation = itk::AffineTransform<mitk::ScalarType>::New();
121 sensorToToolAxisOrientation->Rotate3D(rotationAxis, rotationAngle);
123 mitk::Quaternion toolAxisTransform(sensorToToolAxisOrientation->GetMatrix().GetVnlMatrix().transpose());
125 m_ToolAxisOrientation = toolAxisTransform;
143 nd =
dynamic_cast<const Self *
>(data);
148 <<
typeid(data).name() <<
" to "
149 <<
typeid(
const Self *).name();
155 <<
typeid(data).name() <<
" to "
156 <<
typeid(
const Self *).name();
159 m_Identifier = nd->GetIdentifier();
160 m_Type = nd->GetType();
161 m_DataNode->SetName(nd->GetDataNode()->GetName());
162 m_DataNode->SetData(nd->GetDataNode()->GetData());
163 m_SpatialObject = nd->GetSpatialObject();
164 m_CalibrationFile = nd->GetCalibrationFile();
165 m_SerialNumber = nd->GetSerialNumber();
166 m_TrackingDeviceType = nd->GetTrackingDeviceType();
167 m_ToolLandmarks = nd->GetToolLandmarks();
168 m_ToolControlPoints = nd->GetToolControlPoints();
169 m_ToolTipPosition = nd->GetToolTipPosition();
170 m_ToolAxisOrientation = nd->GetToolAxisOrientation();
218 if (m_DataNode.IsNull())
219 m_DataNode = mitk::DataNode::New();
221 mitk::Surface::Pointer mySphere = mitk::Surface::New();
223 double axisLength = 5.;
237 vtkCone->SetDirection(0, 1, 0);
238 vtkCone->SetHeight(1.0);
239 vtkCone->SetRadius(0.4f);
240 vtkCone->SetResolution(16);
241 vtkCone->SetCenter(0.0, axisLength, 0.0);
244 vtkCylinder->SetRadius(0.05);
245 vtkCylinder->SetHeight(axisLength);
246 vtkCylinder->SetCenter(0.0, 0.5*axisLength, 0.0);
247 vtkCylinder->Update();
249 appendPolyData->AddInputData(vtkCone->GetOutput());
250 appendPolyData->AddInputData(vtkCylinder->GetOutput());
251 appendPolyData->Update();
252 axis->DeepCopy(appendPolyData->GetOutput());
255 vtkLine->SetPoint1(-0.5, axisLength + 2., 0.0);
256 vtkLine->SetPoint2(0.0, axisLength + 1.5, 0.0);
259 vtkLine2->SetPoint1(0.5, axisLength + 2., 0.0);
260 vtkLine2->SetPoint2(-0.5, axisLength + 1., 0.0);
263 appendPolyData->AddInputData(vtkLine->GetOutput());
264 appendPolyData->AddInputData(vtkLine2->GetOutput());
265 appendPolyData->AddInputData(axis);
266 appendPolyData->Update();
267 surface->DeepCopy(appendPolyData->GetOutput());
271 XTransform->RotateZ(-90);
273 TrafoFilter->SetTransform(XTransform);
274 TrafoFilter->SetInputData(axis);
275 TrafoFilter->Update();
278 vtkLine->SetPoint1(axisLength + 2., -0.5, 0.0);
279 vtkLine->SetPoint2(axisLength + 1., 0.5, 0.0);
282 vtkLine2->SetPoint1(axisLength + 2., 0.5, 0.0);
283 vtkLine2->SetPoint2(axisLength + 1., -0.5, 0.0);
286 appendPolyData->AddInputData(vtkLine->GetOutput());
287 appendPolyData->AddInputData(vtkLine2->GetOutput());
288 appendPolyData->AddInputData(TrafoFilter->GetOutput());
289 appendPolyData->AddInputData(surface);
290 appendPolyData->Update();
291 surface->DeepCopy(appendPolyData->GetOutput());
295 ZTransform->RotateX(90);
296 TrafoFilter->SetTransform(ZTransform);
297 TrafoFilter->SetInputData(axis);
298 TrafoFilter->Update();
301 vtkLine->SetPoint1(-0.5, 0.0, axisLength + 2.);
302 vtkLine->SetPoint2(0.5, 0.0, axisLength + 2.);
305 vtkLine2->SetPoint1(-0.5, 0.0, axisLength + 2.);
306 vtkLine2->SetPoint2(0.5, 0.0, axisLength + 1.);
309 vtkLine3->SetPoint1(0.5, 0.0, axisLength + 1.);
310 vtkLine3->SetPoint2(-0.5, 0.0, axisLength + 1.);
313 appendPolyData->AddInputData(vtkLine->GetOutput());
314 appendPolyData->AddInputData(vtkLine2->GetOutput());
315 appendPolyData->AddInputData(vtkLine3->GetOutput());
316 appendPolyData->AddInputData(TrafoFilter->GetOutput());
317 appendPolyData->AddInputData(surface);
318 appendPolyData->Update();
319 surface->DeepCopy(appendPolyData->GetOutput());
322 vtkSphere->SetRadius(0.5f);
323 vtkSphere->SetCenter(0.0, 0.0, 0.0);
326 appendPolyData->AddInputData(vtkSphere->GetOutput());
327 appendPolyData->AddInputData(surface);
328 appendPolyData->Update();
329 surface->DeepCopy(appendPolyData->GetOutput());
333 ScaleTransform->Scale(20., 20., 20.);
335 TrafoFilter->SetTransform(ScaleTransform);
336 TrafoFilter->SetInputData(surface);
337 TrafoFilter->Update();
339 mySphere->SetVtkPolyData(TrafoFilter->GetOutput());
341 this->GetDataNode()->SetData(mySphere);