How to convert a anisotropic to isotropic and then back to anisotropic?

Hello, I have a reference image that is isotropic (1mm x 1mm x 1mm). A target image is anisotropic (0.5 mm x0.5mmx2mm). I want to convert the target image to isotropic that same with the reference image. After obtaining the processed target image, I will do the thresholding to obtain a mask. The mask is isotropic because it processed on the processed target image. I want to convert the mask back to the original target image (anisotropic) using simple-ITK in python. Could you help me please? The phases can be summarized as

  1. Convert the target image to isotropic (1mmx1mmx1mm) to obtain target_iso
  2. Convert back the target_iso to the anisotropic

Thanks

For resampling images you should look at ITK software guide section 2.9.4 Resample Image Filter.

But why would you do thresholding on a resampled image? Why not do thresholding directly on the target image? That way you will have full-resolution mask without resampling (which is both computationally expensive and loses quality).

I trained on isotropic images and testing on anisotropic image. So, I gave threshold just simple example.