#include <cstdlib>
#include <cstdio>
int main( int argc, char *argv[] )
{
if ( argc < 2)
{
std::cerr << argv[0] << ": Please provide an output image name." << std::endl;
return EXIT_FAILURE;
}
const char * out_file_name = argv[1];
using ComponentType = unsigned char;
regionC.PadByRadius( 10 );
RGBPixelType pix_black(0.0);
RGBPixelType pix_red(0.0);
pix_red.SetRed( 255 );
RGBPixelType pix_green(0.0);
pix_green.SetGreen( 255 );
RGBPixelType pix_blue(0.0);
pix_blue.SetBlue( 255 );
RGBImageType::Pointer image = RGBImageType::New();
image->SetRegions( region );
image->Allocate();
image->FillBuffer( pix_black );
IteratorType itA( image, regionA );
for (itA.GoToBegin(); !itA.IsAtEnd(); ++itA)
{
itA.Value() += pix_red;
}
IteratorType itB( image, regionB );
for (itB.GoToBegin(); !itB.IsAtEnd(); ++itB)
{
itB.Value() += pix_green;
}
IteratorType itC( image, regionC );
for (itC.GoToBegin(); !itC.IsAtEnd(); ++itC)
{
itC.Value() += pix_blue;
}
image.GetPointer(),true);
FileWriterType::Pointer writer = FileWriterType::New();
writer->SetFileName( out_file_name );
writer->SetInput( image );
try
{
writer->Update();
std::cout << "Created " << argv[1] << std::endl;
}
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}