Copy Image into another image taking into account origin & spacing

What would be the basic steps to copy a source image into an existing destination image that takes into account the origin and spacing of both?

I have googled a bit and found https://itk.org/ITKExamples/src/Filtering/ImageGrid/PasteImageIntoAnotherOne/Documentation.html but I’m unsure if need to figure out the starting XY pixel location or if I can just use a different set of parameters. Assume the destination image has a larger number of pixels and would completely encompass the source image.

Do I need to first resample the source image to have the same spacing as the destination image?

Thanks
Mike Jackson

Yes, the images have to have the same spacing and orientation. Once you’ve resampled your source to do so, you can use the PasteImageFilter or Paste function to copy the pixels into the destination image.

Hi @imikejackson ,

To copy just the image information, i.e. spacing, origin, direction, there is itk::Image::CopyInformation(). To create a deep copy of an image, including the pixel buffer, there is itk::ImageDuplicator.