Resampling depth in 3D datasets

Dear All,
i want to resample a 3D dataset with original spacing (X_o,Y_o,Z_o) to a new spacing, which differs from the original one only in depth (X_o,Y_o, Z_new). This will result in the same spatial dimensions of images, but a different number of slices. Now my question is: is it possible somehow to find the correspondence between the slices in the original and the new datasets.
For instance, my original dataset has 0.5 mm spacing in Z and 1200 slices, then if i change it to 5mm spacing, i’ll get 120 slices. Do i understand correctly that each slice in the new dataset will correspond to 10 slices in the original dataset? And if i detect a region in the resampled dataset, then i know its location in the original dataset almost exactly, up to the 10 slices, so to say?
Thank you and kind regards,
Tanja Ivanovska

Your statements are correct. You can find correspondence of locations between new and original datasets easily. Let’s say you have index in new 3D image. You can convert this to physical spacing then to index in the original 3D image:

ImageType::IndexType newIndex={{15,62,23}}; // or get the index using some other way.
ImageType::IndexType originalIndex; // we will compute this
auto point = newImage->TransformIndexToPhysicalPoint<double>(newIndex);
originalImage->TransformPhysicalPointToIndex(point, originalIndex);

Thanks!