#include "itksys/SystemTools.hxx"
#include <sstream>
static void CreateImage(UnsignedCharImageType::Pointer image);
int main(int argc, char * argv[])
{
UnsignedCharImageType::Pointer image = UnsignedCharImageType::New();
if (argc < 2)
{
CreateImage(image);
}
else
{
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(argv[1]);
reader->Update();
image = reader->GetOutput();
}
ApproximateSignedDistanceMapImageFilterType::Pointer approximateSignedDistanceMapImageFilter =
ApproximateSignedDistanceMapImageFilterType::New();
approximateSignedDistanceMapImageFilter->SetInput(image);
approximateSignedDistanceMapImageFilter->SetInsideValue(255);
approximateSignedDistanceMapImageFilter->SetOutsideValue(0);
image.GetPointer(),true,
argc > 1 ? itksys::SystemTools::GetFilenameName(argv[1]) : "Generated image");
std::stringstream desc;
desc << "Approximate Signed Distance";
approximateSignedDistanceMapImageFilter->GetOutput(),
true,
desc.str());
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);
}
}