static void CreateImage(ImageType::Pointer image, PixelType);
int main(int argc, char *argv[])
{
ImageType::Pointer image1 = ImageType::New();
PixelType pixel1;
pixel1.Fill(0);
if (argc > 3)
{
pixel1.SetRed(atoi(argv[1]));
pixel1.SetGreen(atoi(argv[2]));
pixel1.SetBlue(atoi(argv[3]));
}
CreateImage(image1, pixel1);
ImageType::Pointer image2 = ImageType::New();
PixelType pixel2;
pixel2.Fill(255);
if (argc > 6)
{
pixel2.SetRed(atoi(argv[4]));
pixel2.SetGreen(atoi(argv[5]));
pixel2.SetBlue(atoi(argv[6]));
}
CreateImage(image2, pixel2);
CheckerBoardFilterType::Pointer checkerBoardFilter = CheckerBoardFilterType::New();
checkerBoardFilter->SetInput1(image1);
checkerBoardFilter->SetInput2(image2);
checkerBoardFilter->Update();
viewer.
AddImage<ImageType>(checkerBoardFilter->GetOutput());
return EXIT_SUCCESS;
}
void CreateImage(ImageType::Pointer image, PixelType color)
{
ImageType::IndexType start;
start.Fill(0);
ImageType::SizeType size;
size.Fill(100);
ImageType::RegionType region;
region.SetSize(size);
region.SetIndex(start);
image->SetRegions(region);
image->Allocate();
while(!imageIterator.IsAtEnd())
{
imageIterator.Set(color);
++imageIterator;
}
}