Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Data formats clarification #1720

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -3214,6 +3214,14 @@
],
"login": "étienne_bergeron",
"name": "Étienne Bergeron"
},
{
"contributions": [
"code"
],
"login": "nbeliy",
"name": "Nikita Beliy"
"profile": "https://github.com/nbeliy"
nbeliy marked this conversation as resolved.
Show resolved Hide resolved
}
],
"contributorsPerLine": 7
Expand Down
33 changes: 19 additions & 14 deletions src/common-principles.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,20 +409,25 @@ datasets and non-compliant derivatives.

### Imaging files
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if this heading should not be renamed now that this section has become more generic.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used Imaging files as generic file, including for example EEG. I can't find a good name, data file will also incompass the tabular files. But I'm open for suggestions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I was more making a note also for other reviewers


All imaging data MUST be stored using the NIfTI file format. We RECOMMEND using
compressed NIfTI files (.nii.gz), either version 1.0 or 2.0. If using compressed files,
the gzip header SHOULD lack source filenames and timestamps. Imaging data SHOULD
be converted to the NIfTI format using a tool that provides as much of the NIfTI
header information (such as orientation and slice timing information) as
possible. Since the NIfTI standard offers limited support for the various image
acquisition parameters available in DICOM files, we RECOMMEND that users provide
additional meta information extracted from DICOM files in a sidecar JSON file
(with the same filename as the `.nii[.gz]` file, but with a `.json` extension).
Extraction of BIDS compatible metadata can be performed using [dcm2niix](https://github.com/rordenlab/dcm2niix)
and [dicm2nii](https://www.mathworks.com/matlabcentral/fileexchange/42997-xiangruili-dicm2nii)
DICOM to NIfTI converters. The [BIDS-validator](https://github.com/bids-standard/bids-validator)
will check for conflicts between the JSON file and the data recorded in the
NIfTI header.
All imaging data MUST be stored using BIDS-compatible file format, specified
in the respective section.
The conversion from original imaging data format to BIDS-compatible one, if it
is required, must be performed using a tool that conserves as much of original
metadata, as possible, at exception of information relative to the participant
identity, which should not be present in the converted image.

We RECOMMEND that the imaging file will be accompanied with a additional meta
information extracted from source image and/or external sources in a sidecar
JSON file.
Comment on lines +419 to +421
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For certain file the sidecar is REQUIRED so I would actually remove this sentence.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would agree if JSON sidecars was properly introduced in common principles. It is mentioned in several places, but without a proper definition. This paragraph tried to provide such definition.

If present, sidecar JSON filename MUST be same as as the imaging file, but
with a `.json` extension.

In some cases BIDS authorize to store compressed imaging files. In such cases
the compression must be performed using gzip algorithm, and have extension
`.gz`, for example `sub-123_T1w.nii.gz`.
The zip header SHOULD lack source filenames and timestamps, this can be
achieved by using `---name` option of gzip, or first renaming file, and then
compressing it.
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved

### Tabular files

Expand Down
35 changes: 35 additions & 0 deletions src/modality-specific-files/magnetic-resonance-imaging-data.md
nbeliy marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# Magnetic Resonance Imaging

## Data format

All MRI imaging data MUST be stored using the
[NIfTI-1 or NIFTI-2](https://nifti.nimh.nih.gov/) file format (`.nii`).
The ANALYZE-7.5 file format (`.hdr`/`.img`), despite being very similar to NIFTI-1,
is not allowed.
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved
Imaging data SHOULD be converted to the NIfTI format using a tool that provides
as much of the NIfTI header information (such as orientation and slice timing
information) as possible.

We RECOMMEND to use [dcm2niix](https://github.com/rordenlab/dcm2niix)
to convert source DICOM images to NIFTI-2 file format, as it extracts large
number of BIDS compatible metadata.
As alternative,
[dicm2nii](https://www.mathworks.com/matlabcentral/fileexchange/42997-xiangruili-dicm2nii)
and
[spm_dicom_convert](https://github.com/neurodebian/spm12/blob/master/spm_dicom_convert.m)
from
[spm12 package](https://github.com/neurodebian/spm12/tree/master) can be used
for conversion.

Multi-volume acquisitions (for example, 2D slices of anatomical MRI or 3D
volumes of functional MRI) MUST be concatenated into single image (3D or 4D,
respectively).
This can be performed by
[concat_images](https://nipy.org/nibabel/reference/nibabel.funcs.html) of
the Nibabel package or by
[spm_file_merge](https://github.com/spm/spm12/blob/main/spm_file_merge.m).

Due to the important size of MRI imaging data, we RECOMMEND using compressed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment about PET and recommending zipped data.

NIfTI files by [gzip](https://www.gzip.org/) algorithm (`.nii.gz`).
If using compressed files, the gzip header SHOULD lack source filenames and timestamps.
This can be achieved by using `--no-name` option of gzip, or by first renaming
original file to BIDS standard and then compressing.

## Common metadata fields

MR Data described in the following sections share the following RECOMMENDED metadata
Expand Down
43 changes: 39 additions & 4 deletions src/modality-specific-files/positron-emission-tomography.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,43 @@ and a guide for using macros can be found at
suffixes=["pet", "events", "physio", "stim"])
}}

PET data MUST be stored in the `pet` directory.
PET imaging data SHOULD be stored in 4D (or 3D, if only one volume was acquired)
NIfTI files with the `_pet` suffix.
Volumes MUST be stored in chronological order (the order they were acquired in).
### PET data format

All PET imaging data MUST be stored using the
[NIfTI-1 or NIFTI-2](https://nifti.nimh.nih.gov/) file format (`.nii`).
The ANALYZE-7.5 file format (`.hdr`/`.img`), despite being very similar to NIFTI-1,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's still needed. Is .hdr/.img popular in PET?

Copy link
Collaborator

@Remi-Gau Remi-Gau Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea but I am starting to think we should NOT mention things that are NOT allowed, because it could get very long.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mnoergaard might know :-)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For MRI is needed -- just saying NIFTI includes the .hdr/.img. And I know at least one attempt to bidsify such format.

is not allowed.
Imaging data SHOULD be converted to the NIfTI format using a tool that provides
as much of the NIfTI header information (such as orientation and slice timing
information) as possible.

We RECOMMEND to use [dcm2niix](https://github.com/rordenlab/dcm2niix),
version v1.0.20220720 or later to convert source DICOM images to NIFTI-2 file format,
as it extracts a number of PET-specific metadata in BIDS compatible format.
As alternative,
[dicm2nii](https://www.mathworks.com/matlabcentral/fileexchange/42997-xiangruili-dicm2nii)
and
[spm_dicom_convert](https://github.com/neurodebian/spm12/blob/master/spm_dicom_convert.m)
from
[spm12 package](https://github.com/neurodebian/spm12/tree/master) can be used
for conversion.
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved

Dynamic (multi-volume) PET imaging data SHOULD be stored in 4D,
in chronological order (the order they were acquired in).
The concatenation of volumes can be performed by
[concat_images](https://nipy.org/nibabel/reference/nibabel.funcs.html) of
the Nibabel package or by
[spm_file_merge](https://github.com/spm/spm12/blob/main/spm_file_merge.m).

Due to the important size of PET imaging data, we RECOMMEND using compressed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not actually officialy recommend (meaning that the validator would throw a warning if people use .nii and not .nii.gz)

Maybe "we suggest" or "we enourage".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation was carried from common principles:

We RECOMMEND using compressed NIfTI files

NIfTI files by [gzip](https://www.gzip.org/) algorithm (`.nii.gz`).
If using compressed files, the gzip header SHOULD lack source filenames and timestamps.
This can be achieved by using `--no-name` option of gzip, or by first renaming
original file to BIDS standard and then compressing.

### PET file naming

PET data MUST be stored in the `pet` directory with `_pet` suffix.

The OPTIONAL [`task-<label>`](../appendices/entities.md#task) is used to
indicate a task subjects were asked to perform in the scanner.
Expand Down Expand Up @@ -129,8 +162,10 @@ the same [`task-<label>`](../appendices/entities.md#task) entity SHOULD be used.
For further details, see
[Task (including resting state) imaging data](./magnetic-resonance-imaging-data.md#task-including-resting-state-imaging-data).

<!--
In addition to the imaging data (`*.nii`) a `_pet.json` sidecar file MUST be provided.
The included metadata are divided into sections described below.
-->
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented this paragraph, as it appears in incorrect section (JSON must be present no matter if it's pure PET of PET-MRI dataset). Also, the same information appears directly below.


### PET metadata

Expand Down