BIDS lesion mask specification

Hi all,

I’m working on a couple longitudinal studies which use manually drawn lesion masks. I’m having a hard time getting the data organized correctly in BIDS (1.0.1) with this setup (multiple sessions/T1s, only one lesion mask) and am a bit confused about how the mask needs to be specified.

From the fmriprep documentation page, I thought it just needed to be in the same directory as the T1 like this:
sub-x
ses-y
anat
sub-x_ses-y_T1w.nii
sub-x_ses-y_T1w_label-lesion_roi.nii

From the BIDS extension documentation I got the impression that I needed it to go in a separate derivatives/ parent folder and/or have the _space-orig delineation, but I haven’t been able to find a combination of any of the options I came across that would pass validation via http://bids-standard.github.io/bids-validator/.

Is this setup possible (would like to create an unbiased T1 and incorporate the one mask for normalization), and if so how?

Sorry if I’m missing something obvious, the documentation is thorough so I’m sure that’s the case.

Thank you!
James

Hi James

yes, lesions should go into derivatives, is this combination works?:
sub-x
ses-y
anat
sub-x_ses-y_T1w.nii

derivatives/sub-x
derivatives/ses-y
derivatives/anat
derivatives/sub-x_ses-y_T1w_label-lesion_roi.nii

cyril

Hi James,

Lesion masks are one place we haven’t updated fMRIPrep to conform to the BIDS Derivatives release candidate. For now, you should use the old filename, which I believe should still work.

Chris

Hi,

I’m trying to run fmriprep with lesion masks located in the “study/sub-x/ses-y/anat/ sub-x_ses-y_T1w_label-lesion_roi.nii.gz” format, but get an error at the validator:

   1: [ERR] Files with such naming scheme are not part of BIDS specification. This error is most commonly caused by typos in file names that make them not BIDS compatible. Please consult the specification and make sure your files are named correctly. If this is not a file naming issue (for example when including files not yet covered by the BIDS specification) you should include a ".bidsignore" file in your dataset (see https://github.com/bids-standard/bids-validator#bidsignore for details). Please note that derived (processed) data should be placed in /derivatives folder and source data (such as DICOMS or behavioural logs in proprietary formats) should be placed in the /sourcedata folder. (code: 1 - NOT_INCLUDED)
            ./sub-md001/ses-01/anat/sub-md001_ses-01_T1w_label-lesion_roi.nii.gz
                    Evidence: sub-md001_ses-01_T1w_label-lesion_roi.nii.gz
            ./sub-md001/ses-02/anat/sub-md001_ses-02_T1w_label-lesion_roi.nii.gz
                    Evidence: sub-md001_ses-02_T1w_label-lesion_roi.nii.gz
            ./sub-md001/ses-03/anat/sub-md001_ses-03_T1w_label-lesion_roi.nii.gz
                    Evidence: sub-md001_ses-03_T1w_label-lesion_roi.nii.gz

    2: [ERR] Ses label contain an Illegal Character hyphen or underscore. Please edit the filename as per BIDS spec. (code: 63 - SESSION_VALUE_CONTAINS_ILLEGAL_CHARECTER)
            ./sub-md001/ses-01/anat/sub-md001_ses-01_T1w_label-lesion_roi.nii.gz
                    Evidence: ses name contains illegal character:/sub-md001/ses-01/anat/sub-md001_ses-01_T1w_label-lesion_roi.nii.gz
            ./sub-md001/ses-02/anat/sub-md001_ses-02_T1w_label-lesion_roi.nii.gz
                    Evidence: ses name contains illegal character:/sub-md001/ses-02/anat/sub-md001_ses-02_T1w_label-lesion_roi.nii.gz
            ./sub-md001/ses-03/anat/sub-md001_ses-03_T1w_label-lesion_roi.nii.gz
                    Evidence: ses name contains illegal character:/sub-md001/ses-03/anat/sub-md001_ses-03_T1w_label-lesion_roi.nii.gz

    Summary:                 Available Tasks:        Available Modalities:
    424 Files, 8.77GB        rest                    T1w
    52 - Subjects                                    bold
    4 - Sessions                                     roi

If you have any questions please post on https://neurostars.org/tags/bids

Making sure the input data is BIDS compliant (warnings can be ignored in most cases).
Traceback (most recent call last):
File “/usr/local/miniconda/bin/fmriprep”, line 11, in
sys.exit(main())
File “/usr/local/miniconda/lib/python3.6/site-packages/fmriprep/cli/run.py”, line 353, in main
validate_input_dir(exec_env, opts.bids_dir, opts.participant_label)
File “/usr/local/miniconda/lib/python3.6/site-packages/fmriprep/cli/run.py”, line 534, in validate_input_dir
subprocess.check_call([‘bids-validator’, bids_dir, ‘-c’, temp.name])
File “/usr/local/miniconda/lib/python3.6/subprocess.py”, line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘bids-validator’, ‘/data/cephfs/punim0185/midas_ordered_bids’, ‘-c’, ‘/tmp/tmp046z55tr’]’ returned non-zero exit status 1.

I don’t believe the bids-validator is aware of lesion files at this time. If these are the only errors that you are getting you might try running fmriprep --skip_bids_validation option.

1 Like

Hi all,

I see that this is an older conversation, so I wanted to ask a follow up question- I was wondering if there have been any updates regarding the best way to store lesion masks in BIDS? I have been following the same format as above:
sub-x
ses-y
anat
sub-x_ses-y_T1w.nii
sub-x_ses-y_T1w_label-lesion_roi.nii
But it seems that the BIDS Validator v1.5.2 is still not aware of lesion files and it returns an error when lesion files are named this way. Please let me know if there is a more recent accepted method for storing lesion masks in BIDS.
Thanks!

Hi @jsim

Welcome to NeuroStars and thank you for your question! BIDS is preparing to extend into common derivatives with masks specified! We are planning to release this week - although the validator will take a bit longer to enhance.

Thank you,
Franklin

1 Like

Based on the BIDS derivatives documentation, I’ve been storing them like this for tracing in T1w space:

<bids_dir>/derivatives/lesions/<participant_id>/<participant_id>_space-T1w_desc-lesion_mask.nii.gz

and like this after registration:

<bids_dir>/derivatives/lesions/<participant_id>/<participant_id>_space-MNI152NLin2009cAsym_desc-lesion_mask.nii.gz

my code toolbox for registration and tracing is here (feel free to fork/modify/etc…): https://github.com/bchcohenlab/bids_lesion_code

1 Like