static void
int
main()
{
CreateImage(image);
using ApproximateSignedDistanceMapImageFilterType =
approximateSignedDistanceMapImageFilter->SetInput(image);
approximateSignedDistanceMapImageFilter->SetInsideValue(255);
approximateSignedDistanceMapImageFilter->SetOutsideValue(0);
approximateSignedDistanceMapImageFilter->Update();
contourExtractor2DImageFilter->SetInput(approximateSignedDistanceMapImageFilter->GetOutput());
contourExtractor2DImageFilter->SetContourValue(0);
contourExtractor2DImageFilter->Update();
std::cout << "There are " << contourExtractor2DImageFilter->GetNumberOfOutputs() << " contours" << std::endl;
for (unsigned int i = 0; i < contourExtractor2DImageFilter->GetNumberOfOutputs(); ++i)
{
std::cout << "Contour " << i << ": " << std::endl;
ContourExtractor2DImageFilterType::VertexListType::ConstIterator vertexIterator =
contourExtractor2DImageFilter->GetOutput(i)->GetVertexList()->Begin();
while (vertexIterator != contourExtractor2DImageFilter->GetOutput(i)->GetVertexList()->End())
{
std::cout << vertexIterator->Value() << std::endl;
++vertexIterator;
}
std::cout << std::endl;
}
return EXIT_SUCCESS;
}
void
{
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);
}
}