21 m_StatisticsCalculated(false)
34 m_StatisticsCalculated =
false;
44 if (pSet1.IsNotNull())
48 if (pSet2.IsNotNull())
52 m_StatisticsCalculated =
false;
58 if (!m_StatisticsCalculated)
60 this->ComputeStatistics();
62 return m_DifferencesVector;
67 if (!m_StatisticsCalculated)
69 this->ComputeStatistics();
71 return m_SquaredDifferencesVector;
76 if (!m_StatisticsCalculated)
78 this->ComputeStatistics();
80 return m_Statistics->GetMean();
85 if (!m_StatisticsCalculated)
87 this->ComputeStatistics();
89 return m_Statistics->GetStd();
94 if (!m_StatisticsCalculated)
96 this->ComputeStatistics();
98 return m_Statistics->GetVariance();
103 if (!m_StatisticsCalculated)
105 this->ComputeStatistics();
107 return m_Statistics->GetRMS();
112 if (!m_StatisticsCalculated)
114 this->ComputeStatistics();
116 return m_Statistics->GetMedian();
121 if (!m_StatisticsCalculated)
123 this->ComputeStatistics();
125 return m_Statistics->GetMax();
130 if (!m_StatisticsCalculated)
132 this->ComputeStatistics();
134 return m_Statistics->GetMin();
139 if (!m_StatisticsCalculated)
141 this->ComputeStatistics();
143 return m_Statistics->GetN();
148 if ((m_PointSet1.IsNull())||(m_PointSet2.IsNull()))
150 itkExceptionMacro(
"Point sets specified are not valid. Please specify correct Point sets");
152 else if (m_PointSet1->GetSize()!=m_PointSet2->GetSize())
154 itkExceptionMacro(
"PointSets are not equal. Please make sure that your PointSets have the same size and hold corresponding points.");
156 else if (m_PointSet1->GetSize()==0)
158 itkExceptionMacro(
"There are no points in the PointSets. Please make sure that the PointSets contain points");
166 std::vector<double> differencesVector;
169 int numberOfPoints = m_PointSet1->GetSize();
174 pointSetIterator != end; ++pointSetIterator, ++pointSetIterator2)
176 point1 = pointSetIterator.Value();
177 point2 = pointSetIterator2.Value();
179 double squaredDistance = point1.SquaredEuclideanDistanceTo(point2);
180 mean+=sqrt(squaredDistance);
181 rms+=squaredDistance;
182 this->m_SquaredDifferencesVector.push_back(squaredDistance);
183 differencesVector.push_back(sqrt(squaredDistance));
186 m_DifferencesVector = differencesVector;
187 mean = mean/numberOfPoints;
188 rms = sqrt(rms/numberOfPoints);
189 for (std::vector<double>::size_type i=0; i<differencesVector.size(); i++)
191 sd+=(differencesVector.at(i)-mean)*(differencesVector.at(i)-mean);
193 double variance = sd/numberOfPoints;
195 std::sort(differencesVector.begin(),differencesVector.end());
197 if (numberOfPoints%2 == 0)
199 median = (differencesVector.at(numberOfPoints/2)+differencesVector.at(numberOfPoints/2-1))/2;
203 median = differencesVector.at((numberOfPoints-1)/2+1);
205 m_Statistics->SetMean(mean);
206 m_Statistics->SetStd(sd);
207 m_Statistics->SetVariance(variance);
208 m_Statistics->SetRMS(rms);
209 m_Statistics->SetMin(differencesVector.at(0));
210 m_Statistics->SetMax(differencesVector.at(numberOfPoints-1));
211 m_Statistics->SetMedian(median);
212 m_Statistics->SetN(numberOfPoints);
214 m_StatisticsCalculated =
true;
DataType::PointsContainerIterator PointsIterator
double GetRMS()
returns the root mean squared distance of all corresponding points of the point sets ...
double GetMax()
returns the maximal distance of all corresponding points of the point sets
mitk::PointSet::Pointer m_PointSet2
second point set used for comparison
std::vector< double > GetSquaredDifferences()
returns a vector holding the squared differences between the corresponding points of the point sets ...
double GetNumberOfPoints()
returns the total number of corresponding points of the point sets
virtual ~PointSetDifferenceStatisticsCalculator()
std::vector< double > GetDifferences()
returns a vector holding the differences between the corresponding points of the point sets ...
void SetPointSets(mitk::PointSet::Pointer pSet1, mitk::PointSet::Pointer pSet2)
set point sets to be compared
double GetSD()
returns the standard deviation of the distances between all corresponding points of the point sets ...
mitk::ImageStatisticsCalculator::StatisticsContainer::Pointer m_Statistics
struct holding the statistics
double GetVariance()
returns the variance of the distances between all corresponding points of the point sets ...
double GetMin()
returns the minimal distance of all corresponding points of the point sets
mitk::PointSet::Pointer m_PointSet1
first point set used for comparison
double GetMean()
returns the mean distance of all corresponding points of the point sets
double GetMedian()
returns the median distance of all corresponding points of the point sets
PointSetDifferenceStatisticsCalculator()
void ComputeStatistics()
Method for computing the complete statistics of the differences between the given point sets...