Page MenuHomePhabricator

mitkImageStatisticsCalculator: refactoring of min and max index search
Closed, ResolvedPublic

Description

In the method ImageStatisticsCalculator::InternalCalculateStatisticsMasked the itk::MinimumMaximumImageFilter is used to get the index values for min and max. This filter only determines the min and max of an input image, without a mask (so min and max of the complete input image).

To be able to get the min and max index values in dependence to the mask an image is created (using the itk::MaskImageFilter) where the values outside the segmentation are set to a value which is between the min and max value:

outsideValue = (min + max)/2

The whole approach is in my opinion not very nice and hard to understand when first looking at it.
The itk::LabelStatisticsImageFilter used for the actual statistics calculation unfortunately does not provide the index for the max and min values. This should be easily changeable in the itk::LabelStatisticsImageFilter (I haven't looked at the actual code of the filter yet) and the workaround implemented here is way to complicated. Also this would save time because the statistics have already been calculated and it seems like a waste to create another image and calculate again the max and min values just to get the index values.

Event Timeline

Would it make sense to propose a patch for the itk::LabelStatisticsImageFilter class on the ITK users mailing list?

kislinsk claimed this task.
kislinsk added subscribers: isensee, kislinsk.

Should be solved by the new statistics backend by @isensee.

This issue is adressed and solved in my branch (see Task T19609).

For some unknown reason the old image statistics calculator sometimes even calculated the min/max value more than once. This is all fixed now and should be merged soon (hopefully ;-) )