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

Demonstrate that the dog template can be used for template-based registration #14

Open
jcohenadad opened this issue Jan 12, 2024 · 5 comments
Assignees

Comments

@jcohenadad
Copy link
Member

Context: https://forum.spinalcordmri.org/t/integrating-dog-template/1179/2

@rohanbanerjee
Copy link
Collaborator

Updating here, currently facing a few issues but I suspect it is due to the template cord labeling and template disc labeling (I'll explain below)

Using SCT latest version: git-master-29476b99e05d59a2b42ed7d20d4f40a58a53c497

The command I am using for this task is:

sct_register_to_template -i /Users/rohanbanerjee/Documents/research/neuropoly/dog_template_updated/bids_data/sub-HarshmanDobby/anat/sub-HarshmanDobby_T1.nii.gz -s /Users/rohanbanerjee/Documents/research/neuropoly/dog_template_updated/bids_data_updated/derivatives/labels/sub-HarshmanDobby/anat/sub-HarshmanDobby_T1_label-SC_seg.nii.gz -l /Users/rohanbanerjee/Documents/research/neuropoly/dog_template_updated/bids_data_updated/derivatives/labels/sub-HarshmanDobby/anat/sub-HarshmanDobby_T1_labels-disc_updated.nii.gz -t /Users/rohanbanerjee/Documents/research/neuropoly/dog_template_updated/template-dog/templatedog-r20240112/ -c t1 -s-template-id 2 -ofolder /Users/rohanbanerjee/Documents/research/neuropoly/dog_template_updated/register_op

I am using the template files from the latest release: https://github.com/spinalcordtoolbox/template-dog/releases/tag/v2.1

I am getting the following error:
Exception: Error: number of source and destination landmarks are not the same, so landmarks cannot be paired.

When I investigated the temporary files created during the straightening during the registration, I found that template disc labeled values started from 2.0 and the cord labeling also started from the same place. The below image shows what I mean. It is missing the labels for the first disc.

Screenshot 2024-01-17 at 1 16 13 AM

I'm currently rectifying the above issue. Will keep updating here.

@jcohenadad
Copy link
Member Author

jcohenadad commented Jan 16, 2024

-l /Users/rohanbanerjee/Documents/research/neuropoly/dog_template_updated/bids_data_updated/derivatives/labels/sub-HarshmanDobby/anat/sub-HarshmanDobby_T1_labels-disc_updated.nii.gz

"-l" refers to vertebral levels, whereas you are using disc labels ("-ldisc")

@jcohenadad
Copy link
Member Author

if you have difficulties, maybe @joshuacwnewton can provide assistance.

@rohanbanerjee
Copy link
Collaborator

As mentioned above, I made changes to the template cord file, template disc level file and template vertebrae file. Along with this, I also used -ldisc instead of -l. This solved the above issue that I was facing.

The updated command I used for the registration is as follows:

sct_register_to_template -i /Users/rohanbanerjee/Documents/research/neuropoly/dog_template_updated/bids_data/sub-HarshmanDobby/anat/sub-HarshmanDobby_T2.nii.gz -s /Users/rohanbanerjee/Documents/research/neuropoly/dog_template_updated/bids_data_updated/derivatives/labels/sub-HarshmanDobby/anat/sub-HarshmanDobby_T2_label-SC_seg.nii.gz -ldisc /Users/rohanbanerjee/Documents/research/neuropoly/dog_template_updated/bids_data_updated/derivatives/labels/sub-HarshmanDobby/anat/sub-HarshmanDobby_T2_labels-disc_updated.nii.gz -t /Users/rohanbanerjee/Documents/research/neuropoly/dog_template_updated/template-dog/templatedog-r20240112/ -c t2 -s-template-id 2 -ofolder /Users/rohanbanerjee/Documents/research/neuropoly/dog_template_updated/register_op

The output of the registrations are as follows:

For t2,

template2anat
Screen.Recording.2024-01-18.at.2.09.54.AM.mov
anat2template (Template is the copper overlay)
Screen.Recording.2024-01-18.at.2.31.56.AM.mov

For t1,

template2anat
https://github.com/spinalcordtoolbox/template-dog/assets/25586344/6436492b-0f25-43fe-97c6-01efa352c4ee
anat2template
Screen.Recording.2024-01-18.at.3.08.41.AM.mov

For t1, the anat2template registration (registration done with default parameters) does not produce great results.

Attaching all the above mentioned files:
All template related files: https://drive.google.com/file/d/1UT2tqePQulXSopJwxAkpjdlytkewHT5e/view?usp=sharing

All registration related files: https://drive.google.com/file/d/1TNtpVcZZ45nWyxamPTMhTXJ-Vu5WJua5/view?usp=sharing

@jcohenadad
Copy link
Member Author

jcohenadad commented Jan 19, 2024

clarification about disc labels:

  • data.neuro/template_dog_virginiatech/derivatives/labels/sub-HarshmanDobby/anat/sub-HarshmanDobby_T2_labels-disc.nii.gz has 26 labels
  • templatedog_label_disc.nii.gz from the template uploaded at New release r20240118 discussion #16 (comment) has 24 labels.

Therefore, we CANNOT use the 26 labels disc file to register to the template.

that's fine, we will just do 2 labels.

my syntax to reproduce:

# only keep 2 disc labels
sct_label_utils -i ~/data.neuro/template_dog_virginiatech/derivatives/labels/sub-HarshmanDobby/anat/sub-HarshmanDobby_T2_labels-disc.nii.gz -keep 4,10 -o labels_4-10.nii.gz
# run registration (params not optimized)
sct_register_to_template -i ~/data.neuro/template_dog_virginiatech/sub-HarshmanDobby/anat/sub-HarshmanDobby_T2.nii.gz -s ~/data.neuro/template_dog_virginiatech/derivatives/labels/sub-HarshmanDobby/anat/sub-HarshmanDobby_T2_label-centerline.nii.gz -ldisc labels_4-10.nii.gz -t . -c t2 -s-template-id 2 -ofolder test_discs4-10 -param step=1,type=seg,algo=centermass:step=2,type=im,algo=syn,metric=CC,iter=3 -qc qc~~~

SCT version used: Spinal Cord Toolbox (git-jca/4298-flow-d396ad3a9090900cc62d4b6eb4ccbc6d63d4a6eb)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants