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

philadelphia-pediatric: organization and naming of new subjects #334

Open
valosekj opened this issue Jul 25, 2024 · 7 comments
Open

philadelphia-pediatric: organization and naming of new subjects #334

valosekj opened this issue Jul 25, 2024 · 7 comments
Assignees
Labels
dataset: philadelphia-pediatric Pediatric HC data from Feroze Mohammed

Comments

@valosekj
Copy link
Member

This issue discusses data organization and file naming for new subjects for the philadelphia-pediatric dataset that our collaborators will share with us.

Current organization and naming:

├── anat
│   ├── sub-172_T1wSlab1.json
│   ├── sub-172_T1wSlab1.nii.gz
│   ├── sub-172_T1wSlab2.json
│   ├── sub-172_T1wSlab2.nii.gz
│   ├── sub-172_T2wSlab1.json
│   ├── sub-172_T2wSlab1.nii.gz
│   ├── sub-172_T2wSlab2.json
│   └── sub-172_T2wSlab2.nii.gz
├── DWI
│   ├── sub-172_DWI.bval
│   ├── sub-172_DWI.bvec
│   ├── sub-172_DWI.json
│   └── sub-172_DWI.nii.gz
└── composed
    ├── sub-172_T1COMP.json
    ├── sub-172_T1COMP.nii.gz
    ├── sub-172_T2COMP.json
    └── sub-172_T2COMP.nii.gz

Organization and naming that would be compatible with our convention:

├── anat
│   ├── sub-172_acq-bottom_run-1_T1w.json
│   ├── sub-172_acq-bottom_run-1_T1w.nii.gz
│   ├── sub-172_acq-bottom_run-1_T2w.json
│   ├── sub-172_acq-bottom_run-1_T2w.nii.gz
│   ├── sub-172_acq-top_run-1_T1w.json
│   ├── sub-172_acq-top_run-1_T1w.nii.gz
│   ├── sub-172_acq-top_run-1_T2w.json
│   ├── sub-172_acq-top_run-1_T2w.nii.gz
│   ├── sub-172_rec-composed_T1w.json
│   ├── sub-172_rec-composed_T1w.nii.gz
│   ├── sub-172_rec-composed_T2w.json
│   └── sub-172_rec-composed_T2w.nii.gz
└── dwi
    ├── sub-172_run-1_dwi.bval
    ├── sub-172_run-1_dwi.bvec
    ├── sub-172_run-1_dwi.json
    └── sub-172_run-1_dwi.nii.gz

Changes:

  • directory renaming: DWI to dwi
  • file renaming: usage of acq-bottom and acq-top keys in the file names. Usage of rec-composed for composed images. Putting composed images into the anat directory.
@valosekj valosekj added the dataset: philadelphia-pediatric Pediatric HC data from Feroze Mohammed label Jul 25, 2024
@valosekj valosekj self-assigned this Jul 25, 2024
@valosekj
Copy link
Member Author

@jcohenadad, I'm now thinking whether run-1 is actually necessary. We use it for the subjects we already have. But we never use run-2:

cd philadelphia-pediatric
$ ls sub-1*/anat/*run-2*.nii.gz
ls: sub-1*/anat/*run-2*.nii.gz: No such file or directory

But for consistency with the already shared data, I would use run-1 also for new subjects.

@jcohenadad
Copy link
Member

jcohenadad commented Jul 25, 2024

I think that top/bottom should use the chunk entity instead. Example: sub-172_acq-bottom_run-1_T1w.json should be replaced with sub-172_chunk-2_run-1_T1w.json

@jcohenadad
Copy link
Member

@jcohenadad, I'm now thinking whether run-1 is actually necessary. We use it for the subjects we already have. But we never use run-2:

If we don't have run-2, then I agree, there is no need for run-1

@valosekj
Copy link
Member Author

Agree with both. Let's share the data with filenames proposed in the first comment. And I will then fix the filename for the whole dataset.

@valosekj
Copy link
Member Author

During a BIDS validation of the newly shared data, @mguaypaq discovered that several subjects have empty sform_code and qform_code, leading to unknown image orientation. Details can be found at this data.neuro.polymtl.ca comment.
When opened in FSLeyes, these images display red question marks instead of R/L, A/P, S/I labels:

screenshot

image

I contacted our collaborators about this issue and received the following response:

Regarding the spatial orientation, I believe Nadia Blostein used the data in that same format without correction on our end for template creation. If it’s possible to check with her she may already have a solution for the orientation issues which works with your pipeline. We’ve used a couple of methods to fix the orientations but just want to be sure that the solution works for you.

I've looked in our repos, but I haven't found any piece of code related to the orientation fix. @jcohenadad, @rohanbanerjee, @NadiaBlostein, do you happen to have any insights?

@valosekj
Copy link
Member Author

valosekj commented Aug 18, 2024

Follow-up on the empty sform_code and qform_code from my previous comment. After iteratively promoting Claude while controlling its output in FSleyes, I ended up with the following commands to fix the image header:

# creaty a copy image to play with
cp sub-127_rec-composed_T2w_copy.nii.gz sub-127_rec-composed_T2w_fixed.nii.gz
# fix qform
fslorient -setqformcode 1 sub-127_rec-composed_T2w_fixed.nii.gz
fslorient -setqform 0 0 -1 0 -1 0 0 0 0 1 0 0 0 0 0 1 sub-127_rec-composed_T2w_fixed.nii.gz
# use the same transformation for sform:
fslorient -setsformcode 1 sub-127_rec-composed_T2w_fixed.nii.gz
fslorient -setsform 0 0 -1 0 -1 0 0 0 0 1 0 0 0 0 0 1 sub-127_rec-composed_T2w_fixed.nii.gz
# now, the image is in AIL
#  --> reorient it to LPI to be in the same orientation as sub-127_acq-top_run-1_T2w.nii.gz to allow comparison in FSLeyes
sct_image -i sub-127_rec-composed_T2w_fixed.nii.gz -setorient LPI -o sub-127_rec-composed_T2w_fixed_LPI.nii.gz

Now, when opening sub-127_acq-top_run-1_T2w.nii.gz and sub-127_rec-composed_T2w_fixed_LPI.nii.gz in two separate FSLeyes windows, I can compare the axes. S-I and A-P are easy. R-L vs L-R is tricky (as the cord is symmetric); I used a slight scoliosis to match R-L between images.
However, when double-checking some already existing images, for example, for sub-123, I noticed that the R-L axis is swapped! --> Opening a separate issue: #337

@valosekj
Copy link
Member Author

Update: I received fixed composed images from collaborators and pushed them to data.neuro.polymtl.ca; details in https://data.neuro.polymtl.ca/datasets/philadelphia-pediatric/pulls/3#issuecomment-624.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dataset: philadelphia-pediatric Pediatric HC data from Feroze Mohammed
Projects
None yet
Development

No branches or pull requests

2 participants