int main( int argc, char *argv[] )
{
if( argc < 5 )
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " inputImage outputImage seedX seedY " << 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, InternalImageType> ConnectedFilterType;
ConnectedFilterType::Pointer confidenceConnected
= ConnectedFilterType::New();
smoothing->SetInput( reader->GetOutput() );
confidenceConnected->SetInput( smoothing->GetOutput() );
caster->SetInput( confidenceConnected->GetOutput() );
writer->SetInput( caster->GetOutput() );
smoothing->SetNumberOfIterations( 5 );
smoothing->SetTimeStep( 0.125 );
confidenceConnected->SetMultiplier( 2.5 );
confidenceConnected->SetNumberOfIterations( 5 );
confidenceConnected->SetReplaceValue( 255 );
InternalImageType::IndexType index;
index[0] = atoi( argv[3] );
index[1] = atoi( argv[4] );
confidenceConnected->SetSeed( index );
confidenceConnected->SetInitialNeighborhoodRadius( 2 );
try
{
writer->Update();
}
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
}
return 0;
}