int main( int argc, char * argv[] )
{
if( argc < 4 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile ";
std::cerr << " outputImageFileErosion outputImageFileDilation" << std::endl;
return EXIT_FAILURE;
}
using InputPixelType = unsigned char;
using OutputPixelType = unsigned char;
InputPixelType,
Dimension >;
InputImageType,
OutputImageType,
StructuringElementType >;
InputImageType,
OutputImageType,
StructuringElementType >;
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writerDilation = WriterType::New();
WriterType::Pointer writerErosion = WriterType::New();
ErodeFilterType::Pointer grayscaleErode = ErodeFilterType::New();
DilateFilterType::Pointer grayscaleDilate = DilateFilterType::New();
StructuringElementType structuringElement;
structuringElement.CreateStructuringElement();
grayscaleErode->SetKernel( structuringElement );
grayscaleDilate->SetKernel( structuringElement );
reader->SetFileName( argv[1] );
writerErosion->SetFileName( argv[2] );
writerDilation->SetFileName( argv[3] );
grayscaleErode->SetInput( reader->GetOutput() );
grayscaleDilate->SetInput( reader->GetOutput() );
writerDilation->SetInput( grayscaleDilate->GetOutput() );
writerDilation->Update();
writerErosion->SetInput( grayscaleErode->GetOutput() );
writerErosion->Update();
return EXIT_SUCCESS;
}