Skip to content

BIDS Specification

Youenn edited this page Jan 25, 2024 · 9 revisions

BIDS integration into Shanoir

BIDS official spec: https://bids-specification.readthedocs.io/en/latest/02-common-principles.html

Import from a BIDS folder

The import from a BIDS folder is no more available from the interface, as it's generally not relevant with huge datasets. We now propose the import from shanoir uploader.

Shanoir uploader will iterate over the files and import them into Shanoir step by step.

1) Modality agnostic files

README, dataset_decription and participants.tsv files are stored in study files. The can be updated manually by the user. They are not regenerated.

2) Subjects

For every subject folder encountered, a new subject is created in Shanoir. If we find more relevant information on subject (more than the name) in the participants.tsv file, then we can use it.

Following this criteria:

  • participant_id
  • sex (M/F)
  • birthdate (yyyy/mm/dd)
  • manual_hemispheric_dominance (LEFT/RIGHT/null)
  • language_hemispheric_dominance (LEFT/RIGHT/null)
  • imaged_object_category (PHANTOM/LIVING_HUMAN_BEING/HUMAN_CADAVER/ANATOMICAL_PIECE/LIVING_ANIMAL/ANIMAL_CADAVER).

3) Examinations

For every session folder, an examination is created (comment = session name). If there is no session folder, an unique examination is created for every subject.

If an examination file -> session.tsv file exists, and contains the examination date, then we set it. Otherwise, we use the file timestamp. Every other associated file will be kept in the examination extra-data files.

4) Dataset.

The data type folder informs us on the type of dataset we will be creating in Shanoir (all extending from BidsDataset) :

  • func -> MrBidsDataset
  • dwi -> MrBidsDataset
  • fmap -> MrBidsDataset
  • anat -> MrBidsDataset
  • perf -> MrBidsDataset
  • meg -> MeegBidsDataset
  • eeg -> EegBidsDataset
  • ieeg -> IeegBidsDataset
  • beh -> BehaviouralBidsDataset
  • pet -> PetBidsDataset
  • micr -> MicroscopyBidsDataset
  • nirs -> MrBidsDataset

We then create for every dataset file an adapted datasetExpression and and an adapted DatasetFile.

For every dataset file, the extension and file header is checked.

5) Equipment

The acquisition equipment will be automatically referenced from the json metadata files, if existing.

  • "DeviceSerialNumber" will be used to check for a match in Shanoir database.
  • If not existing, an "unknown" equipment will be used.

6) Derivatives / Codes

This part of the BIDS folder is not taken into account for the moment.

7) Others

We will ask the user to launch the BIDS validator on its folder before the import to check the folder's validity.

Storage

A BIDS structure is stored on the disk: datasets-data/bids-data. No DICOM in this structure.

BidsService (datasets) This class allows to create, destroy, update a BIDS folder, managing studies, subjects, exams.

There is a challenge to know what "kind" of data it is to know in which folder it has to go:

In BIDS, data is distributed between those folders types. This informations has to be stored during the import, because there is no strict rules allowing us to know which type of data we are using (this is usually specific to constructor and data). To set up this, the user can set it up in studyCards, using BidsDataType field (IRM related). Otherwise, the type of dataset defined the folder name.

Vizualisation

  1. Use of CompositObject pattern.

BidsElement => BidsFile

  1. Use of BidsDeserializer, creating a BidsElement tree from a BIDS folder.

  2. Display on the front this tree view alowing to download at every level.

Export

The export can be done from the detail of a study. It is possible to download an element at every branch of the tree (file or element).

Clone this wiki locally