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

Co-registration of longitudinal data #17

Open
valosekj opened this issue Jun 7, 2023 · 2 comments
Open

Co-registration of longitudinal data #17

valosekj opened this issue Jun 7, 2023 · 2 comments
Labels

Comments

@valosekj
Copy link
Member

valosekj commented Jun 7, 2023

This post summarizes notes from our (@valosekj, @sandrinebedard, @jcohenadad) meeting with Roland Henry (UCSF) at ISMRM 2023.

Roland is interested in the intra-subject co-registration of longitudinal data in MS patients (i.e., data across different time points).

He has axial and sagittal images from 10-time points. Images should have similar parameters across time points.

Ideas to explore (one idea per point):

  1. check if the spinal cord volume is the same in the native space and after registration to PAM50.
  2. align spinal cords within the subject between time points (i.e. avoid registration to PAM50 template)
    • should be possible using sct_straighten_spinalcord (see options -ldisc-input and -ldisc-dest)
  3. register all images to PAM50, then concatenate the warping fields to get a single warping field for registration back to the subject's native space
    • make sure that the coverage is the same (use discs)
    • avoid scaling in the S-I direction
  4. since images are anisotropic (sagittal), straightening can introduce bias --> explore super-resolution

The ideas could be tested on spine-generic/data-single-subject dataset (we have already computed C2-C3 CSA in the native space).

TODO:

  • once tested, plan ZOOM with Roland's group
@valosekj valosekj added the SCT label Jun 7, 2023
@sandrinebedard
Copy link
Member

I've tested the suggestion of @benjamindeleener to use sct_straighten_spinalcord with the option -dest

Using this dataset: https://openneuro.org/datasets/ds004507/versions/1.0.1, trying to align the head position headUp (right) to headNormal (left).

image

Here is the description of -dest

 -dest <file>     Spinal cord centerline (or segmentation) of a destination image (which could be straight or 
 curved). An algorithm scales the length of the input centerline to match that of the destination centerline. 
 If using -ldisc-input and -ldisc-dest with this parameter, instead of linear scaling, the source centerline will
  be non-linearly matched so that the inter-vertebral discs of the input image will match that of the 
  destination image. This feature is particularly useful for registering to a template while accounting for disc
   alignment
  1. Tried using -dest
sct_straighten_spinalcord -i sub-003/ses-headUp/anat/sub-003_ses-headUp_T2w.nii.gz -s derivatives/labels/sub-003/ses-headUp/anat/sub-003_ses-headUp_T2w_seg-manual.nii.gz -dest derivatives/labels/sub-003/ses-headDown/anat/sub-003_ses-headDown_T2w_seg-manual.nii.gz -x linear -qc ./qc

It failed:

Traceback (most recent call last):
  File "/mnt/c/Users/sb199/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_straighten_spinalcord.py", line 278, in <module>
    main(sys.argv[1:])
  File "/mnt/c/Users/sb199/spinalcordtoolbox/spinalcordtoolbox/scripts/sct_straighten_spinalcord.py", line 261, in main
    fname_straight = sc_straight.straighten()
  File "/mnt/c/Users/sb199/spinalcordtoolbox/spinalcordtoolbox/straightening.py", line 453, in straighten
    coord_straight2curved = centerline.get_inverse_plans_coordinates(coord_in_planes_straight, lookup)
  File "/mnt/c/Users/sb199/spinalcordtoolbox/spinalcordtoolbox/types.py", line 330, in get_inverse_plans_coordinates
    return einsum('mnr,nr->mr', rollaxis(self.matrices[indexes], 0, 3), coordinates.transpose()).transpose() + self.points[indexes]
IndexError: index 243 is out of bounds for axis 0 with size 243
  1. Adding the discs labels of input and dest:
sct_straighten_spinalcord -i sub-003/ses-headUp/anat/sub-003_ses-headUp_T2w.nii.gz -s derivatives/labels/sub-003/ses-headUp/anat/sub-003_ses-headUp_T2w_seg-manual.nii.gz -dest derivatives/labels/sub-003/ses-headNormal/anat/sub-003_ses-headNormal_T2w_seg-manual.nii.gz -x linear -qc ./qc -ldisc-input derivatives/labels/sub-003/ses-headUp/anat/sub-003_ses-headUp_T2w_labels-disc-manual.nii.gz -ldisc-dest derivatives/labels/sub-003/ses-headNormal/anat/sub-003_ses-headNormal_T2w_labels-disc-manual.nii.gz

It worked! 🎉

gif_straighten
(croped is headUp in the spinal cord curvature of head normal)

@benjamindeleener
Copy link
Member

Awesome! Some details about the method: when providing the labels, the registration algorithm will map the two sets of labels. When the user does not provide any set of labels, the registration algorithm will map the two curves based on length, but it doesn't make sense if the two curves do not start at the same (upper) location. In addition, I usually experience some errors with this algorithm (when only providing the curves.

This algorithm is great for intra- and inter-subject registration while preserving the axial topology of the structures. It can be used for registration to a template, for intra-subject inter-modality registration as well as motion correction. The processing time depends on the image size and resolution, but it can be used on any 3D image.

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

No branches or pull requests

3 participants