int main( int argc, char * argv[] )
{
if( argc < 4 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile outputImageFile radiusX radiusY" << std::endl;
return EXIT_FAILURE;
}
using InputPixelType = unsigned char;
using OutputPixelType = unsigned char;
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName( argv[1] );
writer->SetFileName( argv[2] );
using FilterType =
OutputImageType >;
FilterType::Pointer filter = FilterType::New();
const unsigned int radiusX = std::stoi( argv[3] );
const unsigned int radiusY = std::stoi( argv[4] );
indexRadius[0] = radiusX;
indexRadius[1] = radiusY;
filter->SetRadius( indexRadius );
filter->SetBackgroundValue( 0 );
filter->SetForegroundValue( 255 );
filter->SetMajorityThreshold( 2 );
filter->SetInput( reader->GetOutput() );
writer->SetInput( filter->GetOutput() );
writer->Update();
return EXIT_SUCCESS;
}