BIDS export does not pass BIDS validator

Hi Martin,
I am trying to use the BIDS export on a brainstorm dataset and I get the following error when I try to validate the BIDS dataset on OpenNeuro:

Location:

/sub-0001/ses-20140502/anat/sub-0001_ses-20140502_T1w.nii

FILE METADATA:

16777.568 KB |

REASON:
_T1w.nii[.gz] files must have exactly three dimensions.

EVIDENCE:

this T1w file does not have exactly three dimensions.

Any advice?

Hi Guys,
It seems that you are not creating NIFTI files according to the BIDS format. See this discussion: https://github.com/bids-standard/bids-validator/issues/565.
In the function out_mri_nii, line 103, you have dimension=4. This causes the dataset to have errors when validating. I changed it to 3 and now it works...for what that is worth.

Beth

Hi Beth!

Thanks for looking into this. So the BIDS specification is strict about Nifti dimensions in the header: if there is a single time point, it should be flagged as a 3D file and not 4D. I modified that line in out_mri_nii like you suggested: https://github.com/brainstorm-tools/brainstorm3/commit/8f123933d4963db56fefb6c2489de3b3f6ae9324

You made my life easy, thanks!

Martin

2 Likes

Hi Martin,
I just completed the successful export of my dataset to BIDS and upload to OpenNeuro. This really is a great addition to Brainstorm. I would make just two suggestions. 1). In the dataset_description.json, if the author is missing, OpenNeuro fails to make a DOI on the dataset. Might want to make this clear or at the very least include it in the json as an empty string. 2). Maybe you could have the option to use a defaced MRI in the export. I was happy to see that I could get defaced MRI's but after the export to BIDS, I had to manually go back and deface them and export them to the BIDS dataset.
Just some suggestions. Great work!

Beth

Hi Beth,

Thank you for the kind words and the valuable feedback. I added an empty AUTHORS field in the dataset_description.json, and added a checkbox in the process options to deface the MRI beforehand. If this option is checked and multiple MRIs are present including a defaced one (identified with the " | deface" suffix), it does not deface it again but rather just exports the defaced one.

One drawback is that there is an extra user interaction required towards the beginning of the export process which is to choose which software to use for defacing (SPM vs Freesurfer). I guess to alleviate this you could make a pipeline first with the MRI deface process, which gives you all options including the software to use, followed by the export to BIDS process.

Let me know if you have more ideas!

Martin

Hi Martin,

I tried to export a BST protocol to BIDS, checking the deface option. In the final BIDS-folder the original MRIs are saved, even though the defacing was successful: they were saved in the database (MRI | deface). When I run the exporter a second time it does not deface again, but still saves the original MRIs in the BIDS folder. I'm using the Brainstorm version at the BIC (/meg/meg1)

Peter

It seems like if all MRIs are already defaced, then "defaceMRI" will be set to 0, here:

and then they're not exported as defaced. I must have already run it once before.

Thanks for the report Peter, well spotted. It should be fixed in the following commit: https://github.com/brainstorm-tools/brainstorm3/commit/2b7227db8350b7b61f74f4e5d250899928cd3539

Thanks,
Martin