spine-generic / data-multi-subject

Multi-subject data for the Spine Generic project
Creative Commons Attribution 4.0 International
21 stars 15 forks source link

Some subjects have different image and label dimensions and resolution #144

Closed valosekj closed 3 weeks ago

valosekj commented 1 year ago

Some subjects have different image and label dimensions and resolution.

For example, for subject sub-beijingGE02, T2w image has different dim and pixdim than T2w spinal cord segmentation:

$ sct_image -i sub-beijingGE02/anat/sub-beijingGE02_T2w.nii.gz -header | grep dim | head -2
dim     [3, 56, 256, 256, 1, 1, 1, 1]
pixdim      [1.0, 0.8, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0]

$ sct_image -i derivatives/labels/sub-beijingGE02/anat/sub-beijingGE02_T2w_seg-manual.nii.gz -header | grep dim | head -2
dim     [3, 56, 320, 320, 1, 1, 1, 1]
pixdim      [-1.0, 0.799994, 0.8, 0.8, 1.0, 1.0, 1.0, 1.0]

This discrepancy probably originates from processing, where T2w image was resampled and then segmented:

# T2
# ------------------------------------------------------------------------------
file_t2="${SUBJECT}_T2w"
# Reorient to RPI and resample to 0.8mm iso (supposed to be the effective resolution)
sct_image -i ${file_t2}.nii.gz -setorient RPI -o ${file_t2}_RPI.nii.gz
sct_resample -i ${file_t2}_RPI.nii.gz -mm 0.8x0.8x0.8 -o ${file_t2}_RPI_r.nii.gz
file_t2="${file_t2}_RPI_r"
# Segment spinal cord (only if it does not exist)
segment_if_does_not_exist $file_t2 "t2"

In other words, data-multi-subject contains the original non-resampled T2w image but SC seg obtained from resampled T2w image. So far, I noticed this for sub-beijingGE and sub-brnoUhb subjects.

jcohenadad commented 1 year ago

This discrepancy probably originates from processing, where T2w image was resampled and then segmented:

Yup! This is exactly it. Thank you for catching that @valosekj 🙏

Not sure what is the best course of action from there... I guess it depends how these manual labels are used.

valosekj commented 1 year ago

Not sure what is the best course of action from there... I guess it depends on how these manual labels are used.

Right, it really depends on the processing steps which are run. I noticed this because I was using "raw" T2w images without applying the resampling. If resampling is applied, everything is fine.

Perhaps we could add the following paragraph to the README.md file (as we did for canproco) to inform future users:

## Derivatives
Note: T1w and T2w images were preprocessed prior to spinal cord segmentation and disc labeling.
Namely, reorientation to RPI and resampling to 1mm (T1w) and 0.8mm (T2w) isotropic voxel size was performed. 
Therefore, for some subjects, the original T1w and T2w images have different dimensions than the segmentation and disc labeling.
Applied preprocessing steps for T1w image:
https://github.com/spine-generic/spine-generic/blob/master/process_data.sh#L146-L157
Applied preprocessing steps for T2w image:
https://github.com/spine-generic/spine-generic/blob/master/process_data.sh#L175-L183