How to get Statistics data in a region with non zero values

I have a 3D label object collection.From that I need to find min max and mean value in another volume of same dimension.
For that i took bounding box from label object and extracted the region from volume and used itk StatisticsImageFilter to find min,max and mean.
As the bounding box returing by label consists of zero valued voxels also(background region) the min ,max value is going wrong.
So how to extract only the region with non zero values.?
Is there any filters available?

Does MaskedImageToHistogramFilter do what you want?

1 Like

Hello,

You can look into the LabelStatisticsImageFilter and the LabelImageToStatisticsImageFilter with the StatisticsLabelObject for these operations.

After using LabelStatisticsImageFilter i got the bounding box of a label. I need to find the min,max value of same bounding box region in another volume.
But I have to exclude the zero pixel value region in the bounding box.

Or Should i check for non zero values in a loop and create an small region and use itk::StatisticsImageFilter to get min max?

Sorry this filter doesn’t solved the problem.

Thank you the suggestion

It looks like the ITK 5.2 nightly Doxygen for the LabelStatisticsImageFilter is borked, and missing most of the class methods. The class has a GetMinimum and GetMaximum methods which take an argument for the “LabelID”:

Edit: This is an example the other filter earlier linked. I’m not sure how it got on the LabelStatisticsImageFilter Doxygen paged.
And an example may help:
https://itk.org/ITKExamples/src/Filtering/ImageStatistics/StatisticalPropertiesOfRegions/Documentation.html