ivadomed / utilities

Repository containing utility scripts for handling various aspects in a DL model training pipeline
MIT License
8 stars 0 forks source link

BIDS subject number lost in conversion to nnUNet dataset format #10

Closed rohanbanerjee closed 1 year ago

rohanbanerjee commented 1 year ago

The issue

When we use this script to convert the dataset from BIDS to nnUNet (v2) format, the original subject name is changed into the nnUNet format like this for example: sub-xxxR48 --> xxx_002_0000. The issue with this is that the subject number in BIDS, which is 48 in the example, is not always equal to the id in the nnUNet dataset, which is 002 in the example. This makes it difficult to backtrack in subject specific issues.

Potential solution

We can save an extra json/text file which can basically record the BIDS to nnUNet data mapping for subject-wise further analysis.

naga-karthik commented 1 year ago

Thanks for raising this issue! I had this problem myself and I worked around it by saving the subject id and the session within the file name (for e.g. tSCIZurichRaw_sub-zh05_ses-01_005_0000.nii.gz, tSCIZurichRaw_sub-zh66_ses-01_058_0000.nii.gz, etc.). From what I understood, what nnUNet needs is the input files to be of the format <task-name>_xxx_xxxx.nii.gz. So, I basically updated the filename in this line to include the BIDS-wise subject and session as well as shown in the two examples above.

naga-karthik commented 1 year ago

Closing this as it seems that the issue is resolved!