diff --git a/macros_doc.md b/macros_doc.md
index c202891717..cc238c6781 100644
--- a/macros_doc.md
+++ b/macros_doc.md
@@ -78,7 +78,7 @@ consistency.
## What macros are available?
All the macros we use are in listed in this
-[python file](https://github.com/bids-standard/bids-specification/blob/master/tools/mkdocs_macros_bids/macros.py).
+[Python file](https://github.com/bids-standard/bids-specification/blob/master/tools/mkdocs_macros_bids/macros.py).
| Name | Purpose | Uses schema | Example |
| ----------------------- | -------------------------------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
diff --git a/pdf_build_src/process_markdowns.py b/pdf_build_src/process_markdowns.py
index 31bf6eb746..4f594b2927 100644
--- a/pdf_build_src/process_markdowns.py
+++ b/pdf_build_src/process_markdowns.py
@@ -562,6 +562,13 @@ def edit_titlepage():
file.writelines(data)
+class MockPage:
+ pass
+
+class MockFile:
+ pass
+
+
def process_macros(duplicated_src_dir_path):
"""Search for mkdocs macros in the specification, run the embedded
functions, and replace the macros with their outputs.
@@ -594,6 +601,15 @@ def process_macros(duplicated_src_dir_path):
with open(filename, "r") as fo:
contents = fo.read()
+ # Create a mock MkDocs Page object that has a "file" attribute,
+ # which is a mock MkDocs File object with a str "src_path" attribute
+ # The src_path
+ mock_file = MockFile()
+ mock_file.src_path = os.sep.join(filename.split(os.sep)[1::])
+
+ page = MockPage()
+ page.file = mock_file
+
# Replace code snippets in the text with their outputs
matches = re.findall(re_code_snippets, contents)
for m in matches:
diff --git a/src/02-common-principles.md b/src/02-common-principles.md
index 5e1379b163..b94bc73f19 100644
--- a/src/02-common-principles.md
+++ b/src/02-common-principles.md
@@ -486,7 +486,8 @@ and a guide for using macros can be found at
"Units": "RECOMMENDED",
"TermURL": "RECOMMENDED",
"HED": "OPTIONAL",
- }
+ },
+ page.file
) }}
Please note that while both `Units` and `Levels` are RECOMMENDED, typically only one
diff --git a/src/03-modality-agnostic-files.md b/src/03-modality-agnostic-files.md
index 82bdc20af0..7483c34844 100644
--- a/src/03-modality-agnostic-files.md
+++ b/src/03-modality-agnostic-files.md
@@ -36,7 +36,8 @@ and a guide for using macros can be found at
"DatasetDOI": "OPTIONAL",
"GeneratedBy": "RECOMMENDED",
"SourceDatasets": "RECOMMENDED",
- }
+ },
+ page.file
) }}
Each object in the `GeneratedBy` array includes the following REQUIRED, RECOMMENDED
@@ -114,7 +115,8 @@ and a guide for using macros can be found at
{{ MACROS___make_metadata_table(
{
"GeneratedBy": "REQUIRED"
- }
+ },
+ page.file
) }}
If a derived dataset is stored as a subdirectory of the raw dataset, then the `Name` field
@@ -236,7 +238,8 @@ and a guide for using macros can be found at
"handedness": "RECOMMENDED",
"strain": "RECOMMENDED",
"strain_rrid": "RECOMMENDED",
- }
+ },
+ page.file
) }}
Throughout BIDS you can indicate missing values with `n/a` (for "not
@@ -319,7 +322,8 @@ and a guide for using macros can be found at
"sample_type": "REQUIRED",
"pathology": "RECOMMENDED",
"derived_from": "RECOMMENDED",
- }
+ },
+ page.file
) }}
`samples.tsv` example:
@@ -392,7 +396,8 @@ and a guide for using macros can be found at
{
"MeasurementToolMetadata": "OPTIONAL",
"Derivative": "OPTIONAL",
- }
+ },
+ page.file
) }}
As an example, consider the contents of a file called
@@ -464,7 +469,8 @@ and a guide for using macros can be found at
{
"filename": ("REQUIRED", "There MUST be exactly one row for each file."),
"acq_time__scans": ("OPTIONAL"),
- }
+ },
+ page.file
) }}
Additional fields can include external behavioral measures relevant to the
@@ -514,7 +520,8 @@ and a guide for using macros can be found at
"session_id": ("REQUIRED", "There MUST be exactly one row for each session."),
"acq_time__sessions": ("OPTIONAL"),
"pathology": "RECOMMENDED",
- }
+ },
+ page.file
) }}
`_sessions.tsv` example:
diff --git a/src/04-modality-specific-files/01-magnetic-resonance-imaging-data.md b/src/04-modality-specific-files/01-magnetic-resonance-imaging-data.md
index 917b0d03aa..dc9474c053 100644
--- a/src/04-modality-specific-files/01-magnetic-resonance-imaging-data.md
+++ b/src/04-modality-specific-files/01-magnetic-resonance-imaging-data.md
@@ -36,7 +36,8 @@ and a guide for using macros can be found at
"MRTransmitCoilSequence": "RECOMMENDED",
"MatrixCoilMode": "RECOMMENDED",
"CoilCombinationMethod": "RECOMMENDED",
- }
+ },
+ page.file
) }}
Example for `ReceiveCoilActiveElements`:
@@ -83,7 +84,8 @@ and a guide for using macros can be found at
"SpoilingRFPhaseIncrement": 'RECOMMENDED if the SpoilingType is `"RF"` or `"COMBINED"`.',
"SpoilingGradientMoment": 'RECOMMENDED if the SpoilingType is `"GRADIENT"` or `"COMBINED"`.',
"SpoilingGradientDuration": 'RECOMMENDED if the SpoilingType is `"GRADIENT"` or `"COMBINED"`.',
- }
+ },
+ page.file
) }}
### In-Plane Spatial Encoding
@@ -119,7 +121,8 @@ and a guide for using macros can be found at
"directions](#case-4-multiple-phase-encoded-directions-pepolar)).",
),
"MixingTime": "RECOMMENDED",
- }
+ },
+ page.file
) }}
2 Conveniently, for Siemens data, this value is easily obtained as
@@ -148,7 +151,8 @@ and a guide for using macros can be found at
"SliceTiming": "RECOMMENDED, but REQUIRED for sparse sequences that do not have the `DelayTime` field set, and Arterial Spin Labeling with `MRAcquisitionType` set on `2D`.",
"SliceEncodingDirection": "RECOMMENDED",
"DwellTime": "RECOMMENDED",
- }
+ },
+ page.file
) }}
### RF & Contrast
@@ -163,7 +167,8 @@ and a guide for using macros can be found at
{
"FlipAngle": "RECOMMENDED, but REQUIRED if `LookLocker` is set `true`",
"NegativeContrast": "OPTIONAL",
- }
+ },
+ page.file
) }}
### Slice Acceleration
@@ -177,7 +182,8 @@ and a guide for using macros can be found at
{{ MACROS___make_metadata_table(
{
"MultibandAccelerationFactor": "RECOMMENDED",
- }
+ },
+ page.file
) }}
### Anatomical landmarks
@@ -193,7 +199,8 @@ and a guide for using macros can be found at
{{ MACROS___make_metadata_table(
{
"AnatomicalLandmarkCoordinates__mri": "RECOMMENDED",
- }
+ },
+ page.file
) }}
### Echo-Planar Imaging and *B0 * mapping
@@ -220,7 +227,8 @@ and a guide for using macros can be found at
{
"B0FieldIdentifier": "RECOMMENDED",
"B0FieldSource": "RECOMMENDED",
- }
+ },
+ page.file
) }}
### Institution information
@@ -236,7 +244,8 @@ and a guide for using macros can be found at
"InstitutionName": ("RECOMMENDED", "Corresponds to DICOM Tag 0008, 0080 `InstitutionName`."),
"InstitutionAddress": ("RECOMMENDED", "Corresponds to DICOM Tag 0008, 0081 `InstitutionAddress`."),
"InstitutionalDepartmentName": ("RECOMMENDED", "Corresponds to DICOM Tag 0008, 1040 `Institutional Department Name`.")
- }
+ },
+ page.file
) }}
When adding additional metadata please use the CamelCase version of
@@ -276,7 +285,8 @@ and a guide for using macros can be found at
"PDT2",
"UNIT1",
"angio",
- ]
+ ],
+ page.file
)
}}
@@ -335,7 +345,8 @@ and a guide for using macros can be found at
"ContrastBolusIngredient": "OPTIONAL",
"RepetitionTimeExcitation": "OPTIONAL",
"RepetitionTimePreparation": "OPTIONAL",
- }
+ },
+ page.file
) }}
The [`part-`](../99-appendices/09-entities.md#part) key/value pair is
@@ -412,7 +423,8 @@ and a guide for using macros can be found at
"RB1map",
"S0map",
"M0map",
- ]
+ ],
+ page.file
)
}}
@@ -449,7 +461,8 @@ and a guide for using macros can be found at
"T2star",
"FLASH",
"PD",
- ]
+ ],
+ page.file
)
}}
@@ -469,7 +482,8 @@ and a guide for using macros can be found at
"bold",
"cbv",
"phase",
- ]
+ ],
+ page.file
)
}}
@@ -603,7 +617,8 @@ and a guide for using macros can be found at
"RepetitionTime": "REQUIRED",
"VolumeTiming": "REQUIRED",
"TaskName": ("REQUIRED", "A RECOMMENDED convention is to name resting state task using labels beginning with `rest`.")
- }
+ },
+ page.file
) }}
For the fields described above and in the following section, the term "Volume"
@@ -628,7 +643,8 @@ and a guide for using macros can be found at
"DelayTime": "RECOMMENDED",
"AcquisitionDuration": 'RECOMMENDED, but REQUIRED for sequences that are described with the `VolumeTiming` field and that do not have the `SliceTiming` field set to allow for accurate calculation of "acquisition time"',
"DelayAfterTrigger": "RECOMMENDED",
- }
+ },
+ page.file
) }}
The following table recapitulates the different ways that specific fields have
@@ -664,7 +680,8 @@ and a guide for using macros can be found at
"TaskDescription": "RECOMMENDED",
"CogAtlasID": "RECOMMENDED",
"CogPOID": "RECOMMENDED",
- }
+ },
+ page.file
) }}
See [Common metadata fields](#common-metadata-fields) for a list of
@@ -736,7 +753,8 @@ and a guide for using macros can be found at
[
"dwi",
"sbref",
- ]
+ ],
+ page.file
)
}}
@@ -847,7 +865,8 @@ and a guide for using macros can be found at
{{ MACROS___make_metadata_table(
{
"MultipartID": "REQUIRED",
- }
+ },
+ page.file
) }}
JSON example:
@@ -1053,7 +1072,8 @@ and a guide for using macros can be found at
"LabelingLocationDescription": "RECOMMENDED",
"LookLocker": "OPTIONAL",
"LabelingEfficiency": "OPTIONAL",
- }
+ },
+ page.file
) }}
#### (P)CASL-specific metadata fields
@@ -1077,7 +1097,8 @@ and a guide for using macros can be found at
"LabelingPulseDuration": "RECOMMENDED",
"LabelingPulseFlipAngle": "RECOMMENDED",
"LabelingPulseInterval": "RECOMMENDED",
- }
+ },
+ page.file
) }}
#### PASL-specific metadata fields
@@ -1097,7 +1118,8 @@ and a guide for using macros can be found at
"LabelingSlabThickness": "RECOMMENDED",
"BolusCutOffDelayTime": "OPTIONAL, REQUIRED if `BolusCutOffFlag` is `true`",
"BolusCutOffTechnique": "OPTIONAL, REQUIRED if `BolusCutOffFlag` is `true`",
- }
+ },
+ page.file
) }}
### `m0scan` metadata fields
@@ -1117,7 +1139,8 @@ and a guide for using macros can be found at
"This is used to refer to the ASL time series for which the `*_m0scan.nii[.gz]` is intended."
),
"AcquisitionVoxelSize": "RECOMMENDED",
- }
+ },
+ page.file
) }}
The following table recapitulates the ASL field dependencies. If Source field (column 1) contains the Value specified in column 2, then the Requirements in column 4 are
@@ -1172,7 +1195,8 @@ and a guide for using macros can be found at
"phasediff",
"fieldmap",
"epi",
- ]
+ ],
+ page.file
)
}}
@@ -1220,7 +1244,8 @@ and a guide for using macros can be found at
"This field is OPTIONAL, and in case the fieldmaps do not correspond "
"to any particular scans, it does not have to be filled.",
),
- }
+ },
+ page.file
) }}
For example:
@@ -1271,7 +1296,8 @@ and a guide for using macros can be found at
{
"EchoTime1": "REQUIRED",
"EchoTime2": "REQUIRED",
- }
+ },
+ page.file
) }}
In this particular case, the sidecar JSON file
@@ -1314,7 +1340,8 @@ and a guide for using macros can be found at
{{ MACROS___make_metadata_table(
{
"EchoTime__fmap": "REQUIRED",
- }
+ },
+ page.file
) }}
Each phase map has a corresponding sidecar JSON file to specify its corresponding `EchoTime`.
@@ -1355,7 +1382,8 @@ and a guide for using macros can be found at
'Fieldmaps must be in units of Hertz (`"Hz"`), '
'radians per second (`"rad/s"`), or Tesla (`"T"`).',
),
- }
+ },
+ page.file
) }}
For example:
@@ -1413,7 +1441,8 @@ and a guide for using macros can be found at
{
"PhaseEncodingDirection": "REQUIRED",
"TotalReadoutTime": "REQUIRED",
- }
+ },
+ page.file
) }}
For example:
diff --git a/src/04-modality-specific-files/02-magnetoencephalography.md b/src/04-modality-specific-files/02-magnetoencephalography.md
index b49c9ae556..f296af5a0b 100644
--- a/src/04-modality-specific-files/02-magnetoencephalography.md
+++ b/src/04-modality-specific-files/02-magnetoencephalography.md
@@ -107,7 +107,8 @@ and a guide for using macros can be found at
{{ MACROS___make_metadata_table(
{
"TaskName": ("REQUIRED", "A RECOMMENDED convention is to name resting state task using labels beginning with `rest`."),
- }
+ },
+ page.file
) }}
SHOULD be present: For consistency between studies and institutions, we
@@ -144,7 +145,8 @@ and a guide for using macros can be found at
"CogAtlasID": "RECOMMENDED",
"CogPOID": "RECOMMENDED",
"DeviceSerialNumber": "RECOMMENDED",
- }
+ },
+ page.file
) }}
Specific MEG fields MUST be present:
@@ -163,7 +165,8 @@ and a guide for using macros can be found at
"SoftwareFilters": "REQUIRED",
"DigitizedLandmarks": "REQUIRED",
"DigitizedHeadPoints": "REQUIRED",
- }
+ },
+ page.file
) }}
SHOULD be present:
@@ -195,7 +198,8 @@ and a guide for using macros can be found at
"SubjectArtefactDescription": "RECOMMENDED",
"AssociatedEmptyRoom": "RECOMMENDED",
"HardwareFilters": "RECOMMENDED",
- }
+ },
+ page.file
) }}
Specific EEG fields
@@ -214,7 +218,8 @@ and a guide for using macros can be found at
"CapManufacturer": "OPTIONAL",
"CapManufacturersModelName": "OPTIONAL",
"EEGReference": "OPTIONAL",
- }
+ },
+ page.file
) }}
Example:
@@ -286,7 +291,8 @@ and a guide for using macros can be found at
"name__channels": "REQUIRED",
"type__channels": "REQUIRED",
"units": "REQUIRED",
- }
+ },
+ page.file
) }}
SHOULD be present:
@@ -307,7 +313,8 @@ and a guide for using macros can be found at
"software_filters": "OPTIONAL",
"status": "OPTIONAL",
"status_description": "OPTIONAL",
- }
+ },
+ page.file
) }}
Example:
@@ -404,7 +411,8 @@ and a guide for using macros can be found at
"OPTIONAL, but REQUIRED if `EEGCoordinateSystem` is `Other`",
"See [Recording EEG simultaneously with MEG](/04-modality-specific-files/02-magnetoencephalography.html#recording-eeg-simultaneously-with-meg).",
),
- }
+ },
+ page.file
) }}
Head localization coils:
@@ -421,7 +429,8 @@ and a guide for using macros can be found at
"HeadCoilCoordinateSystem": "OPTIONAL",
"HeadCoilCoordinateUnits": "OPTIONAL",
"HeadCoilCoordinateSystemDescription": "OPTIONAL, but REQUIRED if `HeadCoilCoordinateSystem` is `Other`",
- }
+ },
+ page.file
) }}
Digitized head points:
@@ -438,7 +447,8 @@ and a guide for using macros can be found at
"DigitizedHeadPointsCoordinateSystem": "OPTIONAL",
"DigitizedHeadPointsCoordinateUnits": "OPTIONAL",
"DigitizedHeadPointsCoordinateSystemDescription": "OPTIONAL, but REQUIRED if `DigitizedHeadPointsCoordinateSystem` is `Other`",
- }
+ },
+ page.file
) }}
Anatomical MRI:
@@ -457,7 +467,8 @@ and a guide for using macros can be found at
"possibly of different types if a list is specified, "
"to be used with the MEG recording.",
)
- }
+ },
+ page.file
) }}
Anatomical landmarks:
@@ -474,7 +485,8 @@ and a guide for using macros can be found at
"AnatomicalLandmarkCoordinateSystem": ("OPTIONAL", "Preferably the same as the `MEGCoordinateSystem`."),
"AnatomicalLandmarkCoordinateUnits": "OPTIONAL",
"AnatomicalLandmarkCoordinateSystemDescription": "OPTIONAL, but REQUIRED if `AnatomicalLandmarkCoordinateSystem` is `Other`",
- }
+ },
+ page.file
) }}
It is also RECOMMENDED that the MRI voxel coordinates of the actual anatomical
@@ -504,7 +516,8 @@ and a guide for using macros can be found at
{{ MACROS___make_metadata_table(
{
"FiducialsDescription": "OPTIONAL",
- }
+ },
+ page.file
) }}
For more information on the definition of anatomical landmarks, please visit:
diff --git a/src/04-modality-specific-files/03-electroencephalography.md b/src/04-modality-specific-files/03-electroencephalography.md
index 95bdeb7850..7f29e00778 100644
--- a/src/04-modality-specific-files/03-electroencephalography.md
+++ b/src/04-modality-specific-files/03-electroencephalography.md
@@ -95,7 +95,8 @@ and a guide for using macros can be found at
{{ MACROS___make_metadata_table(
{
"TaskName": ("REQUIRED", "A RECOMMENDED convention is to name resting state task using labels beginning with `rest`."),
- }
+ },
+ page.file
) }}
SHOULD be present: For consistency between studies and institutions, we
@@ -121,7 +122,8 @@ and a guide for using macros can be found at
"CogAtlasID": "RECOMMENDED",
"CogPOID": "RECOMMENDED",
"DeviceSerialNumber": "RECOMMENDED",
- }
+ },
+ page.file
) }}
Specific EEG fields MUST be present:
@@ -138,7 +140,8 @@ and a guide for using macros can be found at
"SamplingFrequency": ("REQUIRED", "The sampling frequency of data channels that deviate from the main sampling frequency SHOULD be specified in the `channels.tsv` file."),
"PowerLineFrequency": "REQUIRED",
"SoftwareFilters": "REQUIRED",
- }
+ },
+ page.file
) }}
SHOULD be present:
@@ -167,7 +170,8 @@ and a guide for using macros can be found at
"EEGPlacementScheme": "RECOMMENDED",
"HardwareFilters": "RECOMMENDED",
"SubjectArtefactDescription": "RECOMMENDED",
- }
+ },
+ page.file
) }}
Example:
@@ -254,7 +258,8 @@ and a guide for using macros can be found at
"name__channels": "REQUIRED",
"type__channels": "REQUIRED",
"units": "REQUIRED",
- }
+ },
+ page.file
) }}
SHOULD be present:
@@ -275,7 +280,8 @@ and a guide for using macros can be found at
"notch": "OPTIONAL",
"status": "OPTIONAL",
"status_description": "OPTIONAL",
- }
+ },
+ page.file
) }}
Restricted keyword list for field `type` in alphabetic order (shared with the
@@ -350,7 +356,8 @@ and a guide for using macros can be found at
"x": "REQUIRED",
"y": "REQUIRED",
"z": "REQUIRED",
- }
+ },
+ page.file
) }}
SHOULD be present:
@@ -366,7 +373,8 @@ and a guide for using macros can be found at
"type__electrodes": "RECOMMENDED",
"material": "RECOMMENDED",
"impedance": "RECOMMENDED",
- }
+ },
+ page.file
) }}
### Example `electrodes.tsv`
@@ -449,7 +457,8 @@ and a guide for using macros can be found at
"This identifies the MRI or CT scan associated with the electrodes, "
"landmarks, and fiducials.",
)
- }
+ },
+ page.file
) }}
Fields relating to the EEG electrode positions:
@@ -465,7 +474,8 @@ and a guide for using macros can be found at
"EEGCoordinateSystem": "REQUIRED",
"EEGCoordinateUnits": "REQUIRED",
"EEGCoordinateSystemDescription": 'RECOMMENDED, but REQUIRED if `EEGCoordinateSystem` is `"Other"`',
- }
+ },
+ page.file
) }}
Fields relating to the position of fiducials measured during an EEG session/run:
@@ -483,7 +493,8 @@ and a guide for using macros can be found at
"FiducialsCoordinateSystem": "RECOMMENDED",
"FiducialsCoordinateUnits": "RECOMMENDED",
"FiducialsCoordinateSystemDescription": 'RECOMMENDED, but REQUIRED if `FiducialsCoordinateSystem` is `"Other"`',
- }
+ },
+ page.file
) }}
Fields relating to the position of anatomical landmark measured during an EEG session/run:
@@ -500,7 +511,8 @@ and a guide for using macros can be found at
"AnatomicalLandmarkCoordinateSystem": ("RECOMMENDED", "Preferably the same as the `EEGCoordinateSystem`."),
"AnatomicalLandmarkCoordinateUnits": "RECOMMENDED",
"AnatomicalLandmarkCoordinateSystemDescription": 'RECOMMENDED, but REQUIRED if `AnatomicalLandmarkCoordinateSystem` is `"Other"`',
- }
+ },
+ page.file
) }}
If the position of anatomical landmarks is measured using the same system or
diff --git a/src/04-modality-specific-files/04-intracranial-electroencephalography.md b/src/04-modality-specific-files/04-intracranial-electroencephalography.md
index a79387f0e2..c935caded5 100644
--- a/src/04-modality-specific-files/04-intracranial-electroencephalography.md
+++ b/src/04-modality-specific-files/04-intracranial-electroencephalography.md
@@ -108,7 +108,8 @@ and a guide for using macros can be found at
{{ MACROS___make_metadata_table(
{
"TaskName": ("REQUIRED", "A RECOMMENDED convention is to name resting state task using labels beginning with `rest`."),
- }
+ },
+ page.file
) }}
Note that the `TaskName` field does not have to be a "behavioral task" that subjects perform, but can reflect some information about the conditions present when the data was acquired (for example, `"rest"`, `"sleep"`, or `"seizure"`).
@@ -136,7 +137,8 @@ and a guide for using macros can be found at
"CogAtlasID": "RECOMMENDED",
"CogPOID": "RECOMMENDED",
"DeviceSerialNumber": "RECOMMENDED",
- }
+ },
+ page.file
) }}
Specific iEEG fields MUST be present:
@@ -153,7 +155,8 @@ and a guide for using macros can be found at
"SamplingFrequency": ("REQUIRED", "The sampling frequency of data channels that deviate from the main sampling frequency SHOULD be specified in the `channels.tsv` file."),
"PowerLineFrequency": "REQUIRED",
"SoftwareFilters": "REQUIRED",
- }
+ },
+ page.file
) }}
Specific iEEG fields SHOULD be present:
@@ -185,7 +188,8 @@ and a guide for using macros can be found at
"iEEGPlacementScheme": "RECOMMENDED",
"iEEGElectrodeGroups": "RECOMMENDED",
"SubjectArtefactDescription": "RECOMMENDED",
- }
+ },
+ page.file
) }}
Specific iEEG fields MAY be present:
@@ -200,7 +204,8 @@ and a guide for using macros can be found at
{
"ElectricalStimulation": "OPTIONAL",
"ElectricalStimulationParameters": "OPTIONAL",
- }
+ },
+ page.file
) }}
Example:
@@ -280,7 +285,8 @@ and a guide for using macros can be found at
"units": "REQUIRED",
"low_cutoff": "REQUIRED",
"high_cutoff": "REQUIRED",
- }
+ },
+ page.file
) }}
SHOULD be present:
@@ -300,7 +306,8 @@ and a guide for using macros can be found at
"notch": "OPTIONAL",
"status": "OPTIONAL",
"status_description": "OPTIONAL",
- }
+ },
+ page.file
) }}
**Example** `sub-01_channels.tsv`:
@@ -417,7 +424,8 @@ and a guide for using macros can be found at
"y": "REQUIRED",
"z": ("REQUIRED", "If electrodes are in 2D space this should be a column of `n/a` values."),
"size": "REQUIRED",
- }
+ },
+ page.file
) }}
SHOULD be present:
@@ -434,7 +442,8 @@ and a guide for using macros can be found at
"manufacturer": "RECOMMENDED",
"group": ("RECOMMENDED", "Note that any group specified here should match a group specified in `_channels.tsv`."),
"hemisphere": "RECOMMENDED",
- }
+ },
+ page.file
) }}
MAY be present:
@@ -450,7 +459,8 @@ and a guide for using macros can be found at
"type__electrodes": "OPTIONAL",
"impedance": "OPTIONAL",
"dimension": "OPTIONAL",
- }
+ },
+ page.file
) }}
Example:
@@ -502,7 +512,8 @@ and a guide for using macros can be found at
"**Talairach**: `'/derivatives/surfaces/sub-Talairach/ses-01/anat/"
"sub-Talairach_hemi-R_pial.surf.gii'`",
)
- }
+ },
+ page.file
) }}
Fields relating to the iEEG electrode positions:
@@ -520,7 +531,8 @@ and a guide for using macros can be found at
"iEEGCoordinateSystemDescription": 'RECOMMENDED, but REQUIRED if `iEEGCoordinateSystem` is `"Other"`',
"iEEGCoordinateProcessingDescription": "RECOMMENDED",
"iEEGCoordinateProcessingReference": "RECOMMENDED",
- }
+ },
+ page.file
) }}
### Recommended 3D coordinate systems
diff --git a/src/04-modality-specific-files/05-task-events.md b/src/04-modality-specific-files/05-task-events.md
index 407f9ebc86..243b8ed172 100644
--- a/src/04-modality-specific-files/05-task-events.md
+++ b/src/04-modality-specific-files/05-task-events.md
@@ -49,7 +49,8 @@ and a guide for using macros can be found at
"response_time": "OPTIONAL",
"value": "OPTIONAL",
"HED": "OPTIONAL",
- }
+ },
+ page.file
) }}
5 Note for MRI data:
@@ -162,7 +163,8 @@ and a guide for using macros can be found at
{{ MACROS___make_columns_table(
{
"stim_file": "OPTIONAL",
- }
+ },
+ page.file
) }}
### Stimuli databases
@@ -235,7 +237,8 @@ and a guide for using macros can be found at
{{ MACROS___make_metadata_table(
{
"StimulusPresentation": "RECOMMENDED",
- }
+ },
+ page.file
) }}
The object supplied for `StimulusPresentation` SHOULD include the following key-value pairs:
@@ -253,7 +256,8 @@ and a guide for using macros can be found at
"SoftwareRRID": "RECOMMENDED",
"SoftwareVersion": "RECOMMENDED",
"Code": "RECOMMENDED",
- }
+ },
+ page.file
) }}
The operating system description SHOULD include the following attributes:
diff --git a/src/04-modality-specific-files/06-physiological-and-other-continuous-recordings.md b/src/04-modality-specific-files/06-physiological-and-other-continuous-recordings.md
index 06a90f3f3a..19dc7939ad 100644
--- a/src/04-modality-specific-files/06-physiological-and-other-continuous-recordings.md
+++ b/src/04-modality-specific-files/06-physiological-and-other-continuous-recordings.md
@@ -59,7 +59,8 @@ and a guide for using macros can be found at
"SamplingFrequency": "REQUIRED",
"StartTime": "REQUIRED",
"Columns": "REQUIRED",
- }
+ },
+ page.file
) }}
Additional metadata may be included as in
@@ -139,7 +140,8 @@ and a guide for using macros can be found at
"cardiac": "OPTIONAL",
"respiratory": "OPTIONAL",
"trigger": "OPTIONAL",
- }
+ },
+ page.file
) }}
For any other data to be specified in columns, the column names can be chosen
@@ -194,7 +196,8 @@ and a guide for using macros can be found at
"ManufacturersModelName": "RECOMMENDED",
"SoftwareVersions": "RECOMMENDED",
"DeviceSerialNumber": "RECOMMENDED",
- }
+ },
+ page.file
) }}
diff --git a/src/04-modality-specific-files/07-behavioral-experiments.md b/src/04-modality-specific-files/07-behavioral-experiments.md
index 1d32f45eb9..ed15205bbe 100644
--- a/src/04-modality-specific-files/07-behavioral-experiments.md
+++ b/src/04-modality-specific-files/07-behavioral-experiments.md
@@ -59,7 +59,8 @@ and a guide for using macros can be found at
"InstitutionName": "RECOMMENDED",
"InstitutionAddress": "RECOMMENDED",
"InstitutionalDepartmentName": "RECOMMENDED",
- }
+ },
+ page.file
) }}
Example of the content of a `_beh.tsv` and its accompanying `_beh.json` sidecar file:
diff --git a/src/04-modality-specific-files/08-genetic-descriptor.md b/src/04-modality-specific-files/08-genetic-descriptor.md
index 08986ef578..f5238b5fd8 100644
--- a/src/04-modality-specific-files/08-genetic-descriptor.md
+++ b/src/04-modality-specific-files/08-genetic-descriptor.md
@@ -38,7 +38,8 @@ and a guide for using macros can be found at
"Genetics.Dataset": "REQUIRED",
"Genetics.Database": "OPTIONAL",
"Genetics.Descriptors": "OPTIONAL",
- }
+ },
+ page.file
) }}
Example:
@@ -110,7 +111,8 @@ and a guide for using macros can be found at
"TissueOrigin": "OPTIONAL",
"BrainLocation": "OPTIONAL",
"CellType": "OPTIONAL",
- }
+ },
+ page.file
) }}
To ensure dataset description consistency, we recommend following [Multi-omics approaches to disease](https://genomebiology.biomedcentral.com/articles/10.1186/s13059-017-1215-1) by Hasin et al. 2017 to determine the `GeneticLevel:`
diff --git a/src/04-modality-specific-files/09-positron-emission-tomography.md b/src/04-modality-specific-files/09-positron-emission-tomography.md
index e7661be71b..9cf267c7bf 100644
--- a/src/04-modality-specific-files/09-positron-emission-tomography.md
+++ b/src/04-modality-specific-files/09-positron-emission-tomography.md
@@ -160,7 +160,8 @@ and a guide for using macros can be found at
"InstitutionAddress": ("RECOMMENDED", "Corresponds to DICOM Tag 0008, 0081 `InstitutionAddress`."),
"InstitutionalDepartmentName": ("RECOMMENDED", "Corresponds to DICOM Tag 0008, 1040 `Institutional Department Name`."),
"BodyPart": ("RECOMMENDED", "Corresponds to DICOM Tag 0018, 0015 `Body Part Examined`."),
- }
+ },
+ page.file
) }}
#### Radiochemistry
@@ -198,7 +199,8 @@ and a guide for using macros can be found at
"InfusionSpeedUnits": "RECOMMENDED, but REQUIRED if `ModeOfAdministration` is `bolus-infusion`",
"InjectedVolume": "RECOMMENDED, but REQUIRED if `ModeOfAdministration` is `bolus-infusion`",
"Purity": "RECOMMENDED",
- }
+ },
+ page.file
) }}
#### Pharmaceuticals
@@ -217,7 +219,8 @@ and a guide for using macros can be found at
"PharmaceuticalDoseRegimen": "RECOMMENDED",
"PharmaceuticalDoseTime": ("RECOMMENDED", "Corresponds to a combination of DICOM Tags (0008,0027) `Intervention Drug Stop Time` and (0008,0035) `Intervention Drug Start Time`."),
"Anaesthesia": "OPTIONAL",
- }
+ },
+ page.file
) }}
#### Time
@@ -237,7 +240,8 @@ and a guide for using macros can be found at
"FrameDuration": "REQUIRED",
"InjectionEnd": ("RECOMMENDED", "This corresponds to DICOM Tag (0018,1073) `Radiopharmaceutical Stop Time` converted to seconds relative to TimeZero."),
"ScanDate": ("DEPRECATED", "This corresponds to DICOM Tag (0008,0022) `Acquisition Date`."),
- }
+ },
+ page.file
) }}
We refer to the common principles for the standards for describing dates and timestamps, including possibilities for anonymization (see [Units](../02-common-principles.md#units)).
@@ -271,7 +275,8 @@ and a guide for using macros can be found at
"PromptRate": "RECOMMENDED",
"RandomRate": "RECOMMENDED",
"SinglesRate": "RECOMMENDED",
- }
+ },
+ page.file
) }}
All reconstruction-specific parameters that are not specified, but one wants to include, should go into the `ReconMethodParameterValues` field.
@@ -392,7 +397,8 @@ and a guide for using macros can be found at
"DispersionConstant": "RECOMMENDED",
"Haematocrit": "RECOMMENDED",
"BloodDensity": "RECOMMENDED",
- }
+ },
+ page.file
) }}
The following metadata SHOULD or MUST be provided if corresponding flags are `true`.
@@ -409,7 +415,8 @@ and a guide for using macros can be found at
"PlasmaFreeFractionMethod": "RECOMMENDED if `PlasmaAvail` is `true`",
"MetaboliteMethod": "REQUIRED if `MetaboliteAvail` is `true`",
"MetaboliteRecoveryCorrectionApplied": "REQUIRED if `MetaboliteAvail` is `true`",
- }
+ },
+ page.file
) }}
The following columns are defined for `_blood.tsv` files.
@@ -429,7 +436,8 @@ and a guide for using macros can be found at
"metabolite_polar_fraction": "RECOMMENDED if `MetaboliteAvail` is `true`",
"hplc_recovery_fractions": "REQUIRED if `MetaboliteRecoveryCorrectionApplied` is `true`",
"whole_blood_radioactivity": "REQUIRED if `WholeBloodAvail` is `true`",
- }
+ },
+ page.file
) }}
As with all [tabular files](../02-common-principles.md#tabular-files),
diff --git a/src/04-modality-specific-files/10-microscopy.md b/src/04-modality-specific-files/10-microscopy.md
index 5515559fdc..2309afe806 100644
--- a/src/04-modality-specific-files/10-microscopy.md
+++ b/src/04-modality-specific-files/10-microscopy.md
@@ -90,7 +90,8 @@ and a guide for using macros can be found at
"NLO",
"OCT",
"SPIM",
- ]
+ ],
+ page.file
)
}}
@@ -291,7 +292,8 @@ and a guide for using macros can be found at
"InstitutionName": "RECOMMENDED",
"InstitutionAddress": "RECOMMENDED",
"InstitutionalDepartmentName": "RECOMMENDED",
- }
+ },
+ page.file
) }}
#### Image Acquisition
@@ -311,7 +313,8 @@ and a guide for using macros can be found at
"Magnification": "OPTIONAL",
"ImageAcquisitionProtocol": "OPTIONAL",
"OtherAcquisitionParameters": "OPTIONAL",
- }
+ },
+ page.file
) }}
#### Sample
@@ -337,7 +340,8 @@ and a guide for using macros can be found at
"TissueDeformationScaling": "OPTIONAL",
"SampleExtractionProtocol": "OPTIONAL",
"SampleExtractionInstitution": "OPTIONAL",
- }
+ },
+ page.file
) }}
#### Chunk Transformations
@@ -366,7 +370,8 @@ and a guide for using macros can be found at
{
"ChunkTransformationMatrix": "RECOMMENDED if `` is used in filenames",
"ChunkTransformationMatrixAxis": "REQUIRED if `ChunkTransformationMatrix` is present",
- }
+ },
+ page.file
) }}
An example of chunk transformations JSON metadata for `chunk-01` and `chunk-05` of Figure 2
diff --git a/src/05-derivatives/02-common-data-types.md b/src/05-derivatives/02-common-data-types.md
index 4e1b800b49..731671039c 100644
--- a/src/05-derivatives/02-common-data-types.md
+++ b/src/05-derivatives/02-common-data-types.md
@@ -24,7 +24,8 @@ and a guide for using macros can be found at
),
"Sources": "OPTIONAL",
"RawSources": "OPTIONAL",
- }
+ },
+ page.file
) }}
### Examples
@@ -104,7 +105,8 @@ and a guide for using macros can be found at
{{ MACROS___make_metadata_table(
{
"SpatialReference": "RECOMMENDED if the derivative is aligned to a standard template listed in [Standard template identifiers][templates]. REQUIRED otherwise.",
- }
+ },
+ page.file
) }}
### SpatialReference key allowed values
diff --git a/src/05-derivatives/03-imaging.md b/src/05-derivatives/03-imaging.md
index 1b0fc9da47..76eaf0ec39 100644
--- a/src/05-derivatives/03-imaging.md
+++ b/src/05-derivatives/03-imaging.md
@@ -63,7 +63,8 @@ and a guide for using macros can be found at
"SkullStripped": "REQUIRED",
"Resolution": "REQUIRED if `res` is present",
"Density": "REQUIRED if `den` is present",
- }
+ },
+ page.file
) }}
Example JSON file corresponding to
@@ -173,7 +174,8 @@ and a guide for using macros can be found at
"Atlas": "RECOMMENDED if `label` entity is defined",
"Resolution": "REQUIRED if `res` is present",
"Density": "REQUIRED if `den` is present",
- }
+ },
+ page.file
) }}
Examples:
@@ -253,7 +255,8 @@ and a guide for using macros can be found at
"Atlas": "REQUIRED if `atlas` is present",
"Resolution": "REQUIRED if `res` is present",
"Density": "REQUIRED if `den` is present",
- }
+ },
+ page.file
) }}
### Discrete Segmentations
@@ -532,7 +535,8 @@ and a guide for using macros can be found at
"abbreviation": "OPTIONAL",
"color": "OPTIONAL",
"mapping": "OPTIONAL",
- }
+ },
+ page.file
) }}
An example, custom `dseg.tsv` that defines three labels:
diff --git a/src/99-appendices/11-qmri.md b/src/99-appendices/11-qmri.md
index 608c70dbc0..6705c53a15 100644
--- a/src/99-appendices/11-qmri.md
+++ b/src/99-appendices/11-qmri.md
@@ -294,7 +294,8 @@ and a guide for using macros can be found at
"EstimationReference": "RECOMMENDED",
"EstimationAlgorithm": "RECOMMENDED",
"Units": "RECOMMENDED",
- }
+ },
+ page.file
) }}
Example:
diff --git a/src/99-appendices/14-glossary.md b/src/99-appendices/14-glossary.md
index 92bc5540a2..5d94ec4a01 100644
--- a/src/99-appendices/14-glossary.md
+++ b/src/99-appendices/14-glossary.md
@@ -8,4 +8,4 @@ This section compiles the object definitions in the schema.
and a guide for using macros can be found at
https://github.com/bids-standard/bids-specification/blob/master/macros_doc.md
-->
-{{ MACROS___make_glossary() }}
+{{ MACROS___make_glossary(page.file) }}
diff --git a/src/schema/objects/columns.yaml b/src/schema/objects/columns.yaml
index 36e93fe308..350451e851 100644
--- a/src/schema/objects/columns.yaml
+++ b/src/schema/objects/columns.yaml
@@ -3,7 +3,7 @@ HED:
name: HED
description: |
Hierarchical Event Descriptor (HED) Tag.
- See [Appendix III](/99-appendices/03-hed.html) for details.
+ See [Appendix III](SPEC_ROOT/99-appendices/03-hed.md) for details.
type: string
abbreviation:
name: abbreviation
@@ -16,14 +16,16 @@ acq_time__scans:
Acquisition time refers to when the first data point in each run was acquired.
Furthermore, if this header is provided, the acquisition times of all files
from the same recording MUST be identical.
- Datetime format and their anonymization are described in [Units](/02-common-principles.html#units).
+ Datetime format and their anonymization are described in
+ [Units](SPEC_ROOT/02-common-principles.md#units).
type: string
format: datetime
acq_time__sessions:
name: acq_time
description: |
Acquisition time refers to when the first data point of the first run was acquired.
- Datetime format and their anonymization are described in [Units](/02-common-principles.html#units).
+ Datetime format and their anonymization are described in
+ [Units](SPEC_ROOT/02-common-principles.md#units).
type: string
format: datetime
age:
@@ -512,7 +514,7 @@ units:
description: |
Physical unit of the value represented in this channel,
for example, `V` for Volt, or `fT/cm` for femto Tesla per centimeter
- (see [Units](/02-common-principles.html#units)).
+ (see [Units](SPEC_ROOT/02-common-principles.md#units)).
type: string
format: unit
value:
diff --git a/src/schema/objects/metadata.yaml b/src/schema/objects/metadata.yaml
index 7f584f9760..e9f49e649f 100644
--- a/src/schema/objects/metadata.yaml
+++ b/src/schema/objects/metadata.yaml
@@ -61,7 +61,7 @@ AnatomicalLandmarkCoordinateSystem:
name: AnatomicalLandmarkCoordinateSystem
description: |
Defines the coordinate system for the anatomical landmarks.
- See [Appendix VIII](/99-appendices/08-coordinate-systems.html)
+ See [Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
for a list of restricted keywords for coordinate systems.
If `"Other"`, provide definition of the coordinate system in
`"AnatomicalLandmarkCoordinateSystemDescription"`.
@@ -262,7 +262,7 @@ BodyPartDetails:
BodyPartDetailsOntology:
name: BodyPartDetailsOntology
description: |
- [URI](/02-common-principles.html#uniform-resource-indicator) of ontology used for
+ [URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator) of ontology used for
BodyPartDetails (for example: `"https://www.ebi.ac.uk/ols/ontologies/uberon"`).
type: string
format: uri
@@ -378,7 +378,7 @@ ChunkTransformationMatrixAxis:
Code:
name: Code
description: |
- [URI](/02-common-principles.html#uniform-resource-indicator)
+ [URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
of the code used to present the stimuli.
Persistent identifiers such as DOIs are preferred.
If multiple versions of code may be hosted at the same location,
@@ -388,7 +388,7 @@ Code:
CogAtlasID:
name: CogAtlasID
description: |
- [URI](/02-common-principles.html#uniform-resource-indicator)
+ [URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
of the corresponding [Cognitive Atlas](https://www.cognitiveatlas.org/)
Task term.
type: string
@@ -396,7 +396,7 @@ CogAtlasID:
CogPOID:
name: CogPOID
description: |
- [URI](/02-common-principles.html#uniform-resource-indicator)
+ [URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
of the corresponding [CogPO](http://www.cogpo.org/) term.
type: string
format: uri
@@ -446,9 +446,9 @@ DatasetDOI:
description: |
The Digital Object Identifier of the dataset (not the corresponding paper).
DOIs SHOULD be expressed as a valid
- [URI](/02-common-principles.html#uniform-resource-indicator);
+ [URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator);
bare DOIs such as `10.0.2.3/dfjj.10` are
- [DEPRECATED](/02-common-principles.html#definitions).
+ [DEPRECATED](SPEC_ROOT/02-common-principles.md#definitions).
type: string
format: uri
DatasetType:
@@ -547,7 +547,7 @@ DigitizedHeadPointsCoordinateSystem:
description: |
Defines the coordinate system for the digitized head points.
See
- [Appendix VIII](/99-appendices/08-coordinate-systems.html)
+ [Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
for a list of restricted keywords for coordinate systems.
If `"Other"`, provide definition of the coordinate system in
`"DigitizedHeadPointsCoordinateSystemDescription"`.
@@ -637,7 +637,7 @@ EEGCoordinateSystem:
Defines the coordinate system for the EEG sensors.
See
- [Appendix VIII](/99-appendices/08-coordinate-systems.html)
+ [Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
for a list of restricted keywords for coordinate systems.
If `"Other"`, provide definition of the coordinate system in
`EEGCoordinateSystemDescription`.
@@ -706,13 +706,13 @@ EchoTime:
(please note that the DICOM term is in milliseconds not seconds).
The data type number may apply to files from any MRI modality concerned with
a single value for this field, or to the files in a
- [file collection](/99-appendices/10-file-collections.html)
+ [file collection](SPEC_ROOT/99-appendices/10-file-collections.md)
where the value of this field is iterated using the
- [echo entity](/99-appendices/09-entities.html#echo).
+ [echo entity](SPEC_ROOT/99-appendices/09-entities.md#echo).
The data type array provides a value for each volume in a 4D dataset and
should only be used when the volume timing is critical for interpretation
of the data, such as in
- [ASL](/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#\
+ [ASL](SPEC_ROOT/04-modality-specific-files/01-magnetic-resonance-imaging-data.md#\
arterial-spin-labeling-perfusion-data)
or variable echo time fMRI sequences.
anyOf:
@@ -823,7 +823,7 @@ FiducialsCoordinateSystem:
Defines the coordinate system for the fiducials.
Preferably the same as the `"EEGCoordinateSystem"`.
See
- [Appendix VIII](/99-appendices/08-coordinate-systems.html)
+ [Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
for a list of restricted keywords for coordinate systems.
If `"Other"`, provide definition of the coordinate system in
`"FiducialsCoordinateSystemDescription"`.
@@ -881,13 +881,13 @@ FlipAngle:
Corresponds to: DICOM Tag 0018, 1314 `Flip Angle`.
The data type number may apply to files from any MRI modality concerned with
a single value for this field, or to the files in a
- [file collection](/99-appendices/10-file-collections.html)
+ [file collection](SPEC_ROOT/99-appendices/10-file-collections.md)
where the value of this field is iterated using the
- [flip entity](/99-appendices/09-entities.html#flip).
+ [flip entity](SPEC_ROOT/99-appendices/09-entities.md#flip).
The data type array provides a value for each volume in a 4D dataset and
should only be used when the volume timing is critical for interpretation of
the data, such as in
- [ASL](/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#\
+ [ASL](SPEC_ROOT/04-modality-specific-files/01-magnetic-resonance-imaging-data.md#\
arterial-spin-labeling-perfusion-data)
or variable flip angle fMRI sequences.
anyOf:
@@ -968,14 +968,14 @@ GeneticLevel:
Genetics.Database:
name: Genetics.Database
description: |
- [URI](/02-common-principles.html#uniform-resource-indicator)
+ [URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
of database where the dataset is hosted.
type: string
format: uri
Genetics.Dataset:
name: Genetics.Dataset
description: |
- [URI](/02-common-principles.html#uniform-resource-indicator)
+ [URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
where data can be retrieved.
type: string
format: uri
@@ -984,7 +984,7 @@ Genetics.Descriptors:
description: |
List of relevant descriptors (for example, journal articles) for dataset
using a valid
- [URI](/02-common-principles.html#uniform-resource-indicator)
+ [URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
when possible.
anyOf:
- type: string
@@ -1015,7 +1015,7 @@ HED:
name: HED
description: |
Hierarchical Event Descriptor (HED) information,
- see: [Appendix III](/99-appendices/03-hed.html) for details.
+ see: [Appendix III](SPEC_ROOT/99-appendices/03-hed.md) for details.
anyOf:
- type: string
- type: object
@@ -1067,7 +1067,7 @@ HeadCoilCoordinateSystem:
description: |
Defines the coordinate system for the head coils.
See
- [Appendix VIII](/99-appendices/08-coordinate-systems.html)
+ [Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
for a list of restricted keywords for coordinate systems.
If `"Other"`, provide definition of the coordinate system in
`HeadCoilCoordinateSystemDescription`.
@@ -1139,7 +1139,7 @@ ImageAcquisitionProtocol:
name: ImageAcquisitionProtocol
description: |
Description of the image acquisition protocol or
- [URI](/02-common-principles.html#uniform-resource-indicator)
+ [URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
(for example from [protocols.io](https://www.protocols.io/)).
type: string
ImageDecayCorrected:
@@ -1440,7 +1440,7 @@ License:
description: |
The license for the dataset.
The use of license name abbreviations is RECOMMENDED for specifying a license
- (see [Appendix II](/99-appendices/02-licenses.html)).
+ (see [Appendix II](SPEC_ROOT/99-appendices/02-licenses.md)).
The corresponding full license text MAY be specified in an additional
`LICENSE` file.
type: string
@@ -1487,7 +1487,7 @@ MEGCoordinateSystem:
name: MEGCoordinateSystem
description: |
Defines the coordinate system for the MEG sensors.
- See [Appendix VIII](/99-appendices/08-coordinate-systems.html)
+ See [Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
for a list of restricted keywords for coordinate systems.
If `"Other"`, provide definition of the coordinate system in
`"MEGCoordinateSystemDescription"`.
@@ -2119,7 +2119,7 @@ ReferencesAndLinks:
description: |
List of references to publications that contain information on the dataset.
A reference may be textual or a
- [URI](/02-common-principles.html#uniform-resource-indicator).
+ [URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator).
items:
type: string
type: array
@@ -2175,7 +2175,7 @@ RepetitionTimePreparation:
The data type array provides a value for each volume in a 4D dataset and
should only be used when the volume timing is critical for interpretation of
the data, such as in
- [ASL](/04-modality-specific-files/01-magnetic-resonance-imaging-data.html\
+ [ASL](SPEC_ROOT/04-modality-specific-files/01-magnetic-resonance-imaging-data.md\
#arterial-spin-labeling-perfusion-data).
anyOf:
- type: number
@@ -2228,7 +2228,7 @@ SampleExtractionProtocol:
name: SampleExtractionProtocol
description: |
Description of the sample extraction protocol or
- [URI](/02-common-principles.html#uniform-resource-indicator)
+ [URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)
(for example from [protocols.io](https://www.protocols.io/)).
type: string
SampleFixation:
@@ -2313,7 +2313,7 @@ ScanDate:
description: |
Date of scan in the format `"YYYY-MM-DD[Z]"`.
This field is DEPRECATED, and this metadata SHOULD be recorded in the `acq_time` column of the
- corresponding [Scans file](/03-modality-agnostic-files.html#scans-file).
+ corresponding [Scans file](SPEC_ROOT/03-modality-agnostic-files.md#scans-file).
type: string
format: date
ScanOptions:
@@ -2477,7 +2477,7 @@ SourceDatasets:
description: |
Used to specify the locations and relevant attributes of all source datasets.
Valid keys in each object include `"URL"`, `"DOI"` (see
- [URI](/02-common-principles.html#uniform-resource-indicator)), and
+ [URI](SPEC_ROOT/02-common-principles.md#uniform-resource-indicator)), and
`"Version"` with
[string](https://www.w3schools.com/js/js_json_datatypes.asp)
values.
@@ -2775,7 +2775,7 @@ Units:
description: |
Measurement units for the associated file.
SI units in CMIXF formatting are RECOMMENDED
- (see [Units](/02-common-principles.html#units)).
+ (see [Units](SPEC_ROOT/02-common-principles.md#units)).
type: string
format: unit
VascularCrushing:
@@ -2934,7 +2934,7 @@ iEEGCoordinateSystem:
description: |
Defines the coordinate system for the iEEG sensors.
See
- [Appendix VIII](/99-appendices/08-coordinate-systems.html)
+ [Appendix VIII](SPEC_ROOT/99-appendices/08-coordinate-systems.md)
for a list of restricted keywords for coordinate systems.
If `"Other"`, provide definition of the coordinate system in
`iEEGCoordinateSystemDescription`.
diff --git a/src/schema/objects/suffixes.yaml b/src/schema/objects/suffixes.yaml
index 25ed8a5b8c..d9547aa795 100644
--- a/src/schema/objects/suffixes.yaml
+++ b/src/schema/objects/suffixes.yaml
@@ -463,7 +463,7 @@ blood:
name: Blood recording data
description: |
Blood measurements of radioactivity stored in
- [tabular files](/02-common-principles.html#tabular-files)
+ [tabular files](SPEC_ROOT/02-common-principles.md#tabular-files)
and located in the `pet/` directory along with the corresponding PET data.
bold:
name: Blood-Oxygen-Level Dependent image
@@ -579,11 +579,11 @@ pet:
phase:
name: Phase image
description: |
- [DEPRECATED](/02-common-principles.html#definitions).
+ [DEPRECATED](SPEC_ROOT/02-common-principles.md#definitions).
Phase information associated with magnitude information stored in BOLD
contrast.
This suffix should be replaced by the
- [`part-phase`](/99-appendices/09-entities.html#part)
+ [`part-phase`](SPEC_ROOT/99-appendices/09-entities.md#part)
in conjunction with the `bold` suffix.
anyOf:
- unit: arbitrary
diff --git a/tools/mkdocs_macros_bids/macros.py b/tools/mkdocs_macros_bids/macros.py
index d27aef4f6d..dba9bc03ce 100644
--- a/tools/mkdocs_macros_bids/macros.py
+++ b/tools/mkdocs_macros_bids/macros.py
@@ -71,9 +71,14 @@ def make_entity_definitions():
return text
-def make_glossary():
+def make_glossary(page_file=None):
"""Generate glossary.
+ Parameters
+ ----------
+ page_file : MkDocs File object | None
+ The file where this macro is called, provided by the "page.file" variable.
+
Returns
-------
text : str
@@ -82,17 +87,20 @@ def make_glossary():
"""
schemapath = utils.get_schema_path()
schema_obj = schema.load_schema(schemapath)
- text = render.make_glossary(schema_obj)
+ text = render.make_glossary(schema_obj, page_file=page_file)
return text
-def make_suffix_table(suffixes):
+def make_suffix_table(suffixes, page_file=None):
"""Generate a markdown table of suffix information.
Parameters
----------
suffixes : list of str
A list of the suffixes to include in the table.
+ page_file : MkDocs File object | None
+ The file where this macro is called, provided by the "page.file" variable.
+
Returns
-------
@@ -102,11 +110,11 @@ def make_suffix_table(suffixes):
"""
schemapath = utils.get_schema_path()
schema_obj = schema.load_schema(schemapath)
- table = render.make_suffix_table(schema_obj, suffixes)
+ table = render.make_suffix_table(schema_obj, suffixes, page_file=page_file)
return table
-def make_metadata_table(field_info):
+def make_metadata_table(field_info, page_file=None):
"""Generate a markdown table of metadata field information.
Parameters
@@ -118,6 +126,8 @@ def make_metadata_table(field_info):
Until requirement levels can be codified in the schema,
this argument will be dictionary, with the field names as keys and
the requirement levels as values.
+ page_file : MkDocs File object | None
+ The file where this macro is called, provided by the "page.file" variable.
Returns
-------
@@ -127,11 +137,11 @@ def make_metadata_table(field_info):
"""
schemapath = utils.get_schema_path()
schema_obj = schema.load_schema(schemapath)
- table = render.make_metadata_table(schema_obj, field_info)
+ table = render.make_metadata_table(schema_obj, field_info, page_file=page_file)
return table
-def make_columns_table(column_info):
+def make_columns_table(column_info, page_file=None):
"""Generate a markdown table of TSV column information.
Parameters
@@ -143,6 +153,8 @@ def make_columns_table(column_info):
Until requirement levels can be codified in the schema,
this argument will be a dictionary, with the column names as keys and
the requirement levels as values.
+ page_file : MkDocs File object | None
+ The file where this macro is called, provided by the "page.file" variable.
Returns
-------
@@ -152,7 +164,7 @@ def make_columns_table(column_info):
"""
schemapath = utils.get_schema_path()
schema_obj = schema.load_schema(schemapath)
- table = render.make_columns_table(schema_obj, column_info)
+ table = render.make_columns_table(schema_obj, column_info, page_file=page_file)
return table
diff --git a/tools/schemacode/schemacode/render.py b/tools/schemacode/schemacode/render.py
index c1b8872142..72d1e0ee0a 100644
--- a/tools/schemacode/schemacode/render.py
+++ b/tools/schemacode/schemacode/render.py
@@ -56,7 +56,7 @@ def make_entity_definitions(schema):
return text
-def make_glossary(schema):
+def make_glossary(schema, page_file=None):
"""Generate glossary.
Parameters
@@ -64,6 +64,8 @@ def make_glossary(schema):
schema : dict
The schema object, which is a dictionary with nested dictionaries and
lists stored within it.
+ page_file : MkDocs File object | None
+ The file where this macro is called, provided by the "page.file" variable.
Returns
-------
@@ -119,6 +121,11 @@ def make_glossary(schema):
obj_desc = obj_desc.replace("\n\n", " ")
# Otherwise a newline corresponds to a space
obj_desc = obj_desc.replace("\n", " ")
+ # Spec internal links need to be replaced
+ if page_file is not None:
+ relpath = os.sep.join([".."] * page_file.src_path.count(os.sep))
+ relpath = "." if not relpath else relpath
+ obj_desc = obj_desc.replace("SPEC_ROOT", relpath)
text += f'\n '
text += f"\n## {obj_key}\n\n"
@@ -403,13 +410,15 @@ def _remove_numeric_suffixes(string):
return table_str
-def make_suffix_table(schema, suffixes, tablefmt="github"):
+def make_suffix_table(schema, suffixes, page_file=None, tablefmt="github"):
"""Produce suffix table (markdown) based on requested suffixes.
Parameters
----------
schema : dict
suffixes : list of str
+ page_file : MkDocs File object | None
+ The file where this macro is called, provided by the "page.file" variable.
tablefmt : str
Returns
@@ -440,6 +449,11 @@ def make_suffix_table(schema, suffixes, tablefmt="github"):
description = description.replace("\n\n", " ")
# Otherwise a newline corresponds to a space
description = description.replace("\n", " ")
+ # Spec internal links need to be replaced
+ if page_file is not None:
+ relpath = os.sep.join([".."] * page_file.src_path.count(os.sep))
+ relpath = "." if not relpath else relpath
+ description = description.replace("SPEC_ROOT", relpath)
df.loc[suffix] = [suffix_info["name"], description]
@@ -452,7 +466,7 @@ def make_suffix_table(schema, suffixes, tablefmt="github"):
return table_str
-def make_metadata_table(schema, field_info, tablefmt="github"):
+def make_metadata_table(schema, field_info, page_file=None, tablefmt="github"):
"""Produce metadata table (markdown) based on requested fields.
Parameters
@@ -468,6 +482,8 @@ def make_metadata_table(schema, field_info, tablefmt="github"):
and the second string is additional table-specific information
about the metadata field that will be appended to the field's base
definition from the schema.
+ page_file : MkDocs File object | None
+ The file where this macro is called, provided by the "page.file" variable.
tablefmt : string, optional
The target table format. The default is "github" (GitHub format).
@@ -519,6 +535,11 @@ def make_metadata_table(schema, field_info, tablefmt="github"):
description = description.replace("\n\n", " ")
# Otherwise a newline corresponds to a space
description = description.replace("\n", " ")
+ # Spec internal links need to be replaced
+ if page_file is not None:
+ relpath = os.sep.join([".."] * page_file.src_path.count(os.sep))
+ relpath = "." if not relpath else relpath
+ description = description.replace("SPEC_ROOT", relpath)
df.loc[field_name] = [requirement_info, type_string, description]
@@ -527,7 +548,7 @@ def make_metadata_table(schema, field_info, tablefmt="github"):
return table_str
-def make_columns_table(schema, column_info, tablefmt="github"):
+def make_columns_table(schema, column_info, page_file=None, tablefmt="github"):
"""Produce columns table (markdown) based on requested fields.
Parameters
@@ -543,6 +564,8 @@ def make_columns_table(schema, column_info, tablefmt="github"):
and the second string is additional table-specific information
about the column that will be appended to the column's base
definition from the schema.
+ page_file : MkDocs File object | None
+ The file where this macro is called, provided by the "page.file" variable.
tablefmt : string, optional
The target table format. The default is "github" (GitHub format).
@@ -583,6 +606,11 @@ def make_columns_table(schema, column_info, tablefmt="github"):
description = column_schema[field]["description"] + " " + description_addendum
+ if page_file is not None:
+ relpath = os.sep.join([".."] * page_file.src_path.count(os.sep))
+ relpath = "." if not relpath else relpath
+ description = description.replace("SPEC_ROOT", relpath)
+
# Try to add info about valid values
valid_values_str = utils.describe_valid_values(column_schema[field])
if valid_values_str:
diff --git a/tools/schemacode/schemacode/tests/test_render.py b/tools/schemacode/schemacode/tests/test_render.py
index 1a05e5b188..9c0f0a2e8e 100644
--- a/tools/schemacode/schemacode/tests/test_render.py
+++ b/tools/schemacode/schemacode/tests/test_render.py
@@ -4,6 +4,14 @@
from schemacode import render
+class TestFile:
+ pass
+
+
+test_file = TestFile()
+test_file.src_path = os.sep.join(["try", "this", "dict"])
+
+
def test_make_entity_definitions(schema_obj):
"""
Test whether expected format strings are present.
@@ -53,7 +61,7 @@ def test_make_glossary(schema_obj, schema_dir):
rule_files.append(rule_base)
rules_only = list(filter(lambda a: a not in object_files, rule_files))
- glossary = render.make_glossary(schema_obj)
+ glossary = render.make_glossary(schema_obj, page_file=test_file)
for line in glossary.split("\n"):
if line.startswith('