Threshold min and max values

I’m trying to create an automatic segment generator by using the threshold method for any given DICOM images.
However, as it may seems, the values from the extremes of the range varies with distinct Volume Nodes provided in the Segmentation Editor.

Is there a way to calculate those values or to generalize them (making them constant to a given input)?

You can use the automated threshold algorithms (shanbhag, isodata, otsu, etc…) for reproducibility.

Yes, I’m attempting to do this.

However I’m not sure how to set the max and minimum values of the thresholdrange giving a certain DICOM image (and Volume Node consequently). I’m having a bad time to find this information in Slicer’s Github repo. Do you know where can I find it?

Automated threshold methods do not require min, max value of the volume. The calculate it based on the volume’s intensity distribution and the model they assume that to be (bimodal, trimodal etc).

You can obtain the min/max of the volume by reading the intensity values as a numpy array. Using MRhead as an example data.

>>> volumeNode = getNode("MRHead")
>>> voxels = slicer.util.arrayFromVolume(volumeNode)
>>> voxels.max()
279
>>> voxels.min()
0
1 Like

Thank you very much!