static void CreateImage(UnsignedCharImageType::Pointer image);
int main(int, char *[])
{
UnsignedCharImageType::Pointer image = UnsignedCharImageType::New();
CreateImage(image);
SimpleContourExtractorImageFilterType::Pointer contourFilter
= SimpleContourExtractorImageFilterType::New();
contourFilter->SetInput(image);
contourFilter->Update();
WriterType::Pointer writer = WriterType::New();
writer->SetFileName("output.png");
writer->SetInput(contourFilter->GetOutput());
writer->Update();
return EXIT_SUCCESS;
}
void CreateImage(UnsignedCharImageType::Pointer image)
{
image->SetRegions(region);
image->Allocate();
image->FillBuffer(0);
for(unsigned int i = 40; i < 60; ++i)
{
image->SetPixel(pixel, 255);
}
for(unsigned int i = 10; i < 20; ++i)
{
pixel[0] = 10;
pixel[1] = i;
image->SetPixel(pixel, 255);
}
WriterType::Pointer writer = WriterType::New();
writer->SetFileName("input.png");
writer->SetInput(image);
writer->Update();
}