#include "itksys/SystemTools.hxx"
#include <sstream>
int main( int argc, char *argv[])
{
if( argc < 2 )
{
std::cerr << "Usage: "<< std::endl;
std::cerr << argv[0];
std::cerr << " InputFileName";
std::cerr << " [NumberOfIterations] ";
std::cerr << " [Conductance]" << std::endl;
return EXIT_FAILURE;
}
std::string inputFileName = argv[1];
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( inputFileName );
AdaptorInputType::Pointer adaptInput = AdaptorInputType::New();
adaptInput->SetImage(reader->GetOutput());
CastInputType::Pointer castInput = CastInputType::New();
castInput->SetInput(adaptInput);
FloatImageType > VectorCurvatureAnisotropicDiffusionImageFilterType;
VectorCurvatureAnisotropicDiffusionImageFilterType::Pointer filter =
VectorCurvatureAnisotropicDiffusionImageFilterType::New();
filter->SetInput( castInput->GetOutput() );
filter->SetTimeStep(0.125);
if (argc > 2)
{
filter->SetNumberOfIterations(atoi(argv[2]));
}
if (argc > 3)
{
filter->SetConductanceParameter(atof(argv[3]));
}
AdaptorOutputType::Pointer adaptOutput = AdaptorOutputType::New();
adaptOutput->SetImage(filter->GetOutput());
CastOutputType::Pointer castOutput = CastOutputType::New();
castOutput->SetInput(adaptOutput);
reader->GetOutput(),
true,
itksys::SystemTools::GetFilenameName(inputFileName));
std::stringstream desc;
desc << "VectorCurvatureAnisotropicDiffusionImageFilter\niterations: "
<< filter->GetNumberOfIterations() << " conductance: "
<< filter->GetConductanceParameter();
castOutput->GetOutput(),
true,
desc.str());
return EXIT_SUCCESS;
}