在赋值两个新的图像时遇到问题:
image1=Image;
image2=Image;
如果对image1进行处理后,Image 和 image2都会变化为image1,这样是不对的;
可以用下面这个赋值函数进行处理:
template<class TInputImage>
class itk::ImageDuplicator< TInputImage >
A helper class which creates an image which is perfect copy of the input image.
This class is NOT a filter. Although it has an API similar to a filter, this class is not intended to be used in a pipeline. Instead, the typical use will be like it is illustrated in the following code:
#include "itkImageDuplicator.h"
typedef itk::ImageDuplicator< ImageType > DuplicatorType;
DuplicatorType::Pointer duplicator = DuplicatorType::New();
duplicator->SetInputImage(image);
duplicator->Update();
ImageType::Pointer clonedImage = duplicator->GetModifiableOutput();
Note that the Update() method must be called explicitly in the filter that provides the input to the ImageDuplicator object. This is needed because the ImageDuplicator is not a pipeline filter.