def saveDeformedLattice3D(displacement, oname): minVal, maxVal=tf.get_displacement_range(displacement, None) sh=np.array([np.ceil(maxVal[0]),np.ceil(maxVal[1]),np.ceil(maxVal[2])], dtype=np.int32) L=np.array(rcommon.drawLattice3D(sh, 10)) warped=np.array(tf.warp_volume(L, displacement, np.eye(4))).astype(np.int16) img=nib.Nifti1Image(warped, np.eye(4)) img.to_filename(oname)
def saveDeformedLattice3D(displacement, oname): minVal, maxVal = tf.get_displacement_range(displacement, None) sh = np.array([np.ceil(maxVal[0]), np.ceil(maxVal[1]), np.ceil(maxVal[2])], dtype=np.int32) L = np.array(rcommon.drawLattice3D(sh, 10)) warped = np.array(tf.warp_volume(L, displacement, np.eye(4))).astype(np.int16) img = nib.Nifti1Image(warped, np.eye(4)) img.to_filename(oname)
def save_deformed_lattice_3d(displacement, oname): r''' Applies the given displacement to a regular lattice and saves the resulting image to a Nifti file with the given name ''' min_val, max_val = tf.get_displacement_range(displacement, None) shape = np.array([np.ceil(max_val[0]), np.ceil(max_val[1]), np.ceil(max_val[2])], dtype = np.int32) lattice = np.array(rcommon.drawLattice3D(shape, 10)) warped = np.array(tf.warp_volume(lattice, displacement)).astype(np.int16) img = nib.Nifti1Image(warped, np.eye(4)) img.to_filename(oname)