neuropoly / template

A framework for creating unbiased MRI templates of the spinal cord
MIT License
5 stars 3 forks source link

Subject straightening in `preprocess_normalize.py` requires either SC mask NIFTI file or centerline NIFTI file #68

Closed NadiaBlostein closed 11 months ago

NadiaBlostein commented 11 months ago

Code

Master branch, preprocess_normalize.py

Issue

Subject straightening in preprocess_normalize.py straighten_all_subjects() method requires either SC mask NIFTI file (*_label-SC_mask.nii.gz) or centerline NIFTI file (*_label-centerline.nii.gz) , lines 476 to 491.

Currently, the generate_centerline() method generates centerlines for every subject, whether they have a SC mask or not. However, this method does not save the centerline files in NIFTI format. Therefore, straighten_all_subjects() method throws an error for subjects that do not have a SC mask in NIFTI file.

Solution

1) If the subject does not have a SC mask NIFTI file (*_label-SC_mask.nii.gz), check if it has a centerline NIFTI file (*_label-centerline.nii.gz) and use that instead. 2) If the subject does not have a SC mask NIFTI file (*_label-SC_mask.nii.gz) or a centerline NIFTI file (*_label-centerline.nii.gz), generate subject centerline and save the centerline NIFTI file (*_label-centerline.nii.gz).

rohanbanerjee commented 11 months ago

This issue is solved by merging #69 . Closing it therefore.