How to set the "Method" in ThresholdImageFilter in sitk

Hello,
I’m trying to work my way around the ThresholdImageFilter class. My goal is to “cap” the image at some lower and upper bound (lb, ub). Everything below lb shall be set to lb and everything above ub shall be set to ub.
Now, I see that the ThresholdImageFilter class only has one single SetOutsideValue option, so I think I’d need two executions of the filter. The documentation states there are methods that it can use, ThresholdAbove(), ThresholdBelow() and ThresholdOutside(), however I fail to see where and how I can set them.

Thank you for your help!

(Python 3.9 and sitk 2.0.2)

Hello,

The ClampImageFilter is the filter you are looking for.

Brad

2 Likes

Sigh, I’m sure I went through the filter list 2 or 3 times by now and even thought to check for a “clamp” keyword (alas, didn’t) and it slipped past me. Thank you very much!