jmtyszka / bidskit

Utility functions for working with DICOM and BIDS neuroimaging data
MIT License
61 stars 41 forks source link

Acquisition suffix is duplicated when multiple runs #120

Closed gauvinalexandre closed 1 year ago

gauvinalexandre commented 1 year ago

Bug Acquisition suffix is duplicated when we have multiple runs.

How to reproduce Here's the result when running the command bidskit -d my_project_name --no-sessions:

sub-t01/anat/sub-t01_acq-GREME_run-1_acq-GREME.nii.gz
sub-t01/anat/sub-t01_acq-GREME_run-2_acq-GREME.nii.gz
sub-t01/anat/sub-t01_acq-GREME_run-3_acq-GREME.nii.gz

Here's the correpsonding Protocol_Translator.json entry:

"GRE-ME": [
        "anat",
        "acq-GREME",
        "UNASSIGNED"
    ],

Expected behavior I think it should rather give the following:

sub-t01/anat/sub-t01_acq-GREME_run-1.nii.gz
sub-t01/anat/sub-t01_acq-GREME_run-2.nii.gz
sub-t01/anat/sub-t01_acq-GREME_run-3.nii.gz

Desktop

jmtyszka commented 1 year ago

Hi @gauvinalexandre This looks like something that can be fixed with a minor change in your Protocol_Translator.json file. With the exception of GRE fieldmaps, you'll always need to pass the BIDS pulse sequence/contrast suffix in the translator JSON. Try replacing this entry with:

"GRE-ME": [
        "anat",
        "acq-GREME_GREME",
        "UNASSIGNED"
    ],

If you have multiecho data, add --multiecho to the command line call:

bidskit -d my_project_name --no-sessions --multiecho
gauvinalexandre commented 1 year ago

Hi @jmtyszka, and thanks for your reply! I have tried your suggestion, and now I get the following result, which doesn't respect the BIDS specification:

sub-t01/anat/sub-t01_acq-GREME_run-1_GREME.nii.gz
sub-t01/anat/sub-t01_acq-GREME_run-2_GREME.nii.gz
sub-t01/anat/sub-t01_acq-GREME_run-3_GREME.nii.gz

Can you explain your suggestion, what is the sequence/contrast suffix, and why I have to repeat it? Why can't I get my expected result (below)?

sub-t01/anat/sub-t01_acq-GREME_run-1.nii.gz
sub-t01/anat/sub-t01_acq-GREME_run-2.nii.gz
sub-t01/anat/sub-t01_acq-GREME_run-3.nii.gz

To be clear, I have 3 distinct GRE-ME sequence runs, indeed, not field maps nor multiple echoes.

jmtyszka commented 1 year ago

Just to make sure we're referring to the same BIDS spec, here's the link to the MRI anatomic filename conventions: https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#anatomy-imaging-data

The pulse sequence/contrast suffix is the mandatory very last value in the BIDS filename and could be any of a short list of possible values, including T1w, bold, epi, etc. You'd generally use the acq-

If you have multiecho GRE data, the suffix would be MEGRE (we both got that the wrong way round - apologies for missing that). But you would then be forced to provide the echo number too in the filename, eg sub-t01_run-1_echo-2_MEGRE.nii.gz Are the images you're converting actually multiecho data (with separate echoes) or the results of some processing of multiecho data, such as the RMS across multiple echoes? dcm2niix should generate a 3D image for each echo time rather than a 4D image with echo number along the 4th dimension, allowing the echo- key to be generated by bidskit. Let me know a bit more about how your data is organized and we can get this fixed for you.

gauvinalexandre commented 1 year ago

I think I understand. Here's the translator JSON entry...

"GRE-ME": [
        "anat",
        "GREME",
        "UNASSIGNED"
    ],

... that gives me the following results:

sub-t01/anat/sub-t01_run-1_GREME.nii.gz
sub-t01/anat/sub-t01_run-2_GREME.nii.gz
sub-t01/anat/sub-t01_run-3_GREME.nii.gz

I was wrong expecting:

sub-t01/anat/sub-t01_acq-GREME_run-1.nii.gz
sub-t01/anat/sub-t01_acq-GREME_run-2.nii.gz
sub-t01/anat/sub-t01_acq-GREME_run-3.nii.gz

I think this is solved. Thank you for your help!

jmtyszka commented 1 year ago

Glad this works! Let me know if you have any other questions. Closing.