I want to segment an image. I used simple thresholding method.For that I read the image and convert it into array and then img is converted
import SimpleITK as sitk
import numpy as np
header = sitk.ReadImage("Sub1.png")
img = sitk.GetArrayFromImage(header)
a=img
img = ((img > 20) * 255).astype(np.uint8)
# To visualize the labels image in RGB with needs a image with 0-255 range
img_T1_255 = sitk.Cast(sitk.RescaleIntensity(a), sitk.sitkUInt8)
myshow(sitk.LabelOverlay(img_T1_255, img), "Basic Thresholding")
Error is:
TypeError Traceback (most recent call last)
in ()
8 img = ((img > 20) * 255).astype(np.uint8)
9 # To visualize the labels image in RGB with needs a image with 0-255 range
---> 10 img_T1_255 = sitk.Cast(sitk.Res