[ITK] itk error: Inputs do not occupy the same physical space!
Lowekamp, Bradley (NIH/NLM/LHC) [C]
blowekamp at mail.nih.gov
Wed Jan 25 09:59:53 EST 2017
I agree, your mask _should_ occupy the same physical space as the image it originates. This leads me to believe that it more of a multi-processing issue along with the description of failing with “random” file. It seems like there is some interaction with the multi-processing library/approach being used.
It is important to run it in a single threaded environment to rule out interaction with map_sync. Perhaps you can run it overnight?
You can also try the multiprocessing library to perform parallel processing.
What version of Python are you using (distribution and version)? What version of SimpleITK are you using? It is possible there is some compiler/library compatibility issue that is reviled with this multi-processing library.
I also suggest trying a nightly build of SimpleITK which can be download by clicking on a “golden box” on the nightly dashboard for the correct build [1].
While you are using separate process, there are some recent improvements in SimpleITK/ITK related to fixing issues with multi-threaded processing [2].
HTH,
Brad
[1] https://open.cdash.org/index.php?project=SimpleITK
[2] https://github.com/SimpleITK/SimpleITK/issues/74
On Jan 25, 2017, at 12:57 AM, Vishwanathan Shreyas <shreyas122011 at gmail.com<mailto:shreyas122011 at gmail.com>> wrote:
Also if you look at my program, the mask is derived from the image itself, so highly unlikely that it will occupy a different space.
The error message shown is just for 1 engine(core). All the engines give this error message.
On Wed, Jan 25, 2017 at 11:25 AM, Vishwanathan Shreyas <shreyas122011 at gmail.com<mailto:shreyas122011 at gmail.com>> wrote:
Hi Brad,
"map_sync" here uses heavyweight independent processes. Also, the filter fails on random files every time I run it. I ran it on a single core but it was taking about 13 min for processing a single file, so I did not waste time on running it as a single threaded function for any more files.
The platform I'm using is Windows Server 2012 standard.
Also, there is no problem with the data as I ran a script to check it.
Thanks,
Shreyas
On Tue, Jan 24, 2017 at 9:05 PM, Lowekamp, Bradley (NIH/NLM/LHC) [C] <blowekamp at mail.nih.gov<mailto:blowekamp at mail.nih.gov>> wrote:
Hello,
I am not familiar with “map_sync”. Is it from this class:
https://ipython.org/ipython-doc/3/api/generated/IPython.parallel.client.view.html
Does it use threads or heavy weight processes?
If you run the filter with just the single threaded map function does it fail the same way? Which file does it fail on? If you just run it on that file does it still fail?
We need to narrow down the problem to determine if it’s related to the way you are executing, or if perhaps N4 has a problem with your data. Perhaps it is some type of degenerate case, or there is a bug in the filter.
Thanks,
Brad
On Jan 24, 2017, at 12:44 AM, Vishwanathan Shreyas <shreyas122011 at gmail.com<mailto: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<mailto: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/20170125/697a86c1/attachment-0001.html>
More information about the Community
mailing list