From c0915eb1f178c34abcd1381a343ee91195cec691 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 14 Aug 2024 10:36:25 -0400 Subject: [PATCH] [FIX] Allow (but discourage) task entity for coordsystem.json --- .../electroencephalography.md | 6 ++++++ .../intracranial-electroencephalography.md | 6 ++++++ .../magnetoencephalography.md | 5 +++++ .../near-infrared-spectroscopy.md | 6 ++++++ .../checks/{electrodes.yaml => channels.yaml} | 14 ++++++++++++++ src/schema/rules/files/raw/channels.yaml | 1 + 6 files changed, 38 insertions(+) rename src/schema/rules/checks/{electrodes.yaml => channels.yaml} (55%) diff --git a/src/modality-specific-files/electroencephalography.md b/src/modality-specific-files/electroencephalography.md index 8a584bb7a0..cc11a55211 100644 --- a/src/modality-specific-files/electroencephalography.md +++ b/src/modality-specific-files/electroencephalography.md @@ -439,6 +439,12 @@ landmarks or fiducials during an EEG session/run, must be stored separately in the corresponding `*_T1w.json` or `*_T2w.json` file and should be expressed in voxels (starting from `[0, 0, 0]`). +`*_coordsystem.json` files SHOULD NOT be duplicated for each data file, +for example, across multiple tasks. +The [inheritance principle](../common-principles.md#the-inheritance-principle) MUST +be used to find the appropriate coordinate system description for a given data file. +If electrodes are repositioned, it is RECOMMENDED to use multiple sessions to indicate this. + ### Example `*_coordsystem.json` ```JSON diff --git a/src/modality-specific-files/intracranial-electroencephalography.md b/src/modality-specific-files/intracranial-electroencephalography.md index 096b96f97d..7b662d02e5 100644 --- a/src/modality-specific-files/intracranial-electroencephalography.md +++ b/src/modality-specific-files/intracranial-electroencephalography.md @@ -403,6 +403,12 @@ A guide for using macros can be found at --> {{ MACROS___make_sidecar_table("ieeg.iEEGCoordsystemPositions") }} +`*_coordsystem.json` files SHOULD NOT be duplicated for each data file, +for example, across multiple tasks. +The [inheritance principle](../common-principles.md#the-inheritance-principle) MUST +be used to find the appropriate coordinate system description for a given data file. +If electrodes are repositioned, it is RECOMMENDED to use multiple sessions to indicate this. + ### Recommended 3D coordinate systems It is preferred that electrodes are localized in a 3D coordinate system (with diff --git a/src/modality-specific-files/magnetoencephalography.md b/src/modality-specific-files/magnetoencephalography.md index c3896a908e..50952d7f3c 100644 --- a/src/modality-specific-files/magnetoencephalography.md +++ b/src/modality-specific-files/magnetoencephalography.md @@ -429,6 +429,11 @@ For more information on typical coordinate systems for MEG-MRI coregistration: or: [Coordinate Systems - Brainstorm toolbox](https://neuroimage.usc.edu/brainstorm/CoordinateSystems) +`*_coordsystem.json` files SHOULD NOT be duplicated for each data file, +for example, across multiple tasks. +The [inheritance principle](../common-principles.md#the-inheritance-principle) MUST +be used to find the appropriate coordinate system description for a given data file. + ## Landmark photos (`*_photo.`) Photos of the anatomical landmarks and/or head localization coils diff --git a/src/modality-specific-files/near-infrared-spectroscopy.md b/src/modality-specific-files/near-infrared-spectroscopy.md index 7382560a43..01f5372d03 100644 --- a/src/modality-specific-files/near-infrared-spectroscopy.md +++ b/src/modality-specific-files/near-infrared-spectroscopy.md @@ -427,6 +427,12 @@ A guide for using macros can be found at {{ MACROS___make_sidecar_table(["nirs.AnatomicalLandmark", "nirs.AnatomicalLandmarkCoordinateSystemDescriptionRec"]) }} +`*_coordsystem.json` files SHOULD NOT be duplicated for each data file, +for example, across multiple tasks. +The [inheritance principle](../common-principles.md#the-inheritance-principle) MUST +be used to find the appropriate coordinate system description for a given data file. +If optodes are repositioned, it is RECOMMENDED to use multiple sessions to indicate this. + ### Example `*_coordsystem.json` ```json diff --git a/src/schema/rules/checks/electrodes.yaml b/src/schema/rules/checks/channels.yaml similarity index 55% rename from src/schema/rules/checks/electrodes.yaml rename to src/schema/rules/checks/channels.yaml index 29f81d3d44..20313860f3 100644 --- a/src/schema/rules/checks/electrodes.yaml +++ b/src/schema/rules/checks/channels.yaml @@ -13,3 +13,17 @@ ElectrodeSpecificity: checks: - '!("run" in entities)' - '!("acquisition" in entities)' + +CoordsystemSpecificity: + issue: + code: EXCESSIVE_COORDSYSTEM_SPECIFICITY + message: | + Task entities detected in coordsystem.tsv. + Coordinate systems should generally not vary by task. + Consider removing the excess entity. + level: warning + selectors: + - suffix == 'coordsystem' + - extension == '.json' + checks: + - '!("task" in entities)' diff --git a/src/schema/rules/files/raw/channels.yaml b/src/schema/rules/files/raw/channels.yaml index 25aa1deff3..14dc1bfb6a 100644 --- a/src/schema/rules/files/raw/channels.yaml +++ b/src/schema/rules/files/raw/channels.yaml @@ -45,6 +45,7 @@ coordsystem: entities: subject: required session: optional + task: optional acquisition: optional # (i)EEG has a space entity