Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 2 additions & 15 deletions src/metaschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -378,18 +378,6 @@
"required": ["core", "tables"],
"additionalProperties": false
},
"atlas": {
"type": "object",
"patternProperties": {
"^[a-z_]+$": {
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": { "$ref": "#/definitions/suffixRule" }
}
}
},
"additionalProperties": false
},
"deriv": {
"type": "object",
"patternProperties": {
Expand Down Expand Up @@ -431,10 +419,9 @@
"^derivatives$": {
"type": "object",
"properties": {
"common_derivatives": { "$ref": "#/definitions/json" },
"atlas": { "$ref": "#/definitions/json" }
"common_derivatives": { "$ref": "#/definitions/json" }
},
"required": ["common_derivatives", "atlas"],
"required": ["common_derivatives"],
"additionalProperties": false
},
"^(?!derivatives$)[a-z_]+$": {
Expand Down
21 changes: 11 additions & 10 deletions src/schema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,21 +167,23 @@ references (the cases in which they are used will be presented later):
(which are in turn references to individual values), and the references inside `GeneticLevel.anyOf` indicate that there may be a single
such value or a list of values.

1. In [`rules.files.deriv.preprocessed_data`][preprocessed_data]:
1. In [`rules.files.deriv.imaging`](./rules/files/deriv/imaging.yaml):
```YAML
anat_nonparametric_common:
$ref: rules.files.raw.anat.nonparametric
anat_parametric_volumetric:
$ref: rules.files.raw.anat.parametric
entities:
$ref: rules.files.raw.anat.nonparametric.entities
space: optional
description: optional
$ref:
- meta.templates.deriv.volumetric.entities
- rules.files.raw.anat.parametric.entities
```
Here, the derivative datatype rule starts by copying the raw datatype rule
`rules.files.raw.anat.nonparametric`.
It then *overrides* the `entities` portion of that rule with a new object.
To *extend* the original `entities`, it again begins
by referencing `rules.files.raw.anat.nonparametric.entities`,
and adding the new entities `space` and `description`.
To *extend* the original `entities`, it composes
`meta.templates.deriv.volumetric.entities`
and `rules.files.raw.anat.nonparametric.entities`.
When multiple references are aggregated, the first reference takes
precedence.

### Expressions

Expand Down Expand Up @@ -1071,5 +1073,4 @@ ensuring consistency across the entire schema directory. Validation of the schem
incorporated into the CI, so any changes that are inconsistent will be flagged before
inclusion.

[preprocessed_data]: https://github.com/bids-standard/bids-specification/tree/master/src/schema/rules/files/deriv/preprocessed_data.yaml
[tabular files]: https://bids-specification.readthedocs.io/en/stable/common-principles.html#tabular-files
144 changes: 132 additions & 12 deletions src/schema/meta/templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,145 @@
#
# filerule:
# entities:
# $ref: meta.templates.raw_base_entities
# $ref: meta.templates.raw.base.entities
# task: optional
# ...
# datatypes:
# ...
raw_base_entities:
subject: required
session: optional

raw:
base:
entities:
subject: required
session: optional

recording:
entities:
$ref: meta.templates.raw.base.entities
acquisition: optional
run: optional

task:
entities:
$ref: meta.templates.raw.recording.entities
task: required

mri:
entities:
$ref: meta.templates.raw.recording.entities
ceagent: optional
reconstruction: optional
chunk: optional

epi:
entities:
$ref: meta.templates.raw.mri.entities
direction: optional
part: optional

# Entities that apply to most derivative files
# $ref: meta.templates.deriv.base.entities
# task: optional
# ...
# datatypes:
# ...
deriv:
base:
selectors:
- dataset.dataset_description.DatasetType == 'derivative'
entities:
subject: optional
session: optional
description: optional

spatial:
$ref: meta.templates.deriv.base
entities:
$ref: meta.templates.deriv.base.entities
space: optional

# Imaging derivatives
volumetric:
$ref: meta.templates.deriv.spatial
extensions:
- .nii.gz
- .nii
- .json
entities:
$ref: meta.templates.deriv.spatial.entities
resolution: optional

surface:
$ref: meta.templates.deriv.spatial
entities:
$ref: meta.templates.deriv.spatial.entities
hemisphere: optional
density: optional

mask:
$ref: meta.templates.deriv.volumetric
suffixes:
- mask
entities:
$ref: meta.templates.deriv.volumetric.entities
label: optional

dseg:
$ref: meta.templates.deriv.volumetric
extensions:
- .nii.gz
- .nii
- .tsv
- .json
suffixes:
- dseg
entities:
$ref: meta.templates.deriv.volumetric.entities
cohort: optional
atlas: optional
segmentation: optional
scale: optional

probseg:
$ref: meta.templates.deriv.volumetric
extensions:
- .nii.gz
- .nii
- .json
suffixes:
- probseg
entities:
$ref: meta.templates.deriv.volumetric.entities
cohort: optional
atlas: optional
segmentation: optional
scale: optional
label: optional

dseg_surface:
$ref: meta.templates.deriv.surface
extensions:
- .label.gii
- .dlabel.nii
- .tsv
- .json
suffixes:
- dseg
entities:
$ref: meta.templates.deriv.surface.entities
cohort: optional
atlas: optional
segmentation: optional
scale: optional

# Entities that apply to most atlas files
# Include thus:
#
# filerule:
# entities:
# $ref: meta.templates.atlas_base_entities
# task: optional
# ...
# datatypes:
# ...
atlas_base_entities:
template: required
cohort: optional
# $ref: meta.templates.atlas.base.entities
atlas:
base:
entities:
template: required
cohort: optional
9 changes: 9 additions & 0 deletions src/schema/objects/suffixes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,15 @@ defacemask:
description: |
A binary mask that was used to remove facial features from an anatomical MRI
image.
description:
value: description
display_name: Description file
description: |
A JSON file describing the entities that occur in the filename.

At present, this is used for atlas descriptions.

This file MUST be located at the root of the dataset.
descriptions:
value: descriptions
display_name: Description Entity Definitions
Expand Down
Loading