Just installed the latest version of SimpleITK and I'm trying to run a simple code as:
im = sitk.ReadImage('img.nii.gz')
im_bin = sitk.ReadImage('img_bin.nii.gz')
im_bfc = sitk.N4BiasFieldCorrection(im, im_bin)
the error is
RuntimeError: Exception thrown in SimpleITK N4BiasFieldCorrection: /scratch/dashboards/SimpleITK-OSX10.7-intel-pkg/SimpleITK/Code/Common/include/sitkDualMemberFunctionFactory.hxx:214:
sitk::ERROR: Pixel type: 64-bit signed integer is not supported in 2D byN3itk6simple32N4BiasFieldCorrectionImageFilterE
I tried with casting to different type, int, float, signed, unsigned, and I tried with 2d and 3d images. I tried as well to use https://itk.org/SimpleITKDoxygen07/html/N4BiasFieldCorrection_8py-example.html
And the error has always been the same. Other modules of SimpleITK appears to work.
Any idea? Can you reproduce the error?
Thanks!
This is the only way that I was able to get this working:
img = sitk.ReadImage(in_file)
img_mask = sitk.OtsuThreshold(img)
img = sitk.Cast(img, sitk.sitkFloat32)
corrector = sitk.N4BiasFieldCorrectionImageFilter()
img_c = corrector.Execute(img, img_mask)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With