I have read an image and converted into array. then I took a slice. but it seems to work.But when I apply RescaleIntensity or any other function I’m getting error
import SimpleITK as sitk
img = sitk.ReadImage(“S1.nii”)
a=sitk.GetArrayFromImage(img)
im=a[:,:,19]
Error is:
TypeError Traceback (most recent call last)
in ()
----> 1 img_255 = sitk.Cast(sitk.RescaleIntensity(im), sitk.sitkUInt8)
~/sitkpy/lib/python3.5/site-packages/SimpleITK/SimpleITK.py in RescaleIntensity(image1, outputMinimum, outputMaximum)
58734
58735 “”"
58736 return _SimpleITK.RescaleIntensity(image1, outputMinimum, outputMaximum)
58737 class RichardsonLucyDeconvolutionImageFilter(ImageFilter_2):
58738 “”"
TypeError: in method ‘RescaleIntensity’, argument 1 of type ‘itk::simple::Image const &’
img_255 = sitk.Cast(sitk.RescaleIntensity(im), sitk.sitkUInt8)