Hi,
I have a 3D binary mask volume with dimension (512, 512, 105) and a deformation field with dimension (512, 512, 105, 1, 3) in nifti format. I want to apply the deformation field to the 3D binary mask volume. How can I achive that using nibabel ? If possible can someone please elaborate this with an example code.
# read 3D binary mask image volume
binary_image_volume_path = "./Segmentation.nii.gz"
binary_img = nib.load(binary_image_volume_path)
binary_img_data = binary_img.get_data()
# read dvf volume
dvf_volume_path = "./Segmentation_DVF0000.nii.gz"
dvf_volume = nib.load(dvf_volume_path)
dvf_volume_data = dvf_volume.get_data()
# code for apply this dvf to the binary mask image