int
main(int argc, char * argv[])
{
if (argc < 6)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile ";
std::cerr
<< "numberOfIterations timeStep conductance useImageSpacingon/off"
<< std::endl;
return EXIT_FAILURE;
}
using InputPixelType = float;
using OutputPixelType = float;
using FilterType =
OutputImageType>;
FilterType::Pointer filter = FilterType::New();
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(argv[1]);
filter->SetInput(reader->GetOutput());
const unsigned int numberOfIterations = std::stoi(argv[3]);
const double timeStep = std::stod(argv[4]);
const double conductance = std::stod(argv[5]);
const bool useImageSpacing = (argc != 6);
filter->SetNumberOfIterations(numberOfIterations);
filter->SetTimeStep(timeStep);
filter->SetConductanceParameter(conductance);
if (useImageSpacing)
{
filter->UseImageSpacingOn();
}
filter->Update();
using WritePixelType = unsigned char;
using RescaleFilterType =
RescaleFilterType::Pointer rescaler = RescaleFilterType::New();
rescaler->SetOutputMinimum(0);
rescaler->SetOutputMaximum(255);
WriterType::Pointer writer = WriterType::New();
writer->SetFileName(argv[2]);
rescaler->SetInput(filter->GetOutput());
writer->SetInput(rescaler->GetOutput());
writer->Update();
return EXIT_SUCCESS;
}