31 for (
int i = 0; i < 2; i++)
34 point.SetElement(0,0);
35 point.SetElement(1,0);
36 point.SetElement(2, i * 400);
48 if (i < 0)
mitkThrow() <<
"Negative Input selected in NeedleProjectionFilter";
49 if (! (static_cast<unsigned int>(i) < this->GetInputs().size()))
mitkThrow() <<
"Selected input index is larger than actual number of inputs in NeedleProjectionFilter";
59 if (m_SelectedInput == -1)
61 MITK_INFO <<
"No input has been selected in NeedleProjection Filter. Only forwarding NavigationData...";
66 if (! GetInput(m_SelectedInput)->IsDataValid())
return;
73 m_OriginalPoints->SetGeometry(refGeom);
75 m_Projection->SetPoint(0, m_OriginalPoints->GetPoint(0));
76 m_Projection->SetPoint(1, m_OriginalPoints->GetPoint(1));
78 if (this->m_TargetPlane.IsNull())
83 plane->SetIndexToWorldTransform(m_TargetPlane);
89 double p1[3] = {m_OriginalPoints->GetPoint(0)[0], m_OriginalPoints->GetPoint(0)[1], m_OriginalPoints->GetPoint(0)[2]};
90 double p2[3] = {m_OriginalPoints->GetPoint(1)[0], m_OriginalPoints->GetPoint(1)[1], m_OriginalPoints->GetPoint(1)[2]};
92 double center[3] = {plane->GetCenter()[0], plane->GetCenter()[1], plane->GetCenter()[2]};
93 double normal[3] = {plane->GetNormal()[0], plane->GetNormal()[1], plane->GetNormal()[2]};
95 vtkPlane::IntersectWithLine(p1, p2, normal, center, t, x);
103 intersection[0] = x[0];
104 intersection[1] = x[1];
105 intersection[2] = x[2];
108 m_Projection->SetPoint(1, intersection);
115 affineTransform->SetIdentity();
122 vnl_quaternion<double> doubleQuaternion(orientation.x(), orientation.y(), orientation.z(), orientation.r());
123 quatTransform->SetIdentity();
124 quatTransform->SetRotation(doubleQuaternion);
125 quatTransform->Modified();
129 static AffineTransform3D::MatrixType m;
131 affineTransform->SetMatrix(m);
135 pos.SetVnlVector(nd->
GetPosition().GetVnlVector());
136 affineTransform->SetOffset(pos);
138 affineTransform->Modified();
139 return affineTransform;
145 g3d->SetSpacing(scale);
146 g3d->SetIndexToWorldTransform(transform);
itk::SmartPointer< Self > Pointer
DataCollection - Class to facilitate loading/accessing structured data.
virtual OrientationType GetOrientation() const
returns the orientation of the NavigationData object
virtual void SelectInput(int i)
mitk::Quaternion OrientationType
Type that holds the orientation part of the tracking data.
mitk::Geometry3D::Pointer TransformToGeometry(mitk::AffineTransform3D::Pointer transform)
Creates an Geometry 3D Object from an AffineTransformation.
virtual ~NeedleProjectionFilter()
Data structure which stores a set of points. Superclass of mitk::Mesh.
virtual void GenerateData() override
Passes navigation data from all inputs to all outputs. If a subclass wants to implement its own versi...
virtual void GenerateData() override
Passes navigation data from all inputs to all outputs. If a subclass wants to implement its own versi...
void TransferMatrix(const itk::Matrix< U, NRows, NColumns > &in, itk::Matrix< V, NRows, NColumns > &out)
mitk::PointSet::Pointer m_OriginalPoints
virtual PositionType GetPosition() const
returns position of the NavigationData object
mitk::AffineTransform3D::Pointer NavigationDataToTransform(const mitk::NavigationData *nd)
Creates an Affine Transformation from a Navigation Data Object.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.