spinalcordtoolbox / PAM50-normalized-metrics

Spinal cord morphometry in the PAM50 template space
2 stars 0 forks source link

CSV files in the r20230221 release have different number of lines #4

Closed valosekj closed 1 year ago

valosekj commented 1 year ago

CSV files in the r20230221 release have a different number of lines, e.g.:

$ cd data_normalize_metric_pam50
$ for file in sub-*;do echo $file;cat $file | wc -l;done                       
sub-amu01_T2w_PAM50.csv
     364
sub-amu02_T2w_PAM50.csv
     413
...

This is caused by omitting the -vert 1:20 flag for the sct_process_segmentation command:

sct_process_segmentation -i ${file_t2_seg}.nii.gz -vertfile ${file_t2_seg}_labeled.nii.gz -perslice 1 -normalize-PAM50 1 -o ${PATH_RESULTS}/${file_t2/_RPI_r/}_PAM50.csv

(source)

The different number of lines consequently causes an error in sct_compute_compression.py script during averaging of all CSV files (line 298).

valosekj commented 1 year ago

Usage of the -v 2 flag preserves the same number of lines across subjects; see here.

Implemented in https://github.com/sct-pipeline/dcm-metric-normalization/commit/cfce6bb845f6551fc6ee214726d80bbc067d0571.