+ if (DropDuplicatePositions)
+ {
+ // ImagePositionPatientOrdering wrong duplicates are found ???
+ // --> fixed. See comment
+
+ it3 = distmultimap.upper_bound((*it3).first); // skip all duplicates
+ // the upper_bound function increments the iterator to the next non-duplicate entry
+ // The for loop iteration also increments the iterator, which causes the code to skip every other image
+ // --> decrement the iterator after the upper_bound function call
+ it3--;
+ if (it3 == distmultimap.end() ) // if last image, stop iterate
+ break;
+ }