<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
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.
<div class=""><br class="">
</div>
<div class="">It is important to run it in a single threaded environment to rule out interaction with map_sync. Perhaps you can run it overnight?</div>
<div class=""><br class="">
</div>
<div class="">You can also try the multiprocessing library to perform parallel processing.</div>
<div class=""><br class="">
</div>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">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].</div>
<div class=""><br class="">
</div>
<div class="">While you are using separate process, there are some recent improvements in SimpleITK/ITK related to fixing issues with multi-threaded processing [2].</div>
<div class=""><br class="">
</div>
<div class="">HTH,</div>
<div class="">Brad</div>
<div class=""><br class="">
</div>
<div class="">[1] <a href="https://open.cdash.org/index.php?project=SimpleITK" class="">https://open.cdash.org/index.php?project=SimpleITK</a></div>
<div class="">[2] <a href="https://github.com/SimpleITK/SimpleITK/issues/74" class="">https://github.com/SimpleITK/SimpleITK/issues/74</a></div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Jan 25, 2017, at 12:57 AM, Vishwanathan Shreyas <<a href="mailto:shreyas122011@gmail.com" class="">shreyas122011@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">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.
<div class="">The error message shown is just for 1 engine(core). All the engines give this error message.</div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Wed, Jan 25, 2017 at 11:25 AM, Vishwanathan Shreyas <span dir="ltr" class="">
<<a href="mailto:shreyas122011@gmail.com" target="_blank" class="">shreyas122011@gmail.com</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb">
<div class="h5">
<div dir="ltr" class="">
<div class="gmail_quote"><br class="">
<div dir="ltr" class="">Hi Brad,<br class="">
<br class="">
"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.
<div class="">The platform I'm using is Windows Server 2012 standard. <br class="">
Also, there is no problem with the data as I ran a script to check it.</div>
<div class=""><br class="">
</div>
<div class="">Thanks,<br class="">
Shreyas</div>
</div>
<div class="m_-1098670515110857326HOEnZb">
<div class="m_-1098670515110857326h5">
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Tue, Jan 24, 2017 at 9:05 PM, Lowekamp, Bradley (NIH/NLM/LHC) [C]
<span dir="ltr" class=""><<a href="mailto:blowekamp@mail.nih.gov" target="_blank" class="">blowekamp@mail.nih.gov</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="">Hello,
<div class=""><br class="">
</div>
<div class="">I am not familiar with “map_sync”. Is it from this class:</div>
<div class=""><span class="m_-1098670515110857326m_1928363586134354973m_-4792830643368167401Apple-tab-span" style="white-space:pre-wrap"></span><a href="https://ipython.org/ipython-doc/3/api/generated/IPython.parallel.client.view.html" target="_blank" class="">https://ipython.org/ipython-do<wbr class="">c/3/api/generated/IPython.para<wbr class="">llel.client.view.html</a></div>
<div class="">Does it use threads or heavy weight processes?</div>
<div class=""><br class="">
</div>
<div class="">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?</div>
<div class=""><br class="">
</div>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">Brad</div>
<div class=""><br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">
<div class="m_-1098670515110857326m_1928363586134354973h5">
<div class="">On Jan 24, 2017, at 12:44 AM, Vishwanathan Shreyas <<a href="mailto:shreyas122011@gmail.com" target="_blank" class="">shreyas122011@gmail.com</a>> wrote:</div>
<br class="m_-1098670515110857326m_1928363586134354973m_-4792830643368167401Apple-interchange-newline">
</div>
</div>
<div class="">
<div class="">
<div class="m_-1098670515110857326m_1928363586134354973h5">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class="">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:<br class="">
<pre style="background-image:none;background-color:rgb(255,255,255);background-position:0% 0%;background-repeat:repeat repeat" class=""><span style="color:rgb(128,0,0);font-weight:bold" class="">def</span> N43D<span style="color:rgb(128,128,48)" class="">(</span>fl<span style="color:rgb(128,128,48)" class="">)</span><span style="color:rgb(128,128,48)" class="">:</span>
im <span style="color:rgb(128,128,48)" class="">=</span> SimpleITK<span style="color:rgb(128,128,48)" class="">.</span>ReadImage<span style="color:rgb(128,128,48)" class="">(</span>fl<span style="color:rgb(128,128,48)" class="">)</span>
msk <span style="color:rgb(128,128,48)" class="">=</span> SimpleITK<span style="color:rgb(128,128,48)" class="">.</span>BinaryThreshold<span style="color:rgb(128,128,48)" class="">(</span>im<span style="color:rgb(128,128,48)" class="">,</span> <span style="color:rgb(0,140,0)" class="">0</span><span style="color:rgb(128,128,48)" class="">,</span> <span style="color:rgb(0,140,0)" class="">0</span><span style="color:rgb(128,128,48)" class="">)</span>
msk <span style="color:rgb(128,128,48)" class="">=</span> SimpleITK<span style="color:rgb(128,128,48)" class="">.</span>BinaryNot<span style="color:rgb(128,128,48)" class="">(</span>msk<span style="color:rgb(128,128,48)" class="">)</span>
msk <span style="color:rgb(128,128,48)" class="">=</span> SimpleITK<span style="color:rgb(128,128,48)" class="">.</span>Cast<span style="color:rgb(128,128,48)" class="">(</span>msk<span style="color:rgb(128,128,48)" class="">,</span> SimpleITK<span style="color:rgb(128,128,48)" class="">.</span>sitkUInt8<span style="color:rgb(128,128,48)" class="">)</span>
im <span style="color:rgb(128,128,48)" class="">=</span> SimpleITK<span style="color:rgb(128,128,48)" class="">.</span>Cast<span style="color:rgb(128,128,48)" class="">(</span>im<span style="color:rgb(128,128,48)" class="">,</span> SimpleITK<span style="color:rgb(128,128,48)" class="">.</span>sitkFloat32<span style="color:rgb(128,128,48)" class="">)</span>
im_n4 <span style="color:rgb(128,128,48)" class="">=</span> SimpleITK<span style="color:rgb(128,128,48)" class="">.</span>N4BiasFieldCorrectio<wbr class="">n<span style="color:rgb(128,128,48)" class="">(</span>im<span style="color:rgb(128,128,48)" class="">,</span> msk<span style="color:rgb(128,128,48)" class="">)</span>
SimpleITK<span style="color:rgb(128,128,48)" class="">.</span>WriteImage<span style="color:rgb(128,128,48)" class="">(</span>im_n4<span style="color:rgb(128,128,48)" class="">,</span> os<span style="color:rgb(128,128,48)" class="">.</span>path<span style="color:rgb(128,128,48)" class="">.</span>splitext<span style="color:rgb(128,128,48)" class="">(</span>fl<span style="color:rgb(128,128,48)" class="">)</span><span style="color:rgb(128,128,48)" class="">[</span><span style="color:rgb(0,140,0)" class="">0</span><span style="color:rgb(128,128,48)" class="">]</span><span style="color:rgb(68,170,221)" class="">+</span><span style="color:rgb(0,0,230)" class="">'_n4.m<wbr class="">ha'</span><span style="color:rgb(128,128,48)" class="">,</span> useCompression<span style="color:rgb(128,128,48)" class="">=</span><span style="color:rgb(7,71,38)" class="">True</span><span style="color:rgb(128,128,48)" class="">)</span></pre>
<br class="">
<br class="">
Also, I'm using multiple cores for a list of files:<br class="">
<pre style="background-image:none;background-color:rgb(255,255,255);background-position:0% 0%;background-repeat:repeat repeat" class="">dview<span style="color:rgb(128,128,48)" class="">.</span>map_sync<span style="color:rgb(128,128,48)" class="">(</span>N43D<span style="color:rgb(128,128,48)" class="">,</span> fl<span style="color:rgb(128,128,48)" class="">)</span></pre>
<br class="">
<br class="">
The program runs fine for about 40 files. Then I get this error on all my engines:<br class="">
<pre style="background-image:none;background-color:rgb(255,255,255);background-position:0% 0%;background-repeat:repeat repeat" class=""><span style="color:rgb(128,128,48)" class="">[</span><span style="color:rgb(0,140,0)" class="">0</span><span style="color:rgb(128,128,48)" class="">:</span>apply<span style="color:rgb(128,128,48)" class="">]</span><span style="color:rgb(128,128,48)" class="">:</span>
RuntimeErrorTraceback <span style="color:rgb(128,128,48)" class="">(</span>most recent call last<span style="color:rgb(128,128,48)" class="">)</span><span style="color:rgb(68,170,221)" class=""><</span>string<span style="color:rgb(68,170,221)" class="">></span> <span style="color:rgb(128,0,0);font-weight:bold" class="">in</span> <span style="color:rgb(68,170,221)" class=""><</span>module<span style="color:rgb(68,170,221)" class="">></span><span style="color:rgb(128,128,48)" class="">(</span><span style="color:rgb(128,128,48)" class="">)</span>
<span style="color:rgb(68,170,221)" class=""><</span>ipython<span style="color:rgb(68,170,221)" class="">-</span><span style="color:rgb(64,0,0)" class="">input</span><span style="color:rgb(68,170,221)" class="">-</span>56<span style="color:rgb(68,170,221)" class="">-</span>03a02a993653<span style="color:rgb(68,170,221)" class=""><wbr class="">></span> <span style="color:rgb(128,0,0);font-weight:bold" class="">in</span> N43D<span style="color:rgb(128,128,48)" class="">(</span>fl<span style="color:rgb(128,128,48)" class="">)</span>
c<span style="color:rgb(128,128,48)" class="">:</span>\users\shreyas_v\anaconda2\l<wbr class="">ib\site<span style="color:rgb(68,170,221)" class="">-</span>packages\SimpleITK\Sim<wbr class="">pleITK<span style="color:rgb(128,128,48)" class="">.</span>pyc <span style="color:rgb(128,0,0);font-weight:bold" class="">in</span> N4BiasFieldCorrection<span style="color:rgb(128,128,48)" class="">(</span><span style="color:rgb(68,170,221)" class="">*</span>args<span style="color:rgb(128,128,48)" class="">,</span> <span style="color:rgb(68,170,221)" class="">**</span>kwargs<span style="color:rgb(128,128,48)" class="">)</span>
<span style="color:rgb(0,140,0)" class="">43368</span>
<span style="color:rgb(0,140,0)" class="">43369</span> <span style="color:rgb(105,105,105)" class="">"""</span>
<span style="color:rgb(105,105,105)" class="">> 43370 return _SimpleITK.N4BiasFieldCorrecti<wbr class="">on(*args, **kwargs)</span>
<span style="color:rgb(105,105,105)" class=""> 43371 class NaryAddImageFilter(ImageFilter<wbr class="">_3):</span>
<span style="color:rgb(105,105,105)" class=""> 43372 """</span>
<span style="color:rgb(7,71,38)" class="">RuntimeError</span><span style="color:rgb(128,128,48)" class="">:</span> <span style="color:rgb(7,71,38)" class="">Exception</span> thrown <span style="color:rgb(128,0,0);font-weight:bold" class="">in</span> SimpleITK N4BiasFieldCorrection<span style="color:rgb(128,128,48)" class="">:</span> c<span style="color:rgb(128,128,48)" class="">:</span>\d\vs9<span style="color:rgb(68,170,221)" class="">-</span>pkg\simpleitk<span style="color:rgb(68,170,221)" class="">-</span>build\i<wbr class="">tk\modules\core\common\include<wbr class="">\itkImageToImageFilter<span style="color:rgb(128,128,48)" class="">.</span>hxx<span style="color:rgb(128,128,48)" class="">:</span><span style="color:rgb(0,140,0)" class="">248</span><span style="color:rgb(128,128,48)" class=""><wbr class="">:</span>
itk<span style="color:rgb(128,128,48)" class="">:</span><span style="color:rgb(128,128,48)" class="">:</span>ERROR<span style="color:rgb(128,128,48)" class="">:</span> SubtractImageFilter<span style="color:rgb(128,128,48)" class="">(</span>0000000006<wbr class="">5D8220<span style="color:rgb(128,128,48)" class="">)</span><span style="color:rgb(128,128,48)" class="">:</span> Inputs do <span style="color:rgb(128,0,0);font-weight:bold" class="">not</span> occupy the same physical space!
InputImage Origin<span style="color:rgb(128,128,48)" class="">:</span> <span style="color:rgb(128,128,48)" class="">[</span><span style="color:rgb(0,128,0)" class="">0.0000000e+000</span><span style="color:rgb(128,128,48)" class="">,</span> <span style="color:rgb(68,170,221)" class="">-</span><span style="color:rgb(0,128,0)" class="">2.3900000e+002</span><span style="color:rgb(128,128,48)" class="">,</span> <span style="color:rgb(0,128,0)" class="">0.0000000e+000</span><span style="color:rgb(128,128,48)" class="">]</span><span style="color:rgb(128,128,48)" class="">,</span> InputImage_1 Origin<span style="color:rgb(128,128,48)" class="">:</span> <span style="color:rgb(128,128,48)" class="">[</span><span style="color:rgb(68,170,221)" class="">-</span><span style="color:rgb(0,128,0)" class="">5.9750000e+001</span><span style="color:rgb(128,128,48)" class="">,</span> <span style="color:rgb(68,170,221)" class="">-</span><span style="color:rgb(0,128,0)" class="">5.9750000e+001</span><span style="color:rgb(128,128,48)" class="">,</span> <span style="color:rgb(68,170,221)" class="">-</span><span style="color:rgb(0,128,0)" class="">3.8500000e+001</span><span style="color:rgb(128,128,48)" class="">]</span>
Tolerance<span style="color:rgb(128,128,48)" class="">:</span> <span style="color:rgb(0,128,0)" class="">1.0000000e-006</span>
InputImage Spacing<span style="color:rgb(128,128,48)" class="">:</span> <span style="color:rgb(128,128,48)" class="">[</span><span style="color:rgb(0,128,0)" class="">1.0000000e+000</span><span style="color:rgb(128,128,48)" class="">,</span> <span style="color:rgb(0,128,0)" class="">1.0000000e+000</span><span style="color:rgb(128,128,48)" class="">,</span> <span style="color:rgb(0,128,0)" class="">1.0000000e+000</span><span style="color:rgb(128,128,48)" class="">]</span><span style="color:rgb(128,128,48)" class="">,</span> InputImage_1 Spacing<span style="color:rgb(128,128,48)" class="">:</span> <span style="color:rgb(128,128,48)" class="">[</span><span style="color:rgb(0,128,0)" class="">5.9750000e+001</span><span style="color:rgb(128,128,48)" class="">,</span> <span style="color:rgb(0,128,0)" class="">5.9750000e+001</span><span style="color:rgb(128,128,48)" class="">,</span> <span style="color:rgb(0,128,0)" class="">3.8500000e+001</span><span style="color:rgb(128,128,48)" class="">]</span>
Tolerance<span style="color:rgb(128,128,48)" class="">:</span> <span style="color:rgb(0,128,0)" class="">1.0000000e-006</span></pre>
<br class="">
</div>
Has anyone faced this issue before?<br class="">
<br class="">
</div>
Regards,<br class="">
</div>
Shreyas<br class="">
</div>
</div>
</div>
<span class="">______________________________<wbr class="">_________________<br class="">
Community mailing list<br class="">
<a href="mailto:Community@itk.org" target="_blank" class="">Community@itk.org</a><br class="">
<a href="http://public.kitware.com/mailman/listinfo/community" target="_blank" class="">http://public.kitware.com/mail<wbr class="">man/listinfo/community</a><br class="">
</span></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
<br class="">
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>