#include <iostream>
int
main(int argc, char * argv[])
{
if (argc < 8)
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr
<< " inputImage outputImage conductanceTerm diffusionIterations "
"lowerThreshold outputScaleLevel gradientMode "
<< std::endl;
return EXIT_FAILURE;
}
using DiffusionFilterType =
VectorImageType>;
using GradientMagnitudeFilterType =
itk::VectorGradientMagnitudeImageFilter<VectorImageType>;
auto caster = CastFilterType::New();
auto diffusion = DiffusionFilterType::New();
diffusion->SetNumberOfIterations(std::stoi(argv[4]));
diffusion->SetConductanceParameter(std::stod(argv[3]));
diffusion->SetTimeStep(0.125);
auto gradient = GradientMagnitudeFilterType::New();
gradient->SetUsePrincipleComponents(std::stoi(argv[7]));
auto watershed = WatershedFilterType::New();
watershed->SetLevel(std::stod(argv[6]));
watershed->SetThreshold(std::stod(argv[5]));
using ColormapFunctorType =
using ColormapFilterType =
RGBImageType,
ColormapFunctorType>;
auto colormapper = ColormapFilterType::New();
caster->SetInput(input);
diffusion->SetInput(caster->GetOutput());
gradient->SetInput(diffusion->GetOutput());
watershed->SetInput(gradient->GetOutput());
colormapper->SetInput(watershed->GetOutput());
try
{
}
{
std::cerr << e << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
Casts input pixels to output pixel type.
Standard exception handling object.
A Function object which maps a scalar value into an RGB pixel value.
Templated n-dimensional image class.
Represent Red, Green and Blue components for color images.
Implements pixel-wise generic operation on one image.
A templated class holding a n-Dimensional vector.
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)