Our pretty useful class PointSetDifferenceStatisticsCalculator internally iterates over two given input PointSets via an integer which is set by PointSet->GetSize() and just incremented.
This works nicely, if the IDs of the input PointSets (Size n=3) are like this:
0,1,2
If not every integer is assigned to a valid ID, like this:
7, 12, 17
the method will use [0, 0, 0] points for each non-existing ID and thus give very nice result (difference between PointSets = 0).
This bug is very critical, as it is potentially hidden. I just run into it, because my PointSets had the size n=400 and my first ID was 7000. I could not believe that the difference between my two PointSets should be 0 for every value.
A simple fix is to iterate over the PointSets with a correct iterator:
mitk::PointSet::PointsIterator pointSetIterator = m_PointSet1->Begin();
mitk::PointSet::PointsIterator pointSetIterator2 = m_PointSet2->Begin();
mitk::PointSet::PointsIterator end = m_PointSet1->End();
while(pointSetIterator != end)
{ point1 = pointSetIterator.Value(); point2 = pointSetIterator2.Value();
[...]
I will fix this bug and enhance the test, but we should do some manual testing for the next release.