#include "itksys/SystemTools.hxx"
int main(int argc, char *argv[])
{
if(argc < 2)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " InputImageFile [radius]" << std::endl;
return EXIT_FAILURE;
}
unsigned int radius = 2;
if (argc > 2)
{
radius = atoi(argv[2]);
}
std::string inputFilename = argv[1];
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(inputFilename);
ImageType::PixelType,2>;
StructuringElementType structuringElement;
structuringElement.CreateStructuringElement();
GrayscaleDilateImageFilterType::Pointer dilateFilter
= GrayscaleDilateImageFilterType::New();
dilateFilter->SetInput(reader->GetOutput());
dilateFilter->SetKernel(structuringElement);
SubtractType::Pointer diff = SubtractType::New();
diff->SetInput2(reader->GetOutput());
diff->SetInput1(dilateFilter->GetOutput());
reader->GetOutput(),true,
itksys::SystemTools::GetFilenameName(inputFilename));
std::stringstream desc;
desc << "GrayscaleDilate, radius = " << radius;
dilateFilter->GetOutput(),
true,
desc.str());
std::stringstream desc2;
desc2 << "Original - GrayscaleDilate";
diff->GetOutput(),
true,
desc2.str());
return EXIT_SUCCESS;
}