int main( int argc, char *argv[])
{
if( argc < 7 )
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " inputImage outputImage seedX seedY lowerThreshold upperThreshold" << std::endl;
return EXIT_FAILURE;
}
using InternalPixelType = float;
using OutputPixelType = unsigned char;
using CastingFilterType =
CastingFilterType::Pointer caster = CastingFilterType::New();
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName( argv[1] );
writer->SetFileName( argv[2] );
using CurvatureFlowImageFilterType =
CurvatureFlowImageFilterType::Pointer smoothing =
CurvatureFlowImageFilterType::New();
using ConnectedFilterType =
InternalImageType >;
ConnectedFilterType::Pointer connectedThreshold = ConnectedFilterType::New();
smoothing->SetInput( reader->GetOutput() );
connectedThreshold->SetInput( smoothing->GetOutput() );
caster->SetInput( connectedThreshold->GetOutput() );
writer->SetInput( caster->GetOutput() );
smoothing->SetNumberOfIterations( 5 );
smoothing->SetTimeStep( 0.125 );
const InternalPixelType lowerThreshold = std::stod( argv[5] );
const InternalPixelType upperThreshold = std::stod( argv[6] );
connectedThreshold->SetLower( lowerThreshold );
connectedThreshold->SetUpper( upperThreshold );
connectedThreshold->SetReplaceValue( 255 );
index[0] = std::stoi( argv[3] );
index[1] = std::stoi( argv[4] );
connectedThreshold->SetSeed( index );
try
{
writer->Update();
}
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
}
return EXIT_SUCCESS;
}