[ITK-users] post a message

leena m leenzz.m at gmail.com
Wed Jun 27 23:36:36 EDT 2018


i'm a beginner in python wen i apply thresholding i'm getting error

import SimpleITK as sitk
img = sitk.ReadImage("Sub1.png")
img=img>20

i'm getting error as

RuntimeError                              Traceback (most recent call
last)<ipython-input-48-a1d4494dca15> in <module>()
      1 #img = sitk.Image(img.GetSize(), sitk.sitkUInt8)----> 2 img=img>20
~/sitkpy/lib/python3.5/site-packages/SimpleITK/SimpleITK.py in
__gt__(self, other)
   4424            return Greater( self, other )
   4425         try:-> 4426            return Greater( self, float(other) )
   4427         except (ValueError, TypeError):
   4428            return NotImplemented
~/sitkpy/lib/python3.5/site-packages/SimpleITK/SimpleITK.py in Greater(*args)
  34345
  34346     """
> 34347     return _SimpleITK.Greater(*args)
  34348 class GridImageSource(ImageFilter_0):
  34349     """
RuntimeError: Exception thrown in SimpleITK Greater:
/tmp/SimpleITK/Code/Common/include/sitkMemberFunctionFactory.hxx:209:
sitk::ERROR: Pixel type: vector of 8-bit unsigned integer is not
supported in 2D byN3itk6simple18GreaterImageFilterE

I applied img = sitk.Image(img.GetSize(), sitk.sitkUInt8)

but I'm getting a black image

Is there any option like double(img) or im2bw in python.Will normalize work?
<https://stackoverflow.com/questions/tagged/python>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://itk.org/pipermail/insight-users/attachments/20180628/dc4ea0ac/attachment.html>


More information about the Insight-users mailing list