Thank you for sharing your work!
I am interested on generating the DVFs with the corrField script, which normally produces two files at the end of the registration. I understand that the CSV file contains the spare Förstner keypoints in both Fixed and Moving (warped) images; which allows for the computation of the TRE. However, It's not clear how you store the resulting DVF after the registration process, since it appears to be a simple NIfTI image file or that's what is read in comments. Would it be possible for you to explain or provide the code necessary to store the DVF at the end of the algorithm? I tried to store the resulting deformations in multiple ways but the resulting vector field is far from looking coherent. Thanks in advance for your help!
The lines of code I am referring to are in the file 'corrfield.py' :
% Store keypoints
np.savetxt('{}.csv'.format(output_path), torch.cat([kpts_fix[0], kpts_mov_corr[0]], dim=1).cpu().numpy(), delimiter=",", fmt='%.3f')
% Store the warrped image <== IS THE ALGORITHM SUPOSSED TO STORE AN IMAGE RATHER THAN THE DVF?
nib.save(nib.Nifti1Image(img_mov_warped.cpu().numpy(), np.eye(4)), '{}.nii.gz'.format(output_path))
Thank you for sharing your work! I am interested on generating the DVFs with the corrField script, which normally produces two files at the end of the registration. I understand that the CSV file contains the spare Förstner keypoints in both Fixed and Moving (warped) images; which allows for the computation of the TRE. However, It's not clear how you store the resulting DVF after the registration process, since it appears to be a simple NIfTI image file or that's what is read in comments. Would it be possible for you to explain or provide the code necessary to store the DVF at the end of the algorithm? I tried to store the resulting deformations in multiple ways but the resulting vector field is far from looking coherent. Thanks in advance for your help!
The lines of code I am referring to are in the file 'corrfield.py' :
% Store keypoints np.savetxt('{}.csv'.format(output_path), torch.cat([kpts_fix[0], kpts_mov_corr[0]], dim=1).cpu().numpy(), delimiter=",", fmt='%.3f')
seg_mov_warped = F.grid_sample(seg_mov, dense_flow1, align_corners=True,mode='nearest').squeeze().short()
% Store the warrped image <== IS THE ALGORITHM SUPOSSED TO STORE AN IMAGE RATHER THAN THE DVF? nib.save(nib.Nifti1Image(img_mov_warped.cpu().numpy(), np.eye(4)), '{}.nii.gz'.format(output_path))