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;
constexpr unsigned int Dimension = 3;
using GradientMagnitudeFilterType =
InternalImageType>;
auto gradienMagnitudeFilter = GradientMagnitudeFilterType::New();
gradienMagnitudeFilter->SetInput(input);
gradienMagnitudeFilter->SetSigma(1.0);
auto watershedFilter = WatershedFilterType::New();
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>;
auto colorMapFilter = ColormapFilterType::New();
colorMapFilter->SetInput(watershedFilter->GetOutput());
try
{
}
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
Standard exception handling object.
A Function object which maps a scalar value into an RGB pixel value.
Computes the Magnitude of the Gradient of an image by convolution with the first derivative of a Gaus...
Templated n-dimensional image class.
Represent Red, Green and Blue components for color images.
Implements pixel-wise generic operation on one image.
A low-level image analysis algorithm that automatically produces a hierarchy of segmented,...
ITK_TEMPLATE_EXPORT void WriteImage(TImagePointer &&image, const std::string &filename, bool compress=false)
TOutputImage::Pointer ReadImage(const std::string &filename)