static void CreateImage(ImageType::Pointer image);
static void WriteImage(ImageType::Pointer image, std::string filename);
int main(int, char *[])
{
ImageType::Pointer image = ImageType::New();
CreateImage(image);
WriteImage(image, "input.png");
lowerExtendRegion[0] = 10;
lowerExtendRegion[1] = 10;
upperExtendRegion[0] = 50;
upperExtendRegion[1] = 50;
ImageType::PixelType constantPixel = 100;
ConstantPadImageFilterType::Pointer padFilter
= ConstantPadImageFilterType::New();
padFilter->SetInput(image);
padFilter->SetPadLowerBound(lowerExtendRegion);
padFilter->SetPadUpperBound(upperExtendRegion);
padFilter->SetConstant(constantPixel);
padFilter->Update();
WriteImage(padFilter->GetOutput(), "output.png");
return EXIT_SUCCESS;
}
void CreateImage(ImageType::Pointer image)
{
image->SetRegions(region);
image->Allocate();
image->FillBuffer(0);
}
void WriteImage(ImageType::Pointer image, std::string filename)
{
WriterType::Pointer writer = WriterType::New();
writer->SetFileName(filename);
writer->SetInput(image);
writer->Update();
}