Skip to content

Generation of DVF files using the corrField script #5

Description

@eocv

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions