ITK  5.0.0
Insight Segmentation and Registration Toolkit
WikiExamples/SimpleOperations/ImageDuplicator.cxx
#include "itkImage.h"
int main(int, char *[])
{
using ImageType = itk::Image< unsigned char, 2 >;
randomImageSource->SetNumberOfWorkUnits(1); // to produce non-random results
randomImageSource->Update();
ImageType::Pointer image = randomImageSource->GetOutput();
using DuplicatorType = itk::ImageDuplicator< ImageType >;
DuplicatorType::Pointer duplicator = DuplicatorType::New();
duplicator->SetInputImage(image);
duplicator->Update();
ImageType::Pointer clonedImage = duplicator->GetOutput();
return EXIT_SUCCESS;
}