int main( int argc, char *argv[] )
{
if( argc < 7 )
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " inputImage outputImage seedX1 seedY1";
std::cerr << " lowerThreshold seedX2 seedY2" << std::endl;
return 1;
}
typedef float InternalPixelType;
const unsigned int Dimension = 2;
typedef unsigned char OutputPixelType;
CastingFilterType;
CastingFilterType::Pointer caster = CastingFilterType::New();
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName( argv[1] );
writer->SetFileName( argv[2] );
CurvatureFlowImageFilterType;
CurvatureFlowImageFilterType::Pointer smoothing =
CurvatureFlowImageFilterType::New();
InternalImageType> ConnectedFilterType;
ConnectedFilterType::Pointer isolatedConnected = ConnectedFilterType::New();
smoothing->SetInput( reader->GetOutput() );
isolatedConnected->SetInput( smoothing->GetOutput() );
caster->SetInput( isolatedConnected->GetOutput() );
writer->SetInput( caster->GetOutput() );
smoothing->SetNumberOfIterations( 5 );
smoothing->SetTimeStep( 0.125 );
InternalImageType::IndexType indexSeed1;
indexSeed1[0] = atoi( argv[3] );
indexSeed1[1] = atoi( argv[4] );
const InternalPixelType lowerThreshold = atof( argv[5] );
InternalImageType::IndexType indexSeed2;
indexSeed2[0] = atoi( argv[6] );
indexSeed2[1] = atoi( argv[7] );
isolatedConnected->SetLower( lowerThreshold );
isolatedConnected->AddSeed1( indexSeed1 );
isolatedConnected->AddSeed2( indexSeed2 );
isolatedConnected->SetReplaceValue( 255 );
try
{
writer->Update();
}
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
}
std::cout << "Isolated Value Found = ";
std::cout << isolatedConnected->GetIsolatedValue() << std::endl;
return 0;
}