20 #define _USE_MATH_DEFINES
38 this->CreateOutputsForAllInputs();
39 this->CreateMembersForAllInputs();
42 for (
unsigned int i = 0; i < this->GetNumberOfOutputs() ; ++i)
50 else {output->
Graft(input);}
55 m_LoggedPositions[i].push_back(input->
GetPosition());
60 m_InvalidSamples[i]++;
67 while(this->m_LoggedPositions.size() < this->GetNumberOfInputs())
69 std::pair<std::size_t,std::vector<mitk::Point3D> > newElement(m_LoggedPositions.size(),std::vector<mitk::Point3D>());
70 m_LoggedPositions.insert(newElement);
72 while(this->m_LoggedQuaternions.size() < this->GetNumberOfInputs())
74 std::pair<std::size_t,std::vector<mitk::Quaternion> > newElement(m_LoggedQuaternions.size(),std::vector<mitk::Quaternion>());
75 m_LoggedQuaternions.insert(newElement);
77 while(this->m_InvalidSamples.size() < this->GetNumberOfInputs())
79 std::pair<std::size_t,int> newElement(m_InvalidSamples.size(),0);
80 m_InvalidSamples.insert(newElement);
88 for (
unsigned int i = 0; i < m_LoggedPositions.size(); i++) m_LoggedPositions[i] = std::vector<mitk::Point3D>();
89 for (
unsigned int i = 0; i < m_LoggedQuaternions.size(); i++) m_LoggedQuaternions[i] = std::vector<mitk::Quaternion>();
90 for (
unsigned int i = 0; i < m_InvalidSamples.size(); i++) m_InvalidSamples[i] = 0;
95 return this->m_LoggedPositions[input].size();
102 return myCalculator->GetPositionMean();
108 return myCalculator->GetPositionStandardDeviation();
114 return myCalculator->GetPositionSampleStandardDeviation();
119 return GetMean(m_LoggedQuaternions[input]);
125 std::vector<double> list1 = std::vector<double>();
126 std::vector<double> list2 = std::vector<double>();
127 std::vector<double> list3 = std::vector<double>();
128 std::vector<double> list4 = std::vector<double>();
129 for (
unsigned int i=0; i<m_LoggedQuaternions[input].size(); i++)
131 list1.push_back(m_LoggedQuaternions[input].at(i)[0]);
132 list2.push_back(m_LoggedQuaternions[input].at(i)[1]);
133 list3.push_back(m_LoggedQuaternions[input].at(i)[2]);
134 list4.push_back(m_LoggedQuaternions[input].at(i)[3]);
137 returnValue[0] = myCalculator->GetStabw(list1);
138 returnValue[1] = myCalculator->GetStabw(list2);
139 returnValue[2] = myCalculator->GetStabw(list3);
140 returnValue[3] = myCalculator->GetStabw(list4);
148 returnValue[0] = myCalculator->GetPositionMean()[0];
149 returnValue[1] = myCalculator->GetPositionMean()[1];
150 returnValue[2] = myCalculator->GetPositionMean()[2];
157 return myCalculator->GetPositionErrorRMS();
163 return myCalculator->GetPositionErrorRMS();
171 return myCalculator->GetPositionErrorMean();
177 return myCalculator->GetPositionErrorStandardDeviation();
183 return myCalculator->GetPositionErrorSampleStandardDeviation();
190 return myCalculator->GetPositionErrorRMS();
196 return myCalculator->GetPositionErrorMedian();
202 return myCalculator->GetPositionErrorMax();
208 return myCalculator->GetPositionErrorMin();
213 return m_InvalidSamples[input];
218 return (m_InvalidSamples[input]/(m_InvalidSamples[input]+((
double)m_LoggedPositions[input].size())))*100.0;
230 for (
unsigned int i=0; i<list.size(); i++)
232 mean[0] += list.at(i)[0];
233 mean[1] += list.at(i)[1];
234 mean[2] += list.at(i)[2];
235 mean[3] += list.at(i)[3];
238 mean[0] /= list.size();
239 mean[1] /= list.size();
240 mean[2] /= list.size();
241 mean[3] /= list.size();
249 for (
unsigned int i=0; i<pSet.size(); i++) returnValue->InsertPoint(i,pSet.at(i));
256 for (
unsigned int i=0; i<pSet.size(); i++)
259 thisPoint[0] = pSet.at(i)[0];
260 thisPoint[1] = pSet.at(i)[1];
261 thisPoint[2] = pSet.at(i)[2];
262 returnValue->InsertPoint(i,thisPoint);
269 std::vector<mitk::Vector3D> returnValue = std::vector<mitk::Vector3D>();
270 for (
unsigned int i=0; i<quaterions.size(); i++)
274 currentQuaternion.normalize();
275 eulerAngles[0] = currentQuaternion.rotation_euler_angles()[0];
276 eulerAngles[1] = currentQuaternion.rotation_euler_angles()[1];
277 eulerAngles[2] = currentQuaternion.rotation_euler_angles()[2];
278 returnValue.push_back(eulerAngles);
286 std::vector<mitk::Vector3D> returnValue = std::vector<mitk::Vector3D>();
287 std::vector<mitk::Vector3D> eulerAnglesRadians = QuaternionsToEulerAngles(quaterions);
288 for (
unsigned int i=0; i<eulerAnglesRadians.size(); i++)
291 currentAngles[0] = (eulerAnglesRadians.at(i)[0]/
PI)*180;
292 currentAngles[1] = (eulerAnglesRadians.at(i)[1]/
PI)*180;
293 currentAngles[2] = (eulerAnglesRadians.at(i)[2]/
PI)*180;
294 returnValue.push_back(currentAngles);
302 if (m_LoggedPositions[input].size()<=i) returnValue.Fill(0);
303 else returnValue = m_LoggedPositions[input].at(i);
311 if (m_LoggedQuaternions[input].size()<=i) returnValue.fill(0);
312 else returnValue = m_LoggedQuaternions[input].at(i);
itk::SmartPointer< Self > Pointer
NavigationDataToNavigationDataFilter is the base class of all filters that receive NavigationDatas as...
mitk::Quaternion GetMean(std::vector< mitk::Quaternion > list)
double GetPositionErrorStandardDeviation(int input)
DataCollection - Class to facilitate loading/accessing structured data.
virtual void SetDataValid(bool _arg)
sets the dataValid flag of the NavigationData object indicating if the object contains valid data ...
virtual OrientationType GetOrientation() const
returns the orientation of the NavigationData object
int GetNumberOfInvalidSamples(int input)
void CreateMembersForAllInputs()
Creates the member variables which store all the statistical data for every input.
const mitk::ScalarType PI
mitk::Point3D GetLoggedPosition(unsigned int i, int input)
double GetPositionErrorRMS(int input)
virtual void GenerateData() override
filter execute method
double GetPositionErrorMin(int input)
std::vector< mitk::Vector3D > QuaternionsToEulerAnglesGrad(std::vector< mitk::Quaternion > quaterions)
mitk::Quaternion GetQuaternionMean(int input)
void ResetStatistic()
Resets all statistics and starts again.
mitk::Vector3D GetPositionSampleStandardDeviation(int input)
std::vector< mitk::Vector3D > QuaternionsToEulerAngles(std::vector< mitk::Quaternion > quaterions)
Converts a list of quaterions to a list of euler angles (theta_x, theta_y, theta_z) ...
double GetPositionErrorMedian(int input)
mitk::Quaternion GetLoggedOrientation(unsigned int i, int input)
vnl_quaternion< ScalarType > Quaternion
mitk::Quaternion GetQuaternionStandardDeviation(int input)
virtual bool IsDataValid() const
returns true if the object contains valid data
double GetPositionErrorMax(int input)
mitk::Vector3D GetEulerAnglesMean(int input)
virtual PositionType GetPosition() const
returns position of the NavigationData object
mitk::PointSet::Pointer VectorToPointSet(std::vector< mitk::Point3D > pSet)
double GetEulerAnglesRMS(int input)
virtual void Graft(const DataObject *data) override
Graft the data and information from one NavigationData to another.
virtual ~NavigationDataEvaluationFilter()
mitk::Vector3D GetPositionStandardDeviation(int input)
int GetNumberOfAnalysedNavigationData(int input)
double GetPositionErrorSampleStandardDeviation(int input)
double GetPositionErrorMean(int input)
double GetPercentageOfInvalidSamples(int input)
mitk::Point3D GetPositionMean(int input)
double GetEulerAnglesRMSDegree(int input)
NavigationDataEvaluationFilter()