How to decide threshold values for different structures in CT based on histogram?

how to decide threshold values for different structures in CT based on histogram?
Operating system:
Slicer version:
Expected behavior:
Actual behavior:

Hi @Emily_BM,

There are many histogram-based thresholding algorithms available in ITK.

Checkout this histogram-based thresholding Insight Journal article


or this article or the ITK thresholding classes’ documentation.

Somehow I’ve come across this old topic now.

@thewtex, what is your experience, do you find these histogram-based thresholding methods useful in practice?

I usually choose threshold value manually, based on live preview (provided for example by Segment Editor’s Threshold effect). If a good global threshold value exists then I can find it within 5-10 seconds. How automatic methods could make this faster or simpler? Also, don’t you need manual adjustment anyways?

For automated processing, instead of simple global thresholding, we had much better results with grow-cut or watershed based segmentation, with seed regions determined by registering an atlas.

@lassoan yes, I find them very useful in practice.

I usually start with the classic (multiple) Otsu threshold, then possibly try other methods.

We could make this faster and simpler in Slicer creating a module that just runs all the automatic thresholding algorithms and displays the results. Something like scikit-image try_all_threshold:

Very interesting. I find that global thresholding is typically usable for only a few structures, such as skin surface, bones, maybe contrasted vessels/tumors, and they always require post-processing.

Can you attach screenshots that illustrate how you use it? What can you usually segment with it? Does it save you time or offer better results in some way than moving a slider manually? Are there some usable links to local/adaptive variants?

I would definitely second this feature.

@muratmaga For what kind of images and structures you would use automatic threshold value recommendation? How long does it take to set the threshold value manually (based on live preview in slice views)? - It is important to know these, because the priority of a feature request is higher if it saves a lot of time and can be used for many cases.

My typical use case for this is would be contrast (iodine based) enhanced microCT scans of dissected soft tissues (e.g., from mice or pathology samples), in which diffusion of contrast may vary from sample to sample. IN these case, I would be calculating some sort of a tissue to total volume fraction. I currently use Fiji for this specific use-case.

The importance of the feature for me is more for reproducibility and being objective more so than saving time.

Reproducibility is a good point. While usually the difference should be negligible between different operators, it my be still more elegant to say that threshold was selected by using XYZ algorithm.

I’ll add automatic threshold setting to Threshold effect in Segment Editor module.

@muratmaga Do you always compute the threshold on the entire image, or on a region of interest / masked region?


Hard to generalize, but often volumes are already cropped down to contain only the sample of interest. So I am inclined to say entire image.

Mail]( for Windows 10

I’ve implemented the feature (r27207). It will be available in nightly builds that you download tomorrow or later.

1 Like


I finally tested this. Looks great, thank you. Is there something wrong with Shanbhag method? Everything else seems to produce reasonable threshold, but Shanbhag results in an empty selection (i.e, values too high, MRhead dataset). This is with a nightly from a week ago .

It is normal that only certain methods provide meaningful threshold for a certain image. Shanbhag method seems to be sensitive to large uniform background regions.

hi @lassoan
how can we add this auto threshold method in our scripted module ??
i have seen that triangle gives highest threshold object(metal object etc.)
do we have any method to catch bone??

You can follow the example here and call autoThreshold method to compute the threshold.

Note that automatic threshold computation will not solve any difficult segmentation problem. It is mainly for standardizing threshold selection for trivial cases.

1 Like