<div dir="ltr"><div><div><div>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><pre style="color:rgb(0,0,0);background:rgb(255,255,255) none repeat scroll 0% 0%"><span style="color:rgb(128,0,0);font-weight:bold">def</span> N43D<span style="color:rgb(128,128,48)">(</span>fl<span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,128,48)">:</span>
im <span style="color:rgb(128,128,48)">=</span> SimpleITK<span style="color:rgb(128,128,48)">.</span>ReadImage<span style="color:rgb(128,128,48)">(</span>fl<span style="color:rgb(128,128,48)">)</span>
msk <span style="color:rgb(128,128,48)">=</span> SimpleITK<span style="color:rgb(128,128,48)">.</span>BinaryThreshold<span style="color:rgb(128,128,48)">(</span>im<span style="color:rgb(128,128,48)">,</span> <span style="color:rgb(0,140,0)">0</span><span style="color:rgb(128,128,48)">,</span> <span style="color:rgb(0,140,0)">0</span><span style="color:rgb(128,128,48)">)</span>
msk <span style="color:rgb(128,128,48)">=</span> SimpleITK<span style="color:rgb(128,128,48)">.</span>BinaryNot<span style="color:rgb(128,128,48)">(</span>msk<span style="color:rgb(128,128,48)">)</span>
msk <span style="color:rgb(128,128,48)">=</span> SimpleITK<span style="color:rgb(128,128,48)">.</span>Cast<span style="color:rgb(128,128,48)">(</span>msk<span style="color:rgb(128,128,48)">,</span> SimpleITK<span style="color:rgb(128,128,48)">.</span>sitkUInt8<span style="color:rgb(128,128,48)">)</span>
im <span style="color:rgb(128,128,48)">=</span> SimpleITK<span style="color:rgb(128,128,48)">.</span>Cast<span style="color:rgb(128,128,48)">(</span>im<span style="color:rgb(128,128,48)">,</span> SimpleITK<span style="color:rgb(128,128,48)">.</span>sitkFloat32<span style="color:rgb(128,128,48)">)</span>
im_n4 <span style="color:rgb(128,128,48)">=</span> SimpleITK<span style="color:rgb(128,128,48)">.</span>N4BiasFieldCorrection<span style="color:rgb(128,128,48)">(</span>im<span style="color:rgb(128,128,48)">,</span> msk<span style="color:rgb(128,128,48)">)</span>
SimpleITK<span style="color:rgb(128,128,48)">.</span>WriteImage<span style="color:rgb(128,128,48)">(</span>im_n4<span style="color:rgb(128,128,48)">,</span> os<span style="color:rgb(128,128,48)">.</span>path<span style="color:rgb(128,128,48)">.</span>splitext<span style="color:rgb(128,128,48)">(</span>fl<span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,128,48)">[</span><span style="color:rgb(0,140,0)">0</span><span style="color:rgb(128,128,48)">]</span><span style="color:rgb(68,170,221)">+</span><span style="color:rgb(0,0,230)">'_n4.mha'</span><span style="color:rgb(128,128,48)">,</span> useCompression<span style="color:rgb(128,128,48)">=</span><span style="color:rgb(7,71,38)">True</span><span style="color:rgb(128,128,48)">)</span></pre><br><br>Also, I'm using multiple cores for a list of files:<br><pre style="color:rgb(0,0,0);background:rgb(255,255,255) none repeat scroll 0% 0%">dview<span style="color:rgb(128,128,48)">.</span>map_sync<span style="color:rgb(128,128,48)">(</span>N43D<span style="color:rgb(128,128,48)">,</span> fl<span style="color:rgb(128,128,48)">)</span></pre><br><br>The program runs fine for about 40 files. Then I get this error on all my engines:<br><pre style="color:rgb(0,0,0);background:rgb(255,255,255) none repeat scroll 0% 0%"><span style="color:rgb(128,128,48)">[</span><span style="color:rgb(0,140,0)">0</span><span style="color:rgb(128,128,48)">:</span>apply<span style="color:rgb(128,128,48)">]</span><span style="color:rgb(128,128,48)">:</span>
RuntimeErrorTraceback <span style="color:rgb(128,128,48)">(</span>most recent call last<span style="color:rgb(128,128,48)">)</span><span style="color:rgb(68,170,221)"><</span>string<span style="color:rgb(68,170,221)">></span> <span style="color:rgb(128,0,0);font-weight:bold">in</span> <span style="color:rgb(68,170,221)"><</span>module<span style="color:rgb(68,170,221)">></span><span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,128,48)">)</span>
<span style="color:rgb(68,170,221)"><</span>ipython<span style="color:rgb(68,170,221)">-</span><span style="color:rgb(64,0,0)">input</span><span style="color:rgb(68,170,221)">-</span>56<span style="color:rgb(68,170,221)">-</span>03a02a993653<span style="color:rgb(68,170,221)">></span> <span style="color:rgb(128,0,0);font-weight:bold">in</span> N43D<span style="color:rgb(128,128,48)">(</span>fl<span style="color:rgb(128,128,48)">)</span>
c<span style="color:rgb(128,128,48)">:</span>\users\shreyas_v\anaconda2\lib\site<span style="color:rgb(68,170,221)">-</span>packages\SimpleITK\SimpleITK<span style="color:rgb(128,128,48)">.</span>pyc <span style="color:rgb(128,0,0);font-weight:bold">in</span> N4BiasFieldCorrection<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(68,170,221)">*</span>args<span style="color:rgb(128,128,48)">,</span> <span style="color:rgb(68,170,221)">**</span>kwargs<span style="color:rgb(128,128,48)">)</span>
<span style="color:rgb(0,140,0)">43368</span>
<span style="color:rgb(0,140,0)">43369</span> <span style="color:rgb(105,105,105)">"""</span>
<span style="color:rgb(105,105,105)">> 43370 return _SimpleITK.N4BiasFieldCorrection(*args, **kwargs)</span>
<span style="color:rgb(105,105,105)"> 43371 class NaryAddImageFilter(ImageFilter_3):</span>
<span style="color:rgb(105,105,105)"> 43372 """</span>
<span style="color:rgb(7,71,38)">RuntimeError</span><span style="color:rgb(128,128,48)">:</span> <span style="color:rgb(7,71,38)">Exception</span> thrown <span style="color:rgb(128,0,0);font-weight:bold">in</span> SimpleITK N4BiasFieldCorrection<span style="color:rgb(128,128,48)">:</span> c<span style="color:rgb(128,128,48)">:</span>\d\vs9<span style="color:rgb(68,170,221)">-</span>pkg\simpleitk<span style="color:rgb(68,170,221)">-</span>build\itk\modules\core\common\include\itkImageToImageFilter<span style="color:rgb(128,128,48)">.</span>hxx<span style="color:rgb(128,128,48)">:</span><span style="color:rgb(0,140,0)">248</span><span style="color:rgb(128,128,48)">:</span>
itk<span style="color:rgb(128,128,48)">:</span><span style="color:rgb(128,128,48)">:</span>ERROR<span style="color:rgb(128,128,48)">:</span> SubtractImageFilter<span style="color:rgb(128,128,48)">(</span>00000000065D8220<span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,128,48)">:</span> Inputs do <span style="color:rgb(128,0,0);font-weight:bold">not</span> occupy the same physical space!
InputImage Origin<span style="color:rgb(128,128,48)">:</span> <span style="color:rgb(128,128,48)">[</span><span style="color:rgb(0,128,0)">0.0000000e+000</span><span style="color:rgb(128,128,48)">,</span> <span style="color:rgb(68,170,221)">-</span><span style="color:rgb(0,128,0)">2.3900000e+002</span><span style="color:rgb(128,128,48)">,</span> <span style="color:rgb(0,128,0)">0.0000000e+000</span><span style="color:rgb(128,128,48)">]</span><span style="color:rgb(128,128,48)">,</span> InputImage_1 Origin<span style="color:rgb(128,128,48)">:</span> <span style="color:rgb(128,128,48)">[</span><span style="color:rgb(68,170,221)">-</span><span style="color:rgb(0,128,0)">5.9750000e+001</span><span style="color:rgb(128,128,48)">,</span> <span style="color:rgb(68,170,221)">-</span><span style="color:rgb(0,128,0)">5.9750000e+001</span><span style="color:rgb(128,128,48)">,</span> <span style="color:rgb(68,170,221)">-</span><span style="color:rgb(0,128,0)">3.8500000e+001</span><span style="color:rgb(128,128,48)">]</span>
Tolerance<span style="color:rgb(128,128,48)">:</span> <span style="color:rgb(0,128,0)">1.0000000e-006</span>
InputImage Spacing<span style="color:rgb(128,128,48)">:</span> <span style="color:rgb(128,128,48)">[</span><span style="color:rgb(0,128,0)">1.0000000e+000</span><span style="color:rgb(128,128,48)">,</span> <span style="color:rgb(0,128,0)">1.0000000e+000</span><span style="color:rgb(128,128,48)">,</span> <span style="color:rgb(0,128,0)">1.0000000e+000</span><span style="color:rgb(128,128,48)">]</span><span style="color:rgb(128,128,48)">,</span> InputImage_1 Spacing<span style="color:rgb(128,128,48)">:</span> <span style="color:rgb(128,128,48)">[</span><span style="color:rgb(0,128,0)">5.9750000e+001</span><span style="color:rgb(128,128,48)">,</span> <span style="color:rgb(0,128,0)">5.9750000e+001</span><span style="color:rgb(128,128,48)">,</span> <span style="color:rgb(0,128,0)">3.8500000e+001</span><span style="color:rgb(128,128,48)">]</span>
Tolerance<span style="color:rgb(128,128,48)">:</span> <span style="color:rgb(0,128,0)">1.0000000e-006</span></pre><br></div>Has anyone faced this issue before?<br><br></div>Regards,<br></div>Shreyas<br></div>