void
CreateImage(UnsignedCharImageType::Pointer image);
int
main(int, char *[])
{
UnsignedCharImageType::Pointer image = UnsignedCharImageType::New();
CreateImage(image);
MedianImageFunctionType::Pointer medianImageFunction = MedianImageFunctionType::New();
medianImageFunction->SetInputImage(image);
std::cout << "Median at " << index << " is " << static_cast<int>(medianImageFunction->EvaluateAtIndex(index))
<< std::endl;
return EXIT_SUCCESS;
}
void
CreateImage(UnsignedCharImageType::Pointer image)
{
image->SetRegions(region);
image->Allocate();
image->FillBuffer(0);
while (!imageIterator.IsAtEnd())
{
if (imageIterator.GetIndex()[0] >= 50 && imageIterator.GetIndex()[1] >= 50 && imageIterator.GetIndex()[0] <= 70 &&
imageIterator.GetIndex()[1] <= 70)
{
imageIterator.Set(255);
}
++imageIterator;
}
WriterType::Pointer writer = WriterType::New();
writer->SetFileName("input.png");
writer->SetInput(image);
writer->Update();
}