sct-pipeline / contrast-agnostic-softseg-spinalcord

Contrast-agnostic spinal cord segmentation project with softseg
MIT License
4 stars 3 forks source link

Disc labels files created by `process_data.sh` are empty for `sub-brnoUhb` and `sub-tokyo750w` sites #63

Closed valosekj closed 9 months ago

valosekj commented 11 months ago

Disc labels files produced by process_data.sh script are empty for sub-brnoUhb and sub-tokyo750w sites. See, for example, sub-brnoUhb04:

$ cd ~/duke/projects/ivadomed/contrast-agnostic-seg/data_processed_sg_2023-03-10_NO_CROP/data_processed_clean/derivatives/labels/sub-brnoUhb04/anat
$ sct_label_utils -i sub-brnoUhb04_T1w_discs.nii.gz -display

--
Spinal Cord Toolbox (git-master-a11e9f1f5675fe6f25f3aceda4ceb5d13ad07c59)

sct_label_utils -i sub-brnoUhb04_T1w_discs.nii.gz -display
--

All labels (useful syntax):

Which is strange, because the git-annexed disc labels files seem fine:

$ cd ~/data/data.neuro.polymtl.ca/data-multi-subject/derivatives/labels/sub-brnoUhb04/anat
$ sct_label_utils -i sub-brnoUhb04_T1w_labels-disc-manual.nii.gz -display

--
Spinal Cord Toolbox (git-jn/4169-fix-compression-csv-append-behaviour-8e997263d1591c30675719538f19b8a5df5af53d*)

sct_label_utils -i sub-brnoUhb04_T1w_labels-disc-manual.nii.gz -display
--

Position=(83,231,251) -- Value= 1
Position=(83,225,213) -- Value= 2
Position=(94,222,191) -- Value= 3
Position=(94,220,162) -- Value= 4
Position=(94,214,132) -- Value= 5
Position=(94,211,103) -- Value= 6
Position=(94,200,74) -- Value= 7
Position=(94,186,48) -- Value= 8
Position=(94,163,23) -- Value= 9
All labels (useful syntax):
83,231,251,1:83,225,213,2:94,222,191,3:94,220,162,4:94,214,132,5:94,211,103,6:94,200,74,7:94,186,48,8:94,163,23,9

valosekj commented 11 months ago

Okay, when checking the process_data.sh script more deeply, it turned out that T2w disc labels are brought to T1w image (instead of using git-annex T1w labels as I originaly thought in my previous comment):

https://github.com/sct-pipeline/contrast-agnostic-softseg-spinalcord/blob/0d44b70b2d7848f3b31990fc61cd658e4468eba9/process_data.sh#L388-L389

Checking the corresponding log:

$ grep "sct_apply_transfo -i ./anat/sub-brnoUhb04_T2w_seg_labeled_discs.nii.gz -d ./anat/sub-brnoUhb04_T1w.nii.gz" ~/duke/projects/ivadomed/contrast-agnostic-seg/data_processed_sg_2023-03-10_NO_CROP/log/process_data_sub-brnoUhb04.log
+ sct_apply_transfo -i ./anat/sub-brnoUhb04_T2w_seg_labeled_discs.nii.gz -d ./anat/sub-brnoUhb04_T1w.nii.gz -w ./anat/warp_sub-brnoUhb04_T2w2sub-brnoUhb04_T1w.nii.gz -x label -o ./anat/sub-brnoUhb04_T1w_seg_labeled_discs.nii.gz

Something apparently happened during this transformation because the warped disc labels file (sub-brnoUhb04_T1w_seg_labeled_discs.nii.gz) is empty:

$ cd ~/duke/projects/ivadomed/contrast-agnostic-seg/data_processed_sg_2023-03-10_NO_CROP/data_processed/sub-brnoUhb04/anat
$ sct_label_utils -i sub-brnoUhb04_T2w_seg_labeled_discs.nii.gz -display

--
Spinal Cord Toolbox (git-master-a11e9f1f5675fe6f25f3aceda4ceb5d13ad07c59)

sct_label_utils -i sub-brnoUhb04_T2w_seg_labeled_discs.nii.gz -display
--

Position=(27,159,225) -- Value= 1.0
Position=(29,160,194) -- Value= 2.0
Position=(29,160,177) -- Value= 3.0
Position=(28,160,155) -- Value= 4.0
Position=(29,159,131) -- Value= 5.0
Position=(28,154,109) -- Value= 6.0
Position=(28,148,92) -- Value= 7.0
Position=(28,136,70) -- Value= 8.0
Position=(29,122,48) -- Value= 9.0
Position=(29,105,26) -- Value= 10.0
All labels (useful syntax):
27,159,225,1.0:29,160,194,2.0:29,160,177,3.0:28,160,155,4.0:29,159,131,5.0:28,154,109,6.0:28,148,92,7.0:28,136,70,8.0:29,122,48,9.0:29,105,26,10.0                                                               /1.5s

$ sct_label_utils -i sub-brnoUhb04_T1w_seg_labeled_discs.nii.gz -display

--
Spinal Cord Toolbox (git-master-a11e9f1f5675fe6f25f3aceda4ceb5d13ad07c59)

sct_label_utils -i sub-brnoUhb04_T1w_seg_labeled_discs.nii.gz -display
--

All labels (useful syntax):

It seems that the ./anat/warp_sub-brnoUhb04_T2w2sub-brnoUhb04_T1w.nii.gz warping field is corrupted. Maybe since T1w and T2w images are not aligned?

image
valosekj commented 11 months ago

Potential solution: use GT T1w labels from git-annex