Skip to content

Commit

Permalink
Merge branch 'master' into dwi_scanner_derivatives
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies authored Aug 29, 2024
2 parents a4d10f1 + 77ad779 commit bee4b16
Show file tree
Hide file tree
Showing 66 changed files with 2,041 additions and 650 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/publish_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: "Publish schema"

on:
push:
branches:
- "master"
tags:
- "schema-*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

env:
GIT_AUTHOR_NAME: BIDS CI
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: BIDS CI
GIT_COMMITTER_EMAIL: [email protected]

permissions:
contents: write
id-token: write

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
filter: "blob:none"
- uses: actions/setup-python@v5
with:
python-version: 3
- name: Install bidsschematools
run: |
pip install --upgrade tools/schemacode
git clean -fxd tools/schemacode
- name: Checkout jsr-dist
run: |
git checkout -t origin/jsr-dist
- name: Regenerate schema
run: bst export > schema.json
- name: Regenerate context types
run: |
jq .meta.context schema.json \
| npx quicktype --src-lang schema --lang ts -t Context --just-types \
> context.ts
- name: Regenerate metaschema types
run: |
# Name the file schema so the type will be named Schema
bst export-metaschema > /tmp/schema.json
npx --package=json-schema-to-typescript json2ts --unknownAny /tmp/schema.json > metaschema.ts
- name: Determine next version
run: |
BASE=$( jq -r .schema_version schema.json )
if [[ "$BASE" =~ ^[0-9]*.[0-9]*.[0-9]*$ ]]; then
# Release, so unconditionally update version
VERSION=$BASE
jq ".version = \"$VERSION\"" jsr.json > tmp.json && mv tmp.json jsr.json
else
DENOVER=$( jq -r .version jsr.json )
# Get the reference of the latest commit to touch the schema directory
HASH=$( git log -n 1 --pretty=%h $REF -- src/schema )
if [[ $DENOVER =~ ^"$BASE".[0-9] ]]; then
PREFIX=${DENOVER%+*}
let SERIAL=1+${PREFIX#$BASE.}
else
SERIAL=1
fi
VERSION="$BASE.$SERIAL+$HASH"
fi
echo VERSION=$VERSION | tee -a $GITHUB_ENV
env:
REF: ${{ github.ref }}
- name: Check for changes, set version and commit
run: |
if ! git diff -s --exit-code; then
jq ".version = \"$VERSION\"" jsr.json > tmp.json && mv tmp.json jsr.json
git add jsr.json schema.json context.ts metaschema.ts
git commit -m "Update schema JSR distribution"
git push
fi
- name: Publish to JSR
if: success()
run: |
npx jsr publish
2 changes: 1 addition & 1 deletion .github/workflows/schemacode_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: "Install build dependencies"
run: pip install --upgrade build twine
- name: "Install test dependencies on tag"
run: pip install --upgrade tools/schemacode[test]
run: pip install --upgrade tools/schemacode[tests]
if: ${{ startsWith(github.ref, 'refs/tags/schema-') }}
- name: "Build archive on tag"
run: pytest tools/schemacode/bidsschematools -k make_archive
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
- id: check-added-large-files
- id: check-case-conflict
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.1
rev: 0.29.2
hooks:
- id: check-dependabot
- id: check-github-workflows
Expand All @@ -25,7 +25,7 @@ repos:
- id: check-readthedocs
files: readthedocs.yml
- repo: https://github.com/psf/black
rev: 24.4.2
rev: 24.8.0
hooks:
- id: black
files: ^tools/(?!schemacode)
Expand All @@ -45,7 +45,7 @@ repos:
files: tools/schemacode
args: ["--settings-file", "tools/schemacode/pyproject.toml"]
- repo: https://github.com/pyCQA/flake8
rev: 7.1.0
rev: 7.1.1
hooks:
- id: flake8
args: [--config=tools/schemacode/setup.cfg]
Expand All @@ -67,7 +67,7 @@ repos:
- id: codespell
args: ["--config=.codespellrc", "--dictionary=-", "--dictionary=.codespell_dict"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.0
rev: v1.11.2
hooks:
- id: mypy
# Sync with project.optional-dependencies.typing
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ BIDS currently supports the following data modalities with more to come in the f
- microscopy
- NIRS
- motion
- MRS

# Formatting your data with BIDS

Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ nav:
- Microscopy: modality-specific-files/microscopy.md
- Near-Infrared Spectroscopy: modality-specific-files/near-infrared-spectroscopy.md
- Motion: modality-specific-files/motion.md
- Magnetic Resonance Spectroscopy: modality-specific-files/magnetic-resonance-spectroscopy.md
- Derivatives:
- BIDS Derivatives: derivatives/introduction.md
- Common data types and metadata: derivatives/common-data-types.md
Expand Down
2 changes: 1 addition & 1 deletion src/appendices/arterial-spin-labeling.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ For (P)CASL, specifying the `LabelingDuration` and the `PostLabelingDelay` is re
The `LabelingDuration` is defined as the total duration of the labeling pulse train in seconds.
`PostLabelingDelay` is the time in seconds after the end of the labeling until the middle of the excitation pulse applied
to the imaging slab (for 3D acquisition) or first slice (for 2D acquisition).
Additionally, the `BackgroundSuppressionPulseTime`'s is required in case `BackgroundSuppression` was applied.
Additionally, the `BackgroundSuppressionPulseTime` is RECOMMENDED if `BackgroundSuppression` was applied.
This an array of numbers containing the timing in seconds of the background suppression pulses
with respect to the start of the labeling.
In the case of `PCASL`, the recommended `PCASLType` field defines the type of the gradient pulses
Expand Down
1 change: 1 addition & 0 deletions src/appendices/contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ If you contributed to the BIDS ecosystem and your name is not listed, please add
| Alexander Jones | 💻🐛 |
| Alexander L. Cohen | 🐛💻📖💬 |
| Alexander von Lautz | 📖 |
| Alexandre D'Astous | 📖 |
| Alexandre Gramfort | 📖💡 |
| Alexandre Hutton | 📖 |
| Alexandre Routier | 📖 |
Expand Down
7 changes: 7 additions & 0 deletions src/appendices/cross-modality-correspondence.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ The reason for this is that the MRI needs to be corrected for nonlinear gradient
in order to fit the accompanying PET scans for co-registration
(Knudsen et al. 2020, [doi:10.1177/0271678X20905433](https://doi.org/10.1177/0271678X20905433);
Norgaard et al. 2019, [doi:10.1016/j.neuroimage.2019.05.055](https://doi.org/10.1016/j.neuroimage.2019.05.055)).

## MRS-MRI correspondence

It is typical to acquire high-resolution 3D anatomical MR images alongside MRS data for
voxel/slab placement, co-registration, and partial-volume tissue correction of metabolite concentrations.
To avoid incorrectly matching an MRS dataset with a corresponding anatomical MR image,
it is RECOMMENDED that the field `AnatomicalImage` be included in the MRS sidecar JSON files.
13 changes: 9 additions & 4 deletions src/appendices/qmri.md
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,15 @@ The nominal FA value of the SE pulse is twice this value.
Note that the following metadata fields MUST be defined in the accompanying JSON
files:

| **Field name** | **Definition** |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `TotalReadoutTime` | The effective readout length defined as `EffectiveEchoSpacing * PEReconMatrix`, with `EffectiveEchoSpacing = TrueEchoSpacing / PEacceleration` |
| `MixingTime` | Time interval between the SE and STE pulses |
<!-- This block generates a metadata table.
These tables are defined in
src/schema/rules/sidecars
The definitions of the fields specified in these tables may be found in
src/schema/objects/metadata.yaml
A guide for using macros can be found at
https://github.com/bids-standard/bids-specification/blob/master/macros_doc.md
-->
{{ MACROS___make_sidecar_table("fmap.TB1EPI") }}

To properly identify constituents of this particular method, values of the `echo`
entity MUST index the images as follows:
Expand Down
69 changes: 45 additions & 24 deletions src/appendices/units.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,51 @@ Examples for CMIXF-12 (including the five unicode symbols mentioned above):

### Multiples

| **Prefix name** | **Prefix symbol** | **Factor** |
| ------------------------------------------- | ----------------- | --------------- |
| [deca](https://www.wikiwand.com/en/Deca-) | da | 10<sup>1</sup> |
| [hecto](https://www.wikiwand.com/en/Hecto-) | h | 10<sup>2</sup> |
| [kilo](https://www.wikiwand.com/en/Kilo-) | k | 10<sup>3</sup> |
| [mega](https://www.wikiwand.com/en/Mega-) | M | 10<sup>6</sup> |
| [giga](https://www.wikiwand.com/en/Giga-) | G | 10<sup>9</sup> |
| [tera](https://www.wikiwand.com/en/Tera-) | T | 10<sup>12</sup> |
| [peta](https://www.wikiwand.com/en/Peta-) | P | 10<sup>15</sup> |
| [exa](https://www.wikiwand.com/en/Exa-) | E | 10<sup>18</sup> |
| [zetta](https://www.wikiwand.com/en/Zetta-) | Z | 10<sup>21</sup> |
| [yotta](https://www.wikiwand.com/en/Yotta-) | Y | 10<sup>24</sup> |
| **Prefix name** | **Prefix symbol** | **Factor** |
| --------------- | ----------------- | --------------- |
| [deca][] | da | 10<sup>1</sup> |
| [hecto][] | h | 10<sup>2</sup> |
| [kilo][] | k | 10<sup>3</sup> |
| [mega][] | M | 10<sup>6</sup> |
| [giga][] | G | 10<sup>9</sup> |
| [tera][] | T | 10<sup>12</sup> |
| [peta][] | P | 10<sup>15</sup> |
| [exa][] | E | 10<sup>18</sup> |
| [zetta][] | Z | 10<sup>21</sup> |
| [yotta][] | Y | 10<sup>24</sup> |

### Submultiples

| **Prefix name** | **Prefix symbol** | **Factor** |
| ------------------------------------------- | ----------------- | ---------------- |
| [deci](https://www.wikiwand.com/en/Deci-) | d | 10<sup>-1</sup> |
| [centi](https://www.wikiwand.com/en/Centi-) | c | 10<sup>-2</sup> |
| [milli](https://www.wikiwand.com/en/Milli-) | m | 10<sup>-3</sup> |
| [micro](https://www.wikiwand.com/en/Micro-) | u | 10<sup>-6</sup> |
| [nano](https://www.wikiwand.com/en/Nano-) | n | 10<sup>-9</sup> |
| [pico](https://www.wikiwand.com/en/Pico-) | p | 10<sup>-12</sup> |
| [femto](https://www.wikiwand.com/en/Femto-) | f | 10<sup>-15</sup> |
| [atto](https://www.wikiwand.com/en/Atto-) | a | 10<sup>-18</sup> |
| [zepto](https://www.wikiwand.com/en/Zepto-) | z | 10<sup>-21</sup> |
| [yocto](https://www.wikiwand.com/en/Yocto-) | y | 10<sup>-24</sup> |
| **Prefix name** | **Prefix symbol** | **Factor** |
| --------------- | ----------------- | ---------------- |
| [deci][] | d | 10<sup>-1</sup> |
| [centi][] | c | 10<sup>-2</sup> |
| [milli][] | m | 10<sup>-3</sup> |
| [micro][] | u | 10<sup>-6</sup> |
| [nano][] | n | 10<sup>-9</sup> |
| [pico][] | p | 10<sup>-12</sup> |
| [femto][] | f | 10<sup>-15</sup> |
| [atto][] | a | 10<sup>-18</sup> |
| [zepto][] | z | 10<sup>-21</sup> |
| [yocto][] | y | 10<sup>-24</sup> |

[deca]: https://en.wikipedia.org/wiki/Deca-
[hecto]: https://en.wikipedia.org/wiki/Hecto-
[kilo]: https://en.wikipedia.org/wiki/Kilo-
[mega]: https://en.wikipedia.org/wiki/Mega-
[giga]: https://en.wikipedia.org/wiki/Giga-
[tera]: https://en.wikipedia.org/wiki/Tera-
[peta]: https://en.wikipedia.org/wiki/Peta-
[exa]: https://en.wikipedia.org/wiki/Exa-
[zetta]: https://en.wikipedia.org/wiki/Zetta-
[yotta]: https://en.wikipedia.org/wiki/Yotta-
[deci]: https://en.wikipedia.org/wiki/Deci-
[centi]: https://en.wikipedia.org/wiki/Centi-
[milli]: https://en.wikipedia.org/wiki/Milli-
[micro]: https://en.wikipedia.org/wiki/Micro-
[nano]: https://en.wikipedia.org/wiki/Nano-
[pico]: https://en.wikipedia.org/wiki/Pico-
[femto]: https://en.wikipedia.org/wiki/Femto-
[atto]: https://en.wikipedia.org/wiki/Atto-
[zepto]: https://en.wikipedia.org/wiki/Zepto-
[yocto]: https://en.wikipedia.org/wiki/Yocto-
4 changes: 4 additions & 0 deletions src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ For example:
PsyArXiv.
[doi:10.31234/osf.io/w6z79](https://doi.org/10.31234/osf.io/w6z79)

#### MRS

- (publication forthcoming)

### Research Resource Identifier (RRID)

BIDS has also a
Expand Down
24 changes: 16 additions & 8 deletions src/metaschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"versions": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
}
}
Expand Down Expand Up @@ -315,7 +316,7 @@
"$ref": "#/definitions/ruleTypes/expressionList"
}
},
"required": ["checks", "selectors"],
"required": ["checks", "selectors", "issue"],
"additionalProperties": false
}
}
Expand Down Expand Up @@ -386,19 +387,25 @@
"required": ["common", "deriv", "raw"],
"additionalProperties": false
},
"json": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/json"
}
},
"sidecars": {
"type": "object",
"patternProperties": {
"^derivatives$": {
"type": "object",
"properties": {
"common_derivatives": { "$ref": "#/definitions/sidecar" }
"common_derivatives": { "$ref": "#/definitions/json" }
},
"required": ["common_derivatives"],
"additionalProperties": false
},
"^(?!derivatives$)[a-z_]+$": {
"$ref": "#/definitions/sidecar"
"$ref": "#/definitions/json"
},
"additionalProperties": false
},
Expand Down Expand Up @@ -464,7 +471,7 @@
"properties": {
"datatypes": {
"type": "array",
"items": { "pattern": "^[a-z]+$" }
"items": { "type": "string", "pattern": "^[a-z]+$" }
}
},
"required": ["datatypes"],
Expand All @@ -476,6 +483,7 @@
"required": [
"entities",
"files",
"json",
"sidecars",
"tabular_data",
"common_principles",
Expand Down Expand Up @@ -586,7 +594,7 @@
}
}
},
"sidecar": {
"json": {
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
Expand Down Expand Up @@ -654,7 +662,7 @@
"level": { "enum": ["optional", "recommended", "required"] },
"datatypes": {
"type": "array",
"items": { "pattern": "^[a-z]+$" }
"items": { "type": "string", "pattern": "^[a-z]+$" }
},
"stem": { "type": "string" },
"extensions": { "type": "array", "items": { "type": "string" } }
Expand All @@ -668,11 +676,11 @@
"level": { "enum": ["optional", "recommended", "required"] },
"datatypes": {
"type": "array",
"items": { "pattern": "^[a-z]+$" }
"items": { "type": "string", "pattern": "^[a-z]+$" }
},
"suffixes": {
"type": "array",
"items": { "pattern": "^[a-zA-Z0-9]+$" }
"items": { "type": "string", "pattern": "^[a-zA-Z0-9]+$" }
},
"extensions": { "type": "array", "items": { "type": "string" } },
"entities": {
Expand Down
Loading

0 comments on commit bee4b16

Please sign in to comment.