int
main(int argc, char * argv[])
{
if (argc < 5)
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " inputImage outputImage lowerThreshold outputScaleLevel"
<< std::endl;
return EXIT_FAILURE;
}
using InternalPixelType = float;
reader->SetFileName(argv[1]);
writer->SetFileName(argv[2]);
using GradientMagnitudeFilterType =
InternalImageType>;
gradienMagnitudeFilter->SetInput(reader->GetOutput());
gradienMagnitudeFilter->SetSigma(1.0);
watershedFilter->SetInput(gradienMagnitudeFilter->GetOutput());
watershedFilter->SetThreshold(std::stod(argv[3]));
watershedFilter->SetLevel(std::stod(argv[4]));
using ColormapFunctorType =
using LabeledImageType = WatershedFilterType::OutputImageType;
using ColormapFilterType =
RGBImageType,
ColormapFunctorType>;
colorMapFilter->SetInput(watershedFilter->GetOutput());
writer->SetInput(colorMapFilter->GetOutput());
try
{
writer->Update();
}
catch (const itk::ExceptionObject & excep)
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}