Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cropped template after registration and inverse warping not working #2531

Closed
jcohenadad opened this issue Nov 21, 2019 · 3 comments · Fixed by #2532
Closed

Cropped template after registration and inverse warping not working #2531

jcohenadad opened this issue Nov 21, 2019 · 3 comments · Fixed by #2532
Assignees
Labels
bug category: fixes an error in the code priority:HIGH sct_register_to_template context:

Comments

@jcohenadad
Copy link
Member

Weirdly, when running standard registration to the template, the template2anat file is cropped (see below), and the anat2template is empty.

Screen Shot 2019-11-21 at 2 14 32 PM

to reproduce:

sct_download_data -d sct_example_data
cd sct_example_data/t2
sct_propseg -i t2.nii.gz -c t2
sct_label_utils -i t2.nii.gz -create-viewer 3,9 -o labels.nii.gz
sct_register_to_template -i t2.nii.gz -s t2_seg.nii.gz -l labels.nii.gz -v 2 -r 0
@jcohenadad jcohenadad self-assigned this Nov 21, 2019
@jcohenadad jcohenadad added bug category: fixes an error in the code priority:HIGH sct_register_to_template context: labels Nov 21, 2019
@jcohenadad
Copy link
Member Author

The problem was introduced at 4.1.0

@jcohenadad
Copy link
Member Author

I tried reversing this PR #2444 but it didn't help

@jcohenadad
Copy link
Member Author

The problem is related to the cropping of the image at the end of the process, here:
https:/neuropoly/spinalcordtoolbox/blob/master/scripts/sct_register_to_template.py#L711

To fix it, i changed the crop flag to 0 instead of 1:

sct.run(['sct_apply_transfo', '-i', 'template.nii', '-o', 'template2anat.nii.gz', '-d', 'data.nii', '-w', 'warp_template2anat.nii.gz', '-crop', '0'], verbose)
sct.run(['sct_apply_transfo', '-i', 'data.nii', '-o', 'anat2template.nii.gz', '-d', 'template.nii', '-w', 'warp_anat2template.nii.gz', '-crop', '0'], verbose)

jcohenadad added a commit that referenced this issue Dec 17, 2019
Fixes #2531


Former-commit-id: 6cd25b4ea5d6b851019a48cc16b582bce2f0148f [formerly c8c9148]
Former-commit-id: aee8fe86103510b2c4b48ba05596aba7230bdc8a
jcohenadad added a commit that referenced this issue Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug category: fixes an error in the code priority:HIGH sct_register_to_template context:
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant