# ITK Simple Filters - OtsuThresholdImageFilter Error

**URL:** <https://discourse.slicer.org/t/itk-simple-filters-otsuthresholdimagefilter-error/22747>\
**Category:** Support\
**Created:** [March 29, 2022, 1:09pm UTC](https://discourse.slicer.org/t/itk-simple-filters-otsuthresholdimagefilter-error/22747 "2022-03-29T13:09:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michele\_Bailo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/michele_bailo/32/67234_2.png) [@Michele\_Bailo](https://discourse.slicer.org/u/Michele_Bailo)\
**Post date:** [March 29, 2022, 1:09pm UTC](https://discourse.slicer.org/t/itk-simple-filters-otsuthresholdimagefilter-error/22747/1 "2022-03-29T13:09:49Z")

</div>

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

M

 ![Screen Shot 2022-03-29 at 14.56.24](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/3/c36f4473fc2a0dc5fee2b241301302766299676e.jpeg)

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [March 29, 2022, 1:35pm UTC](https://discourse.slicer.org/t/itk-simple-filters-otsuthresholdimagefilter-error/22747/2 "2022-03-29T13:35:55Z")

</div>

You can try Cast Scalar Volume instead.

---

<div class="post-metadata">

**Author:** ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)\
**Post date:** [March 29, 2022, 1:40pm UTC](https://discourse.slicer.org/t/itk-simple-filters-otsuthresholdimagefilter-error/22747/3 "2022-03-29T13:40:47Z")

</div>

I think you could also prefix the [SimpleITK: itk::simple::CastImageFilter Class Reference](https://simpleitk.org/doxygen/v2_1/html/classitk_1_1simple_1_1CastImageFilter.html) to your pipeline
