22 m_ViewDirection(Axial)
39 if (
Equal(direction.GetNorm(), 0.0))
41 MITK_WARN <<
"Ignoring invalid direction of projection: " << direction;
45 if (m_ToolTrajectory != direction)
47 m_ToolTrajectory = direction;
48 this->SetViewDirection(Oblique);
56 if (m_Renderer.IsNull())
58 itkExceptionMacro(<<
"Renderer was not properly set");
62 unsigned int numberOfInputs = this->GetNumberOfInputs();
63 if (numberOfInputs == 0)
67 for (
unsigned int i = 0; i < numberOfInputs ; ++i)
81 if (numberOfInputs == 0 || !this->GetInput()->IsDataValid())
85 Point3D slicePosition = this->GetInput()->GetPosition();
91 transformedTipOffset.SetVnlVector(orientation.rotate(m_TipOffset.GetVnlVector()));
93 slicePosition += transformedTipOffset;
97 if (Axial == m_ViewDirection)
100 snc->SelectSliceByPoint(slicePosition);
102 else if (Sagittal == m_ViewDirection)
105 snc->SelectSliceByPoint(slicePosition);
107 else if (Frontal == m_ViewDirection)
110 snc->SelectSliceByPoint(slicePosition);
112 else if (AxialOblique == m_ViewDirection || SagittalOblique == m_ViewDirection)
114 const int slicingPlaneXAxis = AxialOblique == m_ViewDirection ? 0 : 2;
117 const mitk::Geometry2D::TransformType::MatrixType &m =
118 m_Renderer->GetCurrentWorldGeometry2D()->GetIndexToWorldTransform()->GetMatrix();
124 slicingPlaneYAxisVector.SetVnlVector(orientation.rotate(m_ToolTrajectory.GetVnlVector()));
129 slicingPlaneYAxisVector[slicingPlaneXAxis] = 0.0;
135 if ( m(slicingPlaneXAxis,0) == 0.0 ||
137 (slicingPlaneXAxis != 0 && slicingPlaneYAxisVector[0] == 0.0) ||
138 (slicingPlaneXAxis != 1 && slicingPlaneYAxisVector[1] == 0.0) ||
139 (slicingPlaneXAxis != 2 && slicingPlaneYAxisVector[2] == 0.0) )
147 if ( (m(1,1) > 0) != (slicingPlaneYAxisVector[1] > 0) )
149 slicingPlaneYAxisVector *= -1;
153 slicingPlaneXAxisVector.Fill(0.0);
157 slicingPlaneXAxisVector[slicingPlaneXAxis] = m(slicingPlaneXAxis,0) > 0 ? 1.0 : -1.0;
161 snc->ReorientSlices(origin, slicingPlaneXAxisVector, slicingPlaneYAxisVector);
162 snc->SelectSliceByPoint(slicePosition);
164 else if (Oblique == m_ViewDirection)
167 slicingPlaneNormalVector.SetVnlVector(orientation.rotate(m_ToolTrajectory.GetVnlVector()));
171 const mitk::Geometry2D::TransformType::MatrixType &m =
172 m_Renderer->GetCurrentWorldGeometry2D()->GetIndexToWorldTransform()->GetMatrix();
176 if (angle(worldUpVector.GetVnlVector(), currentSlicingPlaneUpVector.GetVnlVector()) > vnl_math::pi_over_2 )
184 slicingPlane->InitializePlane(origin, slicingPlaneNormalVector);
190 if ( slicingPlane->Project(worldUpVector, slicingPlaneUpVector) )
196 itk::Vector<double,3> slicingPlaneUpVector_double;
198 slicingPlaneUpVector[0], slicingPlaneUpVector[1], slicingPlaneUpVector[2]);
199 itk::Vector<double,3> slicingPlaneNormalVector_double;
201 slicingPlaneNormalVector[0], slicingPlaneNormalVector[1], slicingPlaneNormalVector[2]);
202 itk::Vector<double,3> slicingPlaneRightVector_double = itk::CrossProduct(slicingPlaneUpVector_double,
203 slicingPlaneNormalVector_double);
207 slicingPlaneRightVector_double[0], slicingPlaneRightVector_double[1], slicingPlaneRightVector_double[2]);
209 slicingPlaneUpVector_double[0], slicingPlaneUpVector_double[1], slicingPlaneUpVector_double[2]);
211 snc->ReorientSlices(origin, slicingPlaneRightVector, slicingPlaneUpVector);
212 snc->SelectSliceByPoint(slicePosition);
217 MITK_ERROR <<
"Unsupported ViewDirection: " << m_ViewDirection;
220 m_Renderer->RequestUpdate();
NavigationDataSliceVisualization()
NavigationDataToNavigationDataFilter is the base class of all filters that receive NavigationDatas as...
Vector3D m_ToolTrajectory
DataCollection - Class to facilitate loading/accessing structured data.
virtual void SetToolTrajectory(Vector3D direction)
Set/get the tool trajectory used to define the cutting plane normal direction.
mitk::Quaternion OrientationType
Type that holds the orientation part of the tracking data.
virtual void GenerateData()
void FillVector3D(Tout &out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z)
Vector3D m_WorldVerticalVector
virtual bool IsDataValid() const
returns true if the object contains valid data
virtual void Graft(const DataObject *data) override
Graft the data and information from one NavigationData to another.
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.