[ITK] itk error: Inputs do not occupy the same physical space!

Vishwanathan Shreyas shreyas122011 at gmail.com
Tue Jan 24 00:44:04 EST 2017


SimpleITK on python gives me a weird bug, after running successfully a few
times. I'm using the MICCAI BRATS database. Here's my code:

def N43D(fl):

    im = SimpleITK.ReadImage(fl)

    msk = SimpleITK.BinaryThreshold(im, 0, 0)

    msk = SimpleITK.BinaryNot(msk)

    msk = SimpleITK.Cast(msk, SimpleITK.sitkUInt8)

    im = SimpleITK.Cast(im, SimpleITK.sitkFloat32)

    im_n4 = SimpleITK.N4BiasFieldCorrection(im, msk)

    SimpleITK.WriteImage(im_n4, os.path.splitext(fl)[0]+'_n4.mha',
useCompression=True)



Also, I'm using multiple cores for a list of files:

dview.map_sync(N43D, fl)



The program runs fine for about 40 files. Then I get this error on all my
engines:

[0:apply]:
RuntimeErrorTraceback (most recent call last)<string> in
<module>()<ipython-input-56-03a02a993653> in N43D(fl)
c:\users\shreyas_v\anaconda2\lib\site-packages\SimpleITK\SimpleITK.pyc
in N4BiasFieldCorrection(*args, **kwargs)
  43368
  43369     """> 43370     return
_SimpleITK.N4BiasFieldCorrection(*args, **kwargs)  43371 class
NaryAddImageFilter(ImageFilter_3):  43372     """RuntimeError:
Exception thrown in SimpleITK N4BiasFieldCorrection:
c:\d\vs9-pkg\simpleitk-build\itk\modules\core\common\include\itkImageToImageFilter.hxx:248:
itk::ERROR: SubtractImageFilter(00000000065D8220): Inputs do not
occupy the same physical space!
InputImage Origin: [0.0000000e+000, -2.3900000e+002, 0.0000000e+000],
InputImage_1 Origin: [-5.9750000e+001, -5.9750000e+001,
-3.8500000e+001]
    Tolerance: 1.0000000e-006
InputImage Spacing: [1.0000000e+000, 1.0000000e+000, 1.0000000e+000],
InputImage_1 Spacing: [5.9750000e+001, 5.9750000e+001, 3.8500000e+001]
    Tolerance: 1.0000000e-006


Has anyone faced this issue before?

Regards,
Shreyas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170124/5298c94e/attachment.html>


More information about the Community mailing list