<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="">
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="Apple-tab-span" style="white-space:pre"></span><a href="https://ipython.org/ipython-doc/3/api/generated/IPython.parallel.client.view.html" class="">https://ipython.org/ipython-doc/3/api/generated/IPython.parallel.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>
<blockquote type="cite" class="">
<div class="">On Jan 24, 2017, at 12:44 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="">
<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-attachment: scroll; 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>N4BiasFieldCorrection<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.mha'</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-attachment: scroll; 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-attachment: scroll; 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="">></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\lib\site<span style="color:rgb(68,170,221)" class="">-</span>packages\SimpleITK\SimpleITK<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.N4BiasFieldCorrection(*args, **kwargs)</span>
<span style="color:rgb(105,105,105)" class=""> 43371 class NaryAddImageFilter(ImageFilter_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\itk\modules\core\common\include\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="">:</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>00000000065D8220<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>
_______________________________________________<br class="">
Community mailing list<br class="">
<a href="mailto:Community@itk.org" class="">Community@itk.org</a><br class="">
http://public.kitware.com/mailman/listinfo/community<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>