From 5ed9030849a98d0a004544b30bc410ee5916bf97 Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Wed, 24 Apr 2024 16:04:27 -0400 Subject: [PATCH 1/4] [ENH] Add noRF suffix for MR excitation-free noise scans (#1451) * Add noRF suffix. * Update src/schema/objects/suffixes.yaml Co-authored-by: Dan Handwerker <7406227+handwerkerd@users.noreply.github.com> * Update suffixes.yaml * Apply suggestions from code review Co-authored-by: Dan Handwerker <7406227+handwerkerd@users.noreply.github.com> * Update src/schema/objects/suffixes.yaml Co-authored-by: Yaroslav Halchenko * Update src/schema/objects/suffixes.yaml Co-authored-by: Yaroslav Halchenko * Update src/schema/objects/suffixes.yaml Co-authored-by: Yaroslav Halchenko * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update src/schema/objects/suffixes.yaml * Add modality entity to noRF. --------- Co-authored-by: Dan Handwerker <7406227+handwerkerd@users.noreply.github.com> Co-authored-by: Chris Markiewicz Co-authored-by: Yaroslav Halchenko Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- src/schema/objects/suffixes.yaml | 19 +++++++++++++++++++ src/schema/rules/files/raw/func.yaml | 8 ++++++++ 2 files changed, 27 insertions(+) diff --git a/src/schema/objects/suffixes.yaml b/src/schema/objects/suffixes.yaml index 0ddc8647d2..98e060af7d 100644 --- a/src/schema/objects/suffixes.yaml +++ b/src/schema/objects/suffixes.yaml @@ -687,6 +687,25 @@ nirs: value: nirs display_name: Near Infrared Spectroscopy description: Data associated with a Shared Near Infrared Spectroscopy Format file. +noRF: + value: noRF + display_name: No Radio Frequency Excitation Scan + description: | + An MR noise scan often acquired alongside another MR scan. + + These noise scans are acquired by disabling the radio frequency excitation, + while maintaining all other parameters from the associated scan. + These can be acquired using some other sequence with RF excitation removed + or as part of sequences that turns off RF at the beginning or end of a run. + For example a `bold` scan where a few volumes are acquired with RF off. + There is no consistent DICOM denotation for these scans. + + If multiple sequences with different suffixes but otherwise the same entities have `noRF` + sequences, they SHOULD be disambiguated using the modality entity + (for example, `mod-bold_noRF.nii.gz` and `mod-cbv_noRF.nii`). + + `noRF` are typically used to estimate properties of the scanner and + sequence that are independent from the object being imaged. optodes: value: optodes display_name: Optodes diff --git a/src/schema/rules/files/raw/func.yaml b/src/schema/rules/files/raw/func.yaml index 5e2c42b813..61a614bead 100644 --- a/src/schema/rules/files/raw/func.yaml +++ b/src/schema/rules/files/raw/func.yaml @@ -23,6 +23,14 @@ func: part: optional chunk: optional +norf: + $ref: rules.files.raw.func.func + suffixes: + - noRF + entities: + $ref: rules.files.raw.func.func.entities + modality: optional + phase: suffixes: - phase # deprecated From b5fd9387bfeaf5fd87516613568ca9ef0cc33a6d Mon Sep 17 00:00:00 2001 From: Matt Cieslak Date: Wed, 24 Apr 2024 16:11:28 -0400 Subject: [PATCH 2/4] [ENH][SCHEMA] Allow .bval and .bvec files for pepolar fmaps (#1754) * add epi.bval, epi.bvec * update contributors.md * add lines for sentence Co-authored-by: Taylor Salo * update preprocessed_data.yaml * override for m0scan * Update src/schema/rules/files/deriv/preprocessed_data.yaml Co-authored-by: Taylor Salo * Whitespace and table pipes * remove ref * Add EPI-with-b[val|vec] suffix checks. * Add EPI+bval check. * Remove Latin phrase. * Update src/schema/rules/checks/fmap.yaml Co-authored-by: Chris Markiewicz * Change max to min. * Address review. * Bump schema version. --------- Co-authored-by: Taylor Salo Co-authored-by: Taylor Salo Co-authored-by: Chris Markiewicz --- .../magnetic-resonance-imaging-data.md | 1 + src/schema/SCHEMA_VERSION | 2 +- src/schema/meta/associations.yaml | 4 ++-- src/schema/meta/context.yaml | 5 +++++ src/schema/rules/checks/dwi.yaml | 6 +++--- src/schema/rules/checks/fmap.yaml | 13 ++++++++++++ .../rules/files/deriv/preprocessed_data.yaml | 7 +++++++ src/schema/rules/files/raw/fmap.yaml | 20 +++++++++++++++++++ 8 files changed, 52 insertions(+), 6 deletions(-) diff --git a/src/modality-specific-files/magnetic-resonance-imaging-data.md b/src/modality-specific-files/magnetic-resonance-imaging-data.md index 072410f528..30a17b000e 100644 --- a/src/modality-specific-files/magnetic-resonance-imaging-data.md +++ b/src/modality-specific-files/magnetic-resonance-imaging-data.md @@ -1254,6 +1254,7 @@ EPI scans with different phase encoding directions to estimate the distortion map corresponding to the nonuniformities of the *B0* field. These `*_epi.nii[.gz]` - or `*_m0scan.nii[.gz]` for arterial spin labeling perfusion data - files can be 3D or 4D -- in the latter case, all timepoints share the same scanning parameters. +Some 4D scans intended for correcting DWIs may have accompanying `*_epi.bval` and `*_epi.bvec` files. Examples of software tools using these kinds of images are FSL TOPUP and AFNI `3dqwarp`. diff --git a/src/schema/SCHEMA_VERSION b/src/schema/SCHEMA_VERSION index d182dc9160..b1e9d95105 100644 --- a/src/schema/SCHEMA_VERSION +++ b/src/schema/SCHEMA_VERSION @@ -1 +1 @@ -0.8.1-dev +0.8.2-dev diff --git a/src/schema/meta/associations.yaml b/src/schema/meta/associations.yaml index f7dafed919..b55f746bf3 100644 --- a/src/schema/meta/associations.yaml +++ b/src/schema/meta/associations.yaml @@ -59,7 +59,7 @@ magnitude1: bval: selectors: - - suffix == 'dwi' + - intersects([suffix], ['dwi', 'epi']) - match(extension, '\.nii(\.gz)?$') target: extension: .bval @@ -67,7 +67,7 @@ bval: bvec: selectors: - - suffix == 'dwi' + - intersects([suffix], ['dwi', 'epi']) - match(extension, '\.nii(\.gz)?$') target: extension: .bvec diff --git a/src/schema/meta/context.yaml b/src/schema/meta/context.yaml index 4404e390ea..7f9ca1259c 100644 --- a/src/schema/meta/context.yaml +++ b/src/schema/meta/context.yaml @@ -183,6 +183,11 @@ context: n_rows: description: 'Number of rows in bval file' type: integer + values: + description: 'B-values contained in bval file' + type: array + items: + type: number bvec: description: 'B vector file' type: object diff --git a/src/schema/rules/checks/dwi.yaml b/src/schema/rules/checks/dwi.yaml index d0b71d9a2a..d575dee6d0 100644 --- a/src/schema/rules/checks/dwi.yaml +++ b/src/schema/rules/checks/dwi.yaml @@ -9,7 +9,7 @@ DWIVolumeCount: associated '.bvec' and '.bval' files. level: error selectors: - - suffix == "dwi" + - intersects([suffix], ["dwi", "epi"]) - '"bval" in associations' - '"bvec" in associations' - type(nifti_header) != "null" @@ -25,7 +25,7 @@ DWIBvalRows: '.bval' files should contain exactly one row of values. level: error selectors: - - suffix == "dwi" + - intersects([suffix], ["dwi", "epi"]) - '"bval" in associations' checks: - associations.bval.n_rows == 1 @@ -38,7 +38,7 @@ DWIBvecRows: '.bvec' files should contain exactly three rows of values. level: error selectors: - - suffix == "dwi" + - intersects([suffix], ["dwi", "epi"]) - '"bvec" in associations' checks: - associations.bvec.n_rows == 3 diff --git a/src/schema/rules/checks/fmap.yaml b/src/schema/rules/checks/fmap.yaml index af042351d8..b6e8e621cc 100644 --- a/src/schema/rules/checks/fmap.yaml +++ b/src/schema/rules/checks/fmap.yaml @@ -49,3 +49,16 @@ MagnitudeFileWithTooManyDimensions: - nifti_header != null checks: - nifti_header.dim[0] == 3 + +EPISmallBVals: + issue: + code: EPI_WITH_BVALS_NEEDS_SMALL_BVALS + message: | + EPI field maps with b-values should include small (b<100) values. + level: error + selectors: + - datatype == "fmap" + - suffix == "epi" + - '"bval" in associations' + checks: + - min(associations.bval.values) < 100 diff --git a/src/schema/rules/files/deriv/preprocessed_data.yaml b/src/schema/rules/files/deriv/preprocessed_data.yaml index 5503b20050..fb9da23f39 100644 --- a/src/schema/rules/files/deriv/preprocessed_data.yaml +++ b/src/schema/rules/files/deriv/preprocessed_data.yaml @@ -104,6 +104,13 @@ fmap_pepolar_common: space: optional description: optional +fmap_pepolar_m0scan: + $ref: rules.files.raw.fmap.pepolar_m0scan + entities: + $ref: rules.files.raw.fmap.pepolar.entities + space: optional + description: optional + fmap_TB1DAM_common: $ref: rules.files.raw.fmap.TB1DAM entities: diff --git a/src/schema/rules/files/raw/fmap.yaml b/src/schema/rules/files/raw/fmap.yaml index 056ed1d67e..79d5944feb 100644 --- a/src/schema/rules/files/raw/fmap.yaml +++ b/src/schema/rules/files/raw/fmap.yaml @@ -24,6 +24,26 @@ fieldmaps: pepolar: suffixes: - epi + extensions: + - .nii.gz + - .nii + - .json + - .bval + - .bvec + datatypes: + - fmap + entities: + subject: required + session: optional + acquisition: optional + ceagent: optional + direction: required + run: optional + part: optional + chunk: optional + +pepolar_m0scan: + suffixes: - m0scan extensions: - .nii.gz From cbb94e11dea2e6a94d9e68f6782494d3c36c9c79 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Thu, 25 Apr 2024 06:41:47 -0400 Subject: [PATCH 3/4] [MAINT] Update contributor table generator style (#1805) * chore(code-style): Rewrite f-strings in print_contributors.py to outrage flake8 less * chore(render): Rerender contributors.md * chore(style): Ignore linting errors in auto-generated table --- src/appendices/contributors.md | 13 +++++++------ tools/print_contributors.py | 20 +++++++++----------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/appendices/contributors.md b/src/appendices/contributors.md index 2ffab4740f..f48586f04d 100644 --- a/src/appendices/contributors.md +++ b/src/appendices/contributors.md @@ -37,6 +37,7 @@ ecosystem (in alphabetical order). If you contributed to the BIDS ecosystem and your name is not listed, please add it. + | name | contributions | | ---------------------------------------------------- | -------------------------------------- | @@ -121,7 +122,7 @@ If you contributed to the BIDS ecosystem and your name is not listed, please add | Dianne Patterson | πŸ“– | | Dimitri Papadopoulos Orfanos | πŸ“–πŸ’‘πŸ€”πŸ’¬πŸ’» | | Dmitry Petrov | πŸ“–πŸ’» | -| Dora Hermes | πŸ“–πŸ’»βœ…πŸ”πŸ€” | +| Dora Hermes | πŸ“–πŸ’»βœ…πŸ”πŸ€” | | Dorien Huijser | πŸ“– | | Douglas N. Greve | πŸ“– | | Duncan Macleod | πŸ“–πŸš‡ | @@ -194,7 +195,7 @@ If you contributed to the BIDS ecosystem and your name is not listed, please add | Jeanette Mumford | πŸ“– | | Jefferson Casimir | πŸ”§ | | Jeffrey G. Ojemann | πŸ“– | -| Jeffrey S. Grethe | πŸ’¬πŸ›βœ…πŸ“’πŸ’» | +| Jeffrey S. Grethe | πŸ’¬πŸ›βœ…πŸ“’πŸ’» | | JegouA | πŸ’» | | Jelle Dalenberg | πŸ“– | | Jeremy Moreau | πŸ“–πŸ’‘ | @@ -211,7 +212,7 @@ If you contributed to the BIDS ecosystem and your name is not listed, please add | Jose Manuel Saborit | πŸ“– | | Joseph Wexler | πŸ“–πŸ’‘ | | Joseph Woods | πŸ“– | -| Julia Guiomar Niso GalΓ‘n | πŸ€”πŸŽ¨πŸ”πŸ‘€πŸ“‹πŸ“πŸ”§πŸ›πŸ’»πŸ”£βœ…πŸ’¬πŸ“–πŸ’‘πŸ“’ | +| Julia Guiomar Niso GalΓ‘n | πŸ€”πŸŽ¨πŸ”πŸ‘€πŸ“‹πŸ“πŸ”§πŸ›πŸ’»πŸ”£βœ…πŸ’¬πŸ“–πŸ’‘πŸ“’ | | Julia Sprenger | πŸ“– | | Julien Cohen-Adad | πŸ“–πŸ”£πŸ€” | | Julius Welzel | πŸ“–πŸ’‘πŸ›πŸ’»πŸ”£πŸ€”πŸ’¬πŸ““ | @@ -269,7 +270,7 @@ If you contributed to the BIDS ecosystem and your name is not listed, please add | Michael Hanke | πŸ“–πŸ€”πŸ”§πŸ›πŸ“’ | | Michael P. Harms | πŸ“–βš οΈπŸ”§ | | Michael P. Milham | πŸ’‘πŸ” | -| Michael P. Notter | πŸ’¬πŸ“βœ…πŸ“’πŸ“– | +| Michael P. Notter | πŸ’¬πŸ“βœ…πŸ“’πŸ“– | | Michael Schirner | πŸ“– | | MikaΓ«l Naveau | πŸ› | | Nader Pouratian | πŸ“– | @@ -288,7 +289,7 @@ If you contributed to the BIDS ecosystem and your name is not listed, please add | Patricia Clement | πŸ’¬πŸ›πŸ’»πŸ“–πŸ”£πŸ’‘πŸ“‹πŸ€”πŸ“†βš οΈπŸ“’ | | Patrick Park | πŸ“–πŸ’‘πŸ’¬πŸ’» | | Paule-Joanne Toussaint | πŸ“– | -| Peer Herholz | πŸ’¬πŸ“–πŸ‘€πŸ”§βœ…πŸ“’ | +| Peer Herholz | πŸ’¬πŸ“–πŸ‘€πŸ”§βœ…πŸ“’ | | Petra Ritter | πŸ“– | | Pierre Rioux | πŸ“– | | Pieter Vandemaele | πŸ“–πŸ’» | @@ -318,7 +319,7 @@ If you contributed to the BIDS ecosystem and your name is not listed, please add | Shashank Bansal | πŸ“– | | Sjoerd B. Vos | πŸ“– | | Soichi Hayashi | πŸ“–πŸ”§πŸ› | -| Stefan Appelhoff | πŸ“–πŸ’¬πŸ€”πŸ›πŸ’‘πŸ’»πŸ‘€βš οΈπŸ“’βœ…πŸ”§πŸ”ŒπŸ“πŸš§πŸ”£ | +| Stefan Appelhoff | πŸ“–πŸ’¬πŸ€”πŸ›πŸ’‘πŸ’»πŸ‘€βš οΈπŸ“’βœ…πŸ”§πŸ”ŒπŸ“πŸš§πŸ”£ | | Stephan Bickel | πŸ“– | | Steven Meisler | πŸ›πŸ’»πŸ’¬πŸ”§πŸ““ | | Suyash Bhogawar | πŸ“–πŸ’‘βš οΈπŸ”§πŸ’¬ | diff --git a/tools/print_contributors.py b/tools/print_contributors.py index c49ca6f823..29db86a39c 100644 --- a/tools/print_contributors.py +++ b/tools/print_contributors.py @@ -15,8 +15,9 @@ def contributor_table_header(max_name_length, max_contrib_length): - return f"""| name{" " * (max_name_length-4)} | contributions{" " * (max_contrib_length-13)} | -| {"-" * max_name_length} | {"-"*max_contrib_length} | + return f"""\ +| {"name":<{max_name_length}} | {"contributions":<{max_contrib_length}} | +| {"":-<{max_name_length}} | {"":-<{max_contrib_length}} | """ @@ -24,16 +25,13 @@ def create_line_contributor( contributor: dict[str, str], max_name_length: int, max_contrib_length: int ): name = contributor["name"] + emap = emoji_map() + contributions = "".join( + emoji.emojize(emap[cont]) for cont in contributor["contributions"] + ) - line = f"| {name}{' '*(max_name_length-len(name))} | " - - nb_contrib = len(contributor["contributions"]) * 2 - for contrib in contributor["contributions"]: - line += emoji.emojize(emoji_map()[contrib]) - - line += f"{' '*(max_contrib_length-nb_contrib)} |\n" - - return line + pad = max_contrib_length - len(contributor["contributions"]) * 2 + return f"| {name:<{max_name_length}} | {contributions}{'':<{pad}} |\n" def main(): From 90ec07f1e8357d1ba209570fdac3a1394a9d677b Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 25 Apr 2024 14:55:51 -0400 Subject: [PATCH 4/4] [FIX] Move `rawdata/` into `sourcedata/raw` in alternative structure example, clarify on naming of datasets themselves (#1741) * RF: move `rawdata/` to `sourcedata/raw` in an example + make overall dataset to be BIDS dataset This is my take on an extended discussion about ambiguity of `rawdata/` example: https://github.com/bids-standard/bids-specification/pull/1734/files#r1534475631 * Minor rewording in description of sourcedata/ content Prior one bundled naming aspect under the same MUST. I separated into separate sentences, added explicit statement that BIDS does not prescribe a particular naming scheme for source data. And added explicit RECOMMENDED on the example how to organize/name files there. * Add one dataset_description.json into an example to make it explicitly a BIDS dataset * My take on dataset naming common principle * [DATALAD RUNCMD] Replace use of rawdata in tests with explicit 'noncompliant' === Do not change lines below === { "chain": [], "cmd": "sed -i -e s,rawdata,noncompliant,g tools/schemacode/bidsschematools/validator.py tools/schemacode/bidsschematools/tests/test_validator.py tools/schemacode/bidsschematools/tests/data/expected_bids_validator_xs_write.log", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ * Do not use e.g. * Move dataset_description.json in the example to be listed after folders * Remove the notion that example layout can in fact be a valid BIDS dataset * Use lower case "recommended" as not part of BIDS spec, and recommend underscores too * Make into a single sentence Co-authored-by: Chris Markiewicz --------- Co-authored-by: Chris Markiewicz --- src/common-principles.md | 53 ++++++++++--------- .../data/expected_bids_validator_xs_write.log | 2 +- .../bidsschematools/tests/test_validator.py | 4 +- tools/schemacode/bidsschematools/validator.py | 2 +- 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/common-principles.md b/src/common-principles.md index 9b10ba19f2..3d9bc233af 100644 --- a/src/common-principles.md +++ b/src/common-principles.md @@ -97,6 +97,12 @@ and/or files (like `events.tsv`) are fully omitted *when they are unavailable or instead of specified with an `n/a` value, or included as an empty file (for example an empty `events.tsv` file with only the headers included). +## Dataset naming + +BIDS does not prescribe a particular naming scheme for directories containing individual BIDS datasets. +However, it is recommended to use a short descriptive name that reflects the content of the dataset, avoid spaces in the name, and use hyphens or underscores to separate words. +BIDS datasets embedded within a larger BIDS dataset MAY follow some convention (see for example [Storage of derived datasets](#storage-of-derived-datasets)). + ## Filesystem structure Data for each subject are placed in subdirectories named "`sub-