#include "itkLevelSetIterationUpdateCommand.h"
#include "itkVTKVisualizeImageLevelSetIsoValues.h"
#include "vtkRenderWindowInteractor.h"
int
main(int argc, char * argv[])
{
if (argc != 3)
{
std::cerr << "Missing Arguments" << std::endl;
std::cerr << argv[0] << std::endl;
std::cerr << "<Input Image> <Interactive (0 or 1)>" << std::endl;
return EXIT_FAILURE;
}
using InputPixelType = unsigned char;
using LevelSetPixelType = float;
otsu->SetInput(input);
otsu->SetNumberOfHistogramBins(256);
otsu->SetNumberOfThresholds(1);
rescaler->SetInput(otsu->GetOutput());
rescaler->SetOutputMinimum(0);
rescaler->SetOutputMaximum(1);
adaptor->SetInputImage(rescaler->GetOutput());
adaptor->Initialize();
using VisualizationType = itk::VTKVisualizeImageLevelSetIsoValues<InputImageType, LevelSetType>;
visualizer->SetInputImage(input);
visualizer->SetLevelSet(levelSet);
renderWindowInteractor->SetRenderWindow(visualizer->GetRenderWindow());
try
{
visualizer->Update();
}
catch (const itk::ExceptionObject & error)
{
std::cerr << "Error: " << error << std::endl;
return EXIT_FAILURE;
}
bool interactive = (std::stoi(argv[2]) != 0);
if (interactive)
{
renderWindowInteractor->Start();
}
return EXIT_SUCCESS;
}