21 #include <itksys/SystemTools.hxx>
26 this->SetNumberOfRequiredOutputs(1);
27 this->SetNthOutput(0, output.GetPointer());
29 this->SetNumberOfRequiredInputs(1);
43 switch (m_OperationMode)
49 GenerateDataMode3DMean();
63 this->ProcessObject::SetNthInput(0, const_cast<NavigationData*>(nd));
64 this->CreateOutputsForAllInputs();
71 this->ProcessObject::SetNthInput(idx, const_cast<NavigationData*>(nd));
72 this->CreateOutputsForAllInputs();
78 if (this->GetNumberOfInputs() < 1)
80 return static_cast<const NavigationData*
>(this->ProcessObject::GetInput(0));
86 if (this->GetNumberOfInputs() < 1)
88 return static_cast<const NavigationData*
>(this->ProcessObject::GetInput(idx));
94 switch (m_OperationMode)
97 this->SetNumberOfIndexedOutputs(this->GetNumberOfIndexedInputs());
100 this->SetNumberOfIndexedOutputs(this->GetNumberOfIndexedInputs());
103 this->SetNumberOfIndexedOutputs(1);
109 for (
unsigned int idx = 0; idx < this->GetNumberOfIndexedOutputs(); ++idx)
110 if (this->GetOutput(idx) ==
nullptr)
112 DataObjectPointer newOutput = this->MakeOutput(idx);
113 this->SetNthOutput(idx, newOutput);
121 for (
unsigned int i = 0; i < this->GetNumberOfIndexedOutputs() ; ++i)
143 for (
unsigned int i = 0; i < this->GetNumberOfIndexedOutputs() ; ++i)
145 assert(this->GetOutput(i));
146 assert(this->GetInput(i));
150 std::vector<unsigned int> counterVec(this->GetNumberOfIndexedOutputs(),0);
153 std::vector<mitk::NavigationData::TimeStampType> vectorOldTime(this->GetNumberOfIndexedOutputs());
158 bool numberForMean_is_reached =
false;
159 while (!numberForMean_is_reached)
161 for (
unsigned int i = 0; i < this->GetNumberOfIndexedOutputs() ; ++i)
168 if (counterVec[i] == 0)
180 this->ProcessObject::GetInput(i)->Update();
181 input = this->GetInput(i);
183 if (vectorOldTime[i]<newTime)
189 vec.SetVnlVector(pos.GetVnlVector());
192 output->
SetPoint(newPointId, oPoint);
196 vectorOldTime[i] = newTime;
201 numberForMean_is_reached =
true;
202 for (
unsigned int i = 0; i < this->GetNumberOfIndexedOutputs() ; ++i)
204 if (counterVec[i]<m_NumberForMean)
205 numberForMean_is_reached =
false;
211 for (
unsigned int i = 0; i < this->GetNumberOfIndexedOutputs() ; ++i)
215 for (
unsigned int index = 0; index < oPoint.Size(); index++)
216 oPoint[index] = oPoint[index] / counterVec[i];
217 output->
SetPoint(newPointId, oPoint);
218 MBI_INFO <<
"For output # " << i <<
", " << counterVec[i] <<
" tracked positions used for averaging";
226 for (
unsigned int index = 0; index < this->GetNumberOfIndexedInputs(); index++)
231 output->
SetPoint( index, point, m_CurrentTimeStep);
233 if (m_CurrentTimeStep == m_RingBufferSize - 1)
234 m_CurrentTimeStep = 0;
242 m_OperationMode = mode;
244 if (m_OperationMode == Mode4D)
245 m_CurrentTimeStep = 0;
247 this->CreateOutputsForAllInputs();
NavigationDataToPointSetFilter()
empty implementation to prevent calling of the superclass method that would try to copy information f...
virtual int GetSize(unsigned int t=0) const
returns the current size of the point-list
OperationMode
There are two different operation modes.
PointType GetPoint(PointIdentifier id, int t=0) const
Get the point with ID id in world coordinates.
virtual void GenerateDataMode3D()
Generates the output for Mode3D.
Constants for most interaction classes, due to the generic StateMachines.
DataType::PointIdentifier PointIdentifier
double TimeStampType
type that holds the time at which the data was recorded
#define MBI_INFO
Macros for different message levels. Creates an instance of class PseudoStream with the corresponding...
virtual void GenerateDataMode4D()
Generates the output for Mode4D.
virtual void CreateOutputsForAllInputs()
create output objects according to OperationMode for all inputs
unsigned int m_RingBufferSize
Stores the ringbuffer size.
virtual void SetOperationMode(OperationMode mode)
Sets the mode of this filter.
Data structure which stores a set of points. Superclass of mitk::Mesh.
virtual void GenerateData() override
filter execute method
virtual TimeStampType GetIGTTimeStamp() const
gets the IGT timestamp of the NavigationData object
void InsertPoint(PointIdentifier id, PointType point, int t=0)
Set the given point in world coordinate system into the itkPointSet.
virtual bool IsDataValid() const
returns true if the object contains valid data
virtual PositionType GetPosition() const
returns position of the NavigationData object
virtual ~NavigationDataToPointSetFilter()
void SetPoint(PointIdentifier id, PointType point, int t=0)
Set the given point in world coordinate system into the itkPointSet.
const mitk::NavigationData * GetInput()
Returns the input of this filter.
OperationMode m_OperationMode
Stores the mode. See enum OperationMode.
unsigned int m_NumberForMean
Number of Navigation Data, which should be averaged.
virtual void GenerateDataMode3DMean()
Generates the output for Mode3DMean.
virtual void SetInput(const mitk::NavigationData *NavigationData)
Sets one input NavigationData.
unsigned int m_CurrentTimeStep
Indicates the current timestamp.