ITK Simple Filters - OtsuThresholdImageFilter Error

Hi there,

Operating system:window10
Slicer version: 4.13.0-2021-12-22 r30513 / 0a65de7

I’m trying to perform an Otsu thresholding inside a tumor mask (LabelMap 0/1) using the OtsuThresholdImageFilter in ITK Simple Filters, but it keeps ending in this error.

Exception thrown in SimpleITK OtsuThresholdImageFilter_Execute: D:\D\P\Slicer-0-build\SimpleITK\Code\Common\include\sitkProcessObject.h:354:
sitk::ERROR: Failure to convert SimpleITK image of dimension: 3 and pixel type: “16-bit signed integer” to ITK image of dimension: 3 and pixel type: “8-bit unsigned integer”!

I also tried to change the pixel type of the original scalar volume in different types using ResampleImageFilter function, but it doesn’t work either.
Am I doing something wrong or it is a bug?

thank you very much


You can try Cast Scalar Volume instead.

I think you could also prefix the SimpleITK: itk::simple::CastImageFilter Class Reference to your pipeline