Dear All,<div><br></div><div>I am using LevelSetBasedCellSegmentation filter to segment image. I give Centroid (Seed Point) of candidate cells and grayscale image but it crash during execution with this error:</div><div><br>
</div><div>itk::ExceptionObject (O1FDEDB0)</div><div>Location: &quot;void __thiscall itk::ImageToImageFilter&lt;class itk::Image&lt;float, 2&gt;, class itk::Image&lt;float, 2&gt; &gt;::VerifyInputInformation(void)&quot;</div>
<div>File:H:\itk\modules\core\common\include\itkImageToImageFilter.txx</div><div><br></div><div>GeodesicActiveContourLevelSetImageFilter(0359D700): Input do not occupy the same physical space! InputImage origin: [-1.2000000e+001, -1.20000000e+001], InputImageIndexedDataObject1 Origin: [1.2550000e+003, 4.80000000e+001] Tolerance: 1.0000000e-006<br clear="all">
<div><br></div><div>This code is here:</div><div><br></div><div><div>                       CharReaderType::Pointer charReader = CharReaderType::New();</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>charReader-&gt;SetFileName( &quot;image.bmp&quot; );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>try<span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>charReader-&gt;Update();</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>catch (itk::ExceptionObject&amp; excp)</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>std::cerr &lt;&lt; &quot;Err in Reading char image - Exception caught &quot; &lt;&lt; excp &lt;&lt; std::endl;<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>return;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>// 2 - Perform Image enhancment and Noise removal</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>CharImageSizeType meanRadius;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>meanRadius.Fill(4);</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>MeanImageFilterType::Pointer mean = MeanImageFilterType::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>mean-&gt;SetRadius( meanRadius );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>mean-&gt;SetInput( charReader-&gt;GetOutput() );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>// 3 - Perform Binary Thresholding</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>BinaryThresholdImageFilterType::Pointer threshold = BinaryThresholdImageFilterType::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>threshold-&gt;SetLowerThreshold( lowerThreshold );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>threshold-&gt;SetUpperThreshold( upperThreshold );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>threshold-&gt;SetOutsideValue( backgroundPixel );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>threshold-&gt;SetInsideValue( foregroundPixel );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>threshold-&gt;SetInput( mean-&gt;GetOutput() );</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>        BinaryImageToLabelMapFilterType::Pointer binaryImageToLabelMapFilter = BinaryImageToLabelMapFilterType::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>binaryImageToLabelMapFilter-&gt;SetInput( 
threshold -&gt;GetOutput() );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>binaryImageToLabelMapFilter-&gt;Update();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>itk::SimpleFilterWatcher watcher(binaryImageToLabelMapFilter, &quot;filter&quot;);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>typedef itk::ShapeLabelMapFilter&lt; LabelMapType &gt; ShapeLabelMapFilterType;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>ShapeLabelMapFilterType::Pointer shapeFilter = ShapeLabelMapFilterType::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>shapeFilter-&gt;SetInput( binaryImageToLabelMapFilter-&gt;GetOutput() );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>shapeFilter-&gt;Update();</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>LabelMapPointer labelMap = binaryImageToLabelMapFilter-&gt;GetOutput();</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>for( unsigned int label=1; label&lt;=labelMap-&gt;GetNumberOfLabelObjects(); label++ )</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>const ShapeLabelObjectType * labelObject = labelMap-&gt;GetLabelObject( label );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>CharImageIndexType centerIndex;</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>centerIndex[0] = labelObject-&gt;GetCentroid()[0];</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>centerIndex[1] = labelObject-&gt;GetCentroid()[1];</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>if(centerIndex[0] &gt; 50 &amp;&amp; centerIndex[1] &gt; 50 )</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>candidateCentroids.push_back( centerIndex );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>typedef itk::LevelSetBasedCellSegmentation&lt; CharImageType, CharImageType &gt;    LevelSetBasedCellSegmentationType;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>LevelSetBasedCellSegmentationType::Pointer levelSetSegmentor = LevelSetBasedCellSegmentationType::New();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor-&gt;SetInput( mean-&gt;GetOutput());</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor-&gt;SetLargestCellRadius( 30.0 ); // in real coordinates</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor-&gt;SetSeedValue( 10 );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor-&gt;SetIterations( 500 );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor-&gt;SetPropagationScaling( 4 );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor-&gt;SetCurvatureScaling( 1 );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor-&gt;SetAdvectionScaling( 1 );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor-&gt;SetMaxRMSChange( 0.01 );</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>for( unsigned int seedNo = 0; seedNo &lt; candidateCentroids.size(); seedNo++ )</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>levelSetSegmentor-&gt;seeds[seedNo] = static_cast&lt;CharImageIndexType&gt; (candidateCentroids[seedNo]);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>try<span class="Apple-tab-span" style="white-space:pre">                </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>levelSetSegmentor-&gt;Update();</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>catch (itk::ExceptionObject&amp; excp)</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>std::cerr &lt;&lt; &quot;Err in LevelSetBasedCellSegmentationFilter 1: - Exception caught &quot; &lt;&lt; &quot;\n&quot; &lt;&lt; excp &lt;&lt; std::endl;<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>return;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>}</div></div><div><br></div>-- <br><font face="arial, helvetica, sans-serif">-- <br>
Best Regards, <br><br></font><div><b><font face="arial, helvetica, sans-serif">HUMAYUN IRSHAD</font></b></div><div><span style="border-collapse:collapse"><b><span style="border-collapse:separate;font-weight:normal"><div><span style="border-collapse:collapse"><b><span style="border-collapse:separate;font-weight:normal"><div style="display:inline!important">
<span style="border-collapse:collapse"><b><span style="border-collapse:separate;font-weight:normal"><font face="arial, helvetica, sans-serif">PhD student, University of Joseph Fourier, Grenoble, France</font></span></b></span></div>
</span></b></span></div></span></b></span><span style="border-collapse:collapse"><b><span style="border-collapse:separate;font-weight:normal"><div style="display:inline!important"><span style="border-collapse:collapse"><b><span style="border-collapse:separate;font-weight:normal"><div style="display:inline!important">
<span style="border-collapse:collapse"><b><span style="border-collapse:separate;font-weight:normal"><font face="arial, helvetica, sans-serif">Research Engineer, </font></span></b></span></div></span></b></span></div></span></b></span><span style="border-collapse:collapse"><b><span style="border-collapse:separate;font-weight:normal"><div style="display:inline!important">
<span style="border-collapse:collapse"><b><span style="border-collapse:separate;font-weight:normal"><font face="arial, helvetica, sans-serif">IPAL – Image &amp; Pervasive Access Lab, Singapore</font></span></b></span></div>
</span></b></span><span style="border-collapse:collapse"><b><span style="border-collapse:separate;font-weight:normal"><div><span style="border-collapse:collapse"><b><span style="border-collapse:separate;font-weight:normal"><font face="arial, helvetica, sans-serif">UMI CNRS (I2R/A*STAR, NUS, UJF, UPMC, IT)</font></span></b></span></div>
<div><div><div><span style="border-collapse:collapse"><font face="arial, helvetica, sans-serif"><div><span style="border-collapse:collapse"><br></span></div>Institute for Infocomm Research (I2R)<br>1 Fusionopolis Way<br>#10-19 Connexis South Tower<br>
Singapore 138632<br>Tel:+65-65162864</font></span></div></div></div><div><span style="border-collapse:collapse"><font face="arial, helvetica, sans-serif">Cell: +65-83851671</font></span></div><div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><br>
</span></div></span></b></span></div><br>
</div>