I have dicom files for two CT scans and deformable registration between them. I would like to ask how I can deform one CT scan based on the deformable registration file: so far, I managed to extract the deformation vector field from the dicom file: import pydicom, numpy as np from struct import unpack ds = pydicom.read_file(fn) # fn: dicom deformation file. v = ds.DeformableRegistrationSequence[0].DeformableRegistrationGridSequence[0].VectorGridData values = unpack(f"<{len(v) // 4}f", v) dim = B.GridDimensions nx, ny, nz = (dim[0],dim[1],dim[2]) # number of voxels in x,y,z direction # exctract the dx,dy,dz as per https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.20.3.html#sect_C.20.3.1.3 dx3d = values[0::3] dy3d = values[1::3] dz3d = values[2::3] dx = np.reshape(dx3d,[nz,ny,nx]) dy = np.reshape(dy3d,[nz,ny,nx]) dz = np.reshape(dz3d,[nz,ny,nx]) I can plot the deformation field on each CT slice as can be seen in the image below. 1 So, the remaining task is how to deform the CT data based on the deformation vectors (dx, dy, dz) Many thanks Continue reading...