#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 1;
}
CastFilterType;
VectorImageType, VectorImageType >
DiffusionFilterType;
GradientMagnitudeFilterType;
WatershedFilterType;
FileReaderType::Pointer reader = FileReaderType::New();
reader->SetFileName(argv[1]);
CastFilterType::Pointer caster = CastFilterType::New();
DiffusionFilterType::Pointer diffusion = DiffusionFilterType::New();
diffusion->SetNumberOfIterations( atoi(argv[4]) );
diffusion->SetConductanceParameter( atof(argv[3]) );
diffusion->SetTimeStep(0.125);
GradientMagnitudeFilterType::Pointer
gradient = GradientMagnitudeFilterType::New();
gradient->SetUsePrincipleComponents(atoi(argv[7]));
WatershedFilterType::Pointer watershed = WatershedFilterType::New();
watershed->SetLevel( atof(argv[6]) );
watershed->SetThreshold( atof(argv[5]) );
ColorMapFunctorType;
RGBImageType, ColorMapFunctorType> ColorMapFilterType;
ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New();
FileWriterType::Pointer writer = FileWriterType::New();
writer->SetFileName(argv[2]);
caster->SetInput(reader->GetOutput());
diffusion->SetInput(caster->GetOutput());
gradient->SetInput(diffusion->GetOutput());
watershed->SetInput(gradient->GetOutput());
colormapper->SetInput(watershed->GetOutput());
writer->SetInput(colormapper->GetOutput());
try
{
writer->Update();
}
{
std::cerr << e << std::endl;
}
return 0;
}