36 <<
"Null Node passed to NodeDisplacementFilter. Ignoring Node....";
39 if (node->GetData() == 0)
42 <<
"Empty Node passed to NodeDisplacementFilter. Ignoring Node....";
45 if(m_SelectedInput == -1)
48 <<
"Cannot add nodes before input Stream was selected";
49 mitkThrow() <<
"Cannot add nodes before input Stream was selected";
54 if (m_InitialReferencePose.IsNotNull())
55 {reference = m_InitialReferencePose;}
57 {reference = this->GetOutput(m_SelectedInput);}
59 if (! reference->IsDataValid())
62 <<
"Cannot add node while selected tool is not tracked. Ignoring Node....";
68 if ( ! reference->GetAffineTransform3D()->GetInverse(inverseAffineTransform) )
71 <<
"Could not get the inverse transformation of the navigation data transformation.";
72 mitkThrow() <<
"Could not get the inverse transformation of the navigation data transformation.";
75 inverseAffineTransform->Compose(node->GetData()->GetGeometry()->GetIndexToWorldTransform(),
true);
76 m_Transforms.push_back(inverseAffineTransform);
77 m_Nodes.push_back(node);
84 if ( i >= m_Nodes.size() ) {
return false; }
86 m_Nodes.erase(m_Nodes.begin()+i);
87 m_Transforms.erase(m_Transforms.begin()+i);
93 return m_Nodes.size();
98 if (i < m_Nodes.size() ) {
return m_Nodes.at(i); }
109 if (i < 0) {
mitkThrow() <<
"Negative Input selected in NodeDisplacementFilter"; }
110 if (! (static_cast<unsigned int>(i) < this->GetInputs().size()))
113 <<
"Selected input index is larger than actual number of inputs.";
114 mitkThrow() <<
"Selected input index is larger than actual number of inputs in NodeDisplacementFilter";
122 if((m_Nodes.size()>i) && (m_Nodes.at(i).IsNotNull()))
130 returnValue->SetDataValid(
false);
131 MITK_WARN <<
"Excetion while returning navigation data: " << e.GetDescription();
136 returnValue->SetDataValid(
false);
137 MITK_WARN <<
"Node Nr. " << i <<
" does not exist!";
149 if (m_SelectedInput == -1)
152 <<
"No input has been selected. Only forwarding NavigationData...";
157 if ( ! this->GetInput(m_SelectedInput)->IsDataValid() ) {
return; }
162 this->GetInput(m_SelectedInput)->GetAffineTransform3D());
165 for (
unsigned int index=0; index < m_Nodes.size(); index++)
171 transformGeometry->Compose(m_Transforms.at(index),
true);
173 m_Nodes.at(index)->GetData()->SetGeometry(transformGeometry);
180 m_Transforms.clear();
185 g3d->SetIndexToWorldTransform(transform);
virtual mitk::DataNode::Pointer GetNode(unsigned int i=0)
Returns the nth node that was added to this filter.
itk::SmartPointer< Self > Pointer
virtual void GenerateData() override
Passes navigation data from all inputs to all outputs. If a subclass wants to implement its own versi...
bool AddNode(mitk::DataNode::Pointer node)
Adds a node to the filter. The position of which will then be continously update relatively to the se...
static void Update(vtkPolyData *)
virtual void ResetNodes()
Removes all added Nodes from the Filter but leaves all other configuration intact.
bool RemoveNode(unsigned int i)
Removes a node from the filter.
mitk::Geometry3D::Pointer TransformToGeometry(mitk::AffineTransform3D::Pointer transform)
Creates an Geometry 3D Object from an AffineTransformation.
An object of this class represents an exception of MITK. Please don't instantiate exceptions manually...
virtual int GetNumberOfNodes()
Returns the number of nodes that were added to this filter.
virtual void GenerateData() override
Passes navigation data from all inputs to all outputs. If a subclass wants to implement its own versi...
virtual ~NodeDisplacementFilter()
virtual std::vector< mitk::DataNode::Pointer > GetNodes()
Returns a vector containing all nodes that have been added to this filter.
virtual mitk::NavigationData::Pointer GetRawDisplacementNavigationData(unsigned int i=0)
virtual void SelectInput(int i)
Selects an input stream as the reference stream.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.