Error in using filter

simpleitk

(leena) #1

import SimpleITK as sitk
image = sitk.ReadImage(“f.png”)
from skimage import filters
edges = filters.scharr(image)

UserWarning: Possible precision loss when converting from int64 to float64
.format(dtypeobj_in, dtypeobj_out))

plt.imshow(edges) returns nothing

(Ziv Yaniv) #2

This is surprising that you only ended with a UserWarning and not an exception. SimpleITK images are not compatible with skimage’s expectation of numpy arrays. You can get a numpy array from a SimpleITK image using the GetArrayFromImage method. I would suggest that you familiarize yourself with SimpleITK by going over the SimpleITK Jupyter notebooks. You can either clone the comprehensive repository or a shorter tutorial given at ISBI’18.