#include "itksys/SystemTools.hxx"
#include <sstream>
#ifdef ENABLE_QUICKVIEW
#endif
int
main(int argc, char * argv[])
{
if (argc < 2)
{
std::cout << "Usage:" << std::endl;
std::cout << argv[0] << " InputFileName" << std::endl;
}
using PixelType = unsigned char;
const auto input = itk::ReadImage<ImageType>(argv[1]);
connected->SetInput(input);
connected->Update();
std::cout << "Number of objects: " << connected->GetObjectCount() << std::endl;
labelShapeKeepNObjectsImageFilter->SetInput(connected->GetOutput());
labelShapeKeepNObjectsImageFilter->SetBackgroundValue(0);
labelShapeKeepNObjectsImageFilter->SetNumberOfObjects(1);
labelShapeKeepNObjectsImageFilter->SetAttribute(
LabelShapeKeepNObjectsImageFilterType::LabelObjectType::NUMBER_OF_PIXELS);
rescaleFilter->SetOutputMinimum(0);
rescaleFilter->SetInput(labelShapeKeepNObjectsImageFilter->GetOutput());
#ifdef ENABLE_QUICKVIEW
viewer.
AddImage(input.GetPointer(),
true, itksys::SystemTools::GetFilenameName(argv[1]));
std::stringstream desc;
desc << "Largest object of " << connected->GetObjectCount() << " objects";
viewer.
AddImage(rescaleFilter->GetOutput(),
true, desc.str());
#endif
return EXIT_SUCCESS;
}