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

Francois Budin francois.budin at kitware.com
Tue Jan 24 10:29:04 EST 2017


Hello,

This does not look like a bug. It seems that the origin and spacing of your
mask and of your input image are different. Have you tried to run your
function only on the one (or few) images that fail?
Make sure that your mask and your image actually match in the physical
space.

Hope this helps,
Francois

On Tue, Jan 24, 2017 at 12:44 AM, Vishwanathan Shreyas <
shreyas122011 at gmail.com> wrote:

> 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
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170124/20e03141/attachment-0001.html>


More information about the Community mailing list