Datatype error

Hello @Romy_Meester,

Not sure how you are changing the pixel type, are you using the Cast filter:

img = sitk.ReadImage(file_name)
sitk.Show(img)
sitk.Show(sitk.Cast(img,sitk.sitkFloat64))

or you can force a type on read:

img = sitk.ReadImage(file_name, sitk.sitkFloat64)

Also, I noticed from your other post that you are creating functions and using the object oriented interface inside of them. SimpleITK supports a procedural interface for most, if not all, filters. So you don’t need to do this. For example, the WienerDeconvolutionImageFilter class and the WienerDeconvolutionImageFilter function, the GradientAnisotropicDiffusionImageFilter class and the GradientAnisotropicDiffusionImageFilter function. The easiest way to find if there is a procedural interface for a class is to go to the class documentation page and search for the word “procedural”.

1 Like