Humayun Irshad | 2 Apr 2012 07:45
Picon

LevelSetBasedCellSegmentation Crash

Dear All,


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:

itk::ExceptionObject (O1FDEDB0)
Location: "void __thiscall itk::ImageToImageFilter<class itk::Image<float, 2>, class itk::Image<float, 2> >::VerifyInputInformation(void)"
File:H:\itk\modules\core\common\include\itkImageToImageFilter.txx

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

This code is here:

                       CharReaderType::Pointer charReader = CharReaderType::New();
charReader->SetFileName( "image.bmp" );
try
{
charReader->Update();
}
catch (itk::ExceptionObject& excp)
{
std::cerr << "Err in Reading char image - Exception caught " << excp << std::endl;
return;
}

// 2 - Perform Image enhancment and Noise removal
CharImageSizeType meanRadius;
meanRadius.Fill(4);
MeanImageFilterType::Pointer mean = MeanImageFilterType::New();
mean->SetRadius( meanRadius );
mean->SetInput( charReader->GetOutput() );
// 3 - Perform Binary Thresholding
BinaryThresholdImageFilterType::Pointer threshold = BinaryThresholdImageFilterType::New();
threshold->SetLowerThreshold( lowerThreshold );
threshold->SetUpperThreshold( upperThreshold );
threshold->SetOutsideValue( backgroundPixel );
threshold->SetInsideValue( foregroundPixel );
threshold->SetInput( mean->GetOutput() );

        BinaryImageToLabelMapFilterType::Pointer binaryImageToLabelMapFilter = BinaryImageToLabelMapFilterType::New();
binaryImageToLabelMapFilter->SetInput(  threshold ->GetOutput() );
binaryImageToLabelMapFilter->Update();

itk::SimpleFilterWatcher watcher(binaryImageToLabelMapFilter, "filter");

typedef itk::ShapeLabelMapFilter< LabelMapType > ShapeLabelMapFilterType;
ShapeLabelMapFilterType::Pointer shapeFilter = ShapeLabelMapFilterType::New();
shapeFilter->SetInput( binaryImageToLabelMapFilter->GetOutput() );
shapeFilter->Update();

LabelMapPointer labelMap = binaryImageToLabelMapFilter->GetOutput();
for( unsigned int label=1; label<=labelMap->GetNumberOfLabelObjects(); label++ )
{
const ShapeLabelObjectType * labelObject = labelMap->GetLabelObject( label );
CharImageIndexType centerIndex;
centerIndex[0] = labelObject->GetCentroid()[0];
centerIndex[1] = labelObject->GetCentroid()[1];
if(centerIndex[0] > 50 && centerIndex[1] > 50 )
candidateCentroids.push_back( centerIndex );
}

typedef itk::LevelSetBasedCellSegmentation< CharImageType, CharImageType >    LevelSetBasedCellSegmentationType;
LevelSetBasedCellSegmentationType::Pointer levelSetSegmentor = LevelSetBasedCellSegmentationType::New();

levelSetSegmentor->SetInput( mean->GetOutput());
levelSetSegmentor->SetLargestCellRadius( 30.0 ); // in real coordinates
levelSetSegmentor->SetSeedValue( 10 );
levelSetSegmentor->SetIterations( 500 );
levelSetSegmentor->SetPropagationScaling( 4 );
levelSetSegmentor->SetCurvatureScaling( 1 );
levelSetSegmentor->SetAdvectionScaling( 1 );
levelSetSegmentor->SetMaxRMSChange( 0.01 );

for( unsigned int seedNo = 0; seedNo < candidateCentroids.size(); seedNo++ )
levelSetSegmentor->seeds[seedNo] = static_cast<CharImageIndexType> (candidateCentroids[seedNo]);

try
{
levelSetSegmentor->Update();
}
catch (itk::ExceptionObject& excp)
{
std::cerr << "Err in LevelSetBasedCellSegmentationFilter 1: - Exception caught " << "\n" << excp << std::endl;
return;
}

--
--
Best Regards,

HUMAYUN IRSHAD
PhD student, University of Joseph Fourier, Grenoble, France
Research Engineer, 
IPAL – Image & Pervasive Access Lab, Singapore
UMI CNRS (I2R/A*STAR, NUS, UJF, UPMC, IT)

Institute for Infocomm Research (I2R)
1 Fusionopolis Way
#10-19 Connexis South Tower
Singapore 138632
Tel:+65-65162864
Cell: +65-83851671


_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users

Gmane