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: "void __thiscall itk::ImageToImageFilter<class itk::Image<float, 2>, class itk::Image<float, 2> >::VerifyInputInformation(void)"</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->SetFileName( "image.bmp" );</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->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& 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 << "Err in Reading char image - Exception caught " << excp << 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->SetRadius( meanRadius );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>mean->SetInput( charReader->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->SetLowerThreshold( lowerThreshold );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>threshold->SetUpperThreshold( upperThreshold );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>threshold->SetOutsideValue( backgroundPixel );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>threshold->SetInsideValue( foregroundPixel );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>threshold->SetInput( mean->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->SetInput(
threshold ->GetOutput() );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>binaryImageToLabelMapFilter->Update();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>itk::SimpleFilterWatcher watcher(binaryImageToLabelMapFilter, "filter");</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>typedef itk::ShapeLabelMapFilter< LabelMapType > 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->SetInput( binaryImageToLabelMapFilter->GetOutput() );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>shapeFilter->Update();</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>LabelMapPointer labelMap = binaryImageToLabelMapFilter->GetOutput();</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>for( unsigned int label=1; label<=labelMap->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->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->GetCentroid()[0];</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>centerIndex[1] = labelObject->GetCentroid()[1];</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>if(centerIndex[0] > 50 && centerIndex[1] > 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< CharImageType, CharImageType > 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->SetInput( mean->GetOutput());</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor->SetLargestCellRadius( 30.0 ); // in real coordinates</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor->SetSeedValue( 10 );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor->SetIterations( 500 );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor->SetPropagationScaling( 4 );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor->SetCurvatureScaling( 1 );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor->SetAdvectionScaling( 1 );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>levelSetSegmentor->SetMaxRMSChange( 0.01 );</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>for( unsigned int seedNo = 0; seedNo < candidateCentroids.size(); seedNo++ )</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>levelSetSegmentor->seeds[seedNo] = static_cast<CharImageIndexType> (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->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& 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 << "Err in LevelSetBasedCellSegmentationFilter 1: - Exception caught " << "\n" << excp << 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 & 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>