I have a 3D MR image as a NIfTI file (.nii.gz
). I also have a 'mask' image as a NIfTI file, which is just a bunch of 0s and 1s. The 1s in this mask image represent the region of the 3D MR image I am interested in.
I want to retrieve the intensities of the pixels in the 3D MRI image which exist in the mask (i.e. are 1s in the mask image file). The only intensity feature I have found is sitk.MinimumMaximumImageFilter
which isn't too useful since it uses the entire image (instead of a particular region), and also only gives the minimum and maximum of said image.
I don't think that the GetPixel()
function helps me in this case either, since the 'pixel value' that it outputs is different to the intensity which I observe in the ITK-SNAP viewer. Is this correct?
What tool or feature could I use to help in this scenario?
You might want to use itk::Statistics::MaskedImageToHistogramFilter, followed by min = histogram.Quantile(0, 0.0)
and max = histogram.Quantile(0, 1.0)
. You probably need to use more bins than the example uses.