From 4e1c1184ba8f10d7af959806c448f43bc69797d9 Mon Sep 17 00:00:00 2001 From: Matt Cieslak Date: Fri, 29 Mar 2024 14:56:17 -0400 Subject: [PATCH 01/15] add epi.bval, epi.bvec --- .../magnetic-resonance-imaging-data.md | 3 ++- src/schema/rules/files/raw/fmap.yaml | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 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..1b3a6e1bab 100644 --- a/src/modality-specific-files/magnetic-resonance-imaging-data.md +++ b/src/modality-specific-files/magnetic-resonance-imaging-data.md @@ -1253,7 +1253,8 @@ The phase-encoding polarity (PEpolar) technique combines two or more Spin Echo 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. +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/rules/files/raw/fmap.yaml b/src/schema/rules/files/raw/fmap.yaml index 056ed1d67e..575549ee82 100644 --- a/src/schema/rules/files/raw/fmap.yaml +++ b/src/schema/rules/files/raw/fmap.yaml @@ -24,7 +24,6 @@ fieldmaps: pepolar: suffixes: - epi - - m0scan extensions: - .nii.gz - .nii @@ -41,6 +40,17 @@ pepolar: part: optional chunk: optional +pepolar_m0scan: + $ref: rules.files.raw.fmap.pepolar + suffixes: + - m0scan + +pepolar_dwi: + $ref: rules.files.raw.fmap.pepolar + extensions: + - .bval + - .bvec + TB1DAM: suffixes: - TB1DAM From c70cc60296d134b85181be9a24da3c6f25f19ea7 Mon Sep 17 00:00:00 2001 From: Matt Cieslak Date: Fri, 29 Mar 2024 15:04:49 -0400 Subject: [PATCH 02/15] update contributors.md --- src/appendices/contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/appendices/contributors.md b/src/appendices/contributors.md index 2ffab4740f..ed8a3a46f4 100644 --- a/src/appendices/contributors.md +++ b/src/appendices/contributors.md @@ -257,6 +257,7 @@ If you contributed to the BIDS ecosystem and your name is not listed, please add | Mateusz Pawlik | πŸ“–πŸ›πŸ€”πŸš§πŸ‘€ | | Mathias Goncalves | πŸ’»πŸ”§πŸ“’ | | Mathieu Boudreau | πŸ’¬πŸ€”πŸ“’ | +| Matt Cieslak | πŸ“– | | Matt Sanderson | πŸ“–πŸ’» | | Matteo Tonietto | πŸ“– | | Matthias GΓΌnther | πŸ“– | From 72fb130e6c732cecbde02ee6d8327796531ca8a7 Mon Sep 17 00:00:00 2001 From: Matt Cieslak Date: Fri, 29 Mar 2024 15:12:16 -0400 Subject: [PATCH 03/15] add lines for sentence Co-authored-by: Taylor Salo --- .../magnetic-resonance-imaging-data.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modality-specific-files/magnetic-resonance-imaging-data.md b/src/modality-specific-files/magnetic-resonance-imaging-data.md index 1b3a6e1bab..6a393160ab 100644 --- a/src/modality-specific-files/magnetic-resonance-imaging-data.md +++ b/src/modality-specific-files/magnetic-resonance-imaging-data.md @@ -1253,8 +1253,8 @@ The phase-encoding polarity (PEpolar) technique combines two or more Spin Echo 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. +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`. From f9ffc23a2a4f2d5706bc9a655e7ca8d11e1bec55 Mon Sep 17 00:00:00 2001 From: Matt Cieslak Date: Fri, 29 Mar 2024 15:18:57 -0400 Subject: [PATCH 04/15] update preprocessed_data.yaml --- .../rules/files/deriv/preprocessed_data.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/schema/rules/files/deriv/preprocessed_data.yaml b/src/schema/rules/files/deriv/preprocessed_data.yaml index 5503b20050..4621447976 100644 --- a/src/schema/rules/files/deriv/preprocessed_data.yaml +++ b/src/schema/rules/files/deriv/preprocessed_data.yaml @@ -104,6 +104,20 @@ fmap_pepolar_common: space: optional description: optional +fmap_pepolar_m0scan: + $ref: rules.files.raw.fmap.pepolar_m0scan + entities: + $ref: rules.files.raw.fmap.pepolar_m0scan.entities + space: optional + description: optional + +fmap_pepolar_dwi: + $ref: rules.files.raw.fmap.pepolar_dwi + entities: + $ref: rules.files.raw.fmap.pepolar_dwi.entities + space: optional + description: optional + fmap_TB1DAM_common: $ref: rules.files.raw.fmap.TB1DAM entities: From 79689b183020c65e8f0e8b46fdeb3d8316f01a44 Mon Sep 17 00:00:00 2001 From: Matt Cieslak Date: Fri, 29 Mar 2024 15:20:43 -0400 Subject: [PATCH 05/15] override for m0scan --- src/schema/rules/files/deriv/preprocessed_data.yaml | 7 ------- src/schema/rules/files/raw/fmap.yaml | 10 +++++----- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/schema/rules/files/deriv/preprocessed_data.yaml b/src/schema/rules/files/deriv/preprocessed_data.yaml index 4621447976..abd268e12f 100644 --- a/src/schema/rules/files/deriv/preprocessed_data.yaml +++ b/src/schema/rules/files/deriv/preprocessed_data.yaml @@ -111,13 +111,6 @@ fmap_pepolar_m0scan: space: optional description: optional -fmap_pepolar_dwi: - $ref: rules.files.raw.fmap.pepolar_dwi - entities: - $ref: rules.files.raw.fmap.pepolar_dwi.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 575549ee82..13df8f477f 100644 --- a/src/schema/rules/files/raw/fmap.yaml +++ b/src/schema/rules/files/raw/fmap.yaml @@ -28,6 +28,8 @@ pepolar: - .nii.gz - .nii - .json + - .bval + - .bvec datatypes: - fmap entities: @@ -44,12 +46,10 @@ pepolar_m0scan: $ref: rules.files.raw.fmap.pepolar suffixes: - m0scan - -pepolar_dwi: - $ref: rules.files.raw.fmap.pepolar extensions: - - .bval - - .bvec + - .nii.gz + - .nii + - .json TB1DAM: suffixes: From b12405d068c1c1abf6c35375220df2b74734a4fa Mon Sep 17 00:00:00 2001 From: Matt Cieslak Date: Fri, 29 Mar 2024 15:28:01 -0400 Subject: [PATCH 06/15] Update src/schema/rules/files/deriv/preprocessed_data.yaml Co-authored-by: Taylor Salo --- src/schema/rules/files/deriv/preprocessed_data.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schema/rules/files/deriv/preprocessed_data.yaml b/src/schema/rules/files/deriv/preprocessed_data.yaml index abd268e12f..fb9da23f39 100644 --- a/src/schema/rules/files/deriv/preprocessed_data.yaml +++ b/src/schema/rules/files/deriv/preprocessed_data.yaml @@ -107,7 +107,7 @@ fmap_pepolar_common: fmap_pepolar_m0scan: $ref: rules.files.raw.fmap.pepolar_m0scan entities: - $ref: rules.files.raw.fmap.pepolar_m0scan.entities + $ref: rules.files.raw.fmap.pepolar.entities space: optional description: optional From 47c7ff341374f39eeb54a2d16c6c39e097cf4b4c Mon Sep 17 00:00:00 2001 From: Matt Cieslak Date: Fri, 29 Mar 2024 15:30:49 -0400 Subject: [PATCH 07/15] Whitespace and table pipes --- src/appendices/contributors.md | 2 +- src/modality-specific-files/magnetic-resonance-imaging-data.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/appendices/contributors.md b/src/appendices/contributors.md index ed8a3a46f4..01f9e8814d 100644 --- a/src/appendices/contributors.md +++ b/src/appendices/contributors.md @@ -257,7 +257,7 @@ If you contributed to the BIDS ecosystem and your name is not listed, please add | Mateusz Pawlik | πŸ“–πŸ›πŸ€”πŸš§πŸ‘€ | | Mathias Goncalves | πŸ’»πŸ”§πŸ“’ | | Mathieu Boudreau | πŸ’¬πŸ€”πŸ“’ | -| Matt Cieslak | πŸ“– | +| Matt Cieslak | πŸ“– | | Matt Sanderson | πŸ“–πŸ’» | | Matteo Tonietto | πŸ“– | | Matthias GΓΌnther | πŸ“– | diff --git a/src/modality-specific-files/magnetic-resonance-imaging-data.md b/src/modality-specific-files/magnetic-resonance-imaging-data.md index 6a393160ab..30a17b000e 100644 --- a/src/modality-specific-files/magnetic-resonance-imaging-data.md +++ b/src/modality-specific-files/magnetic-resonance-imaging-data.md @@ -1253,7 +1253,7 @@ The phase-encoding polarity (PEpolar) technique combines two or more Spin Echo 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. +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`. From da2ff5465e1843ece3332764b22a5326ae793e88 Mon Sep 17 00:00:00 2001 From: Matt Cieslak Date: Fri, 29 Mar 2024 15:59:43 -0400 Subject: [PATCH 08/15] remove ref --- src/schema/rules/files/raw/fmap.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/schema/rules/files/raw/fmap.yaml b/src/schema/rules/files/raw/fmap.yaml index 13df8f477f..79d5944feb 100644 --- a/src/schema/rules/files/raw/fmap.yaml +++ b/src/schema/rules/files/raw/fmap.yaml @@ -43,13 +43,23 @@ pepolar: chunk: optional pepolar_m0scan: - $ref: rules.files.raw.fmap.pepolar suffixes: - m0scan extensions: - .nii.gz - .nii - .json + datatypes: + - fmap + entities: + subject: required + session: optional + acquisition: optional + ceagent: optional + direction: required + run: optional + part: optional + chunk: optional TB1DAM: suffixes: From cfd11017e8577742f66f233289d188a87569ef40 Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Thu, 4 Apr 2024 11:59:02 -0400 Subject: [PATCH 09/15] Add EPI-with-b[val|vec] suffix checks. --- src/appendices/contributors.md | 1 - src/schema/rules/checks/dwi.yaml | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/appendices/contributors.md b/src/appendices/contributors.md index 01f9e8814d..2ffab4740f 100644 --- a/src/appendices/contributors.md +++ b/src/appendices/contributors.md @@ -257,7 +257,6 @@ If you contributed to the BIDS ecosystem and your name is not listed, please add | Mateusz Pawlik | πŸ“–πŸ›πŸ€”πŸš§πŸ‘€ | | Mathias Goncalves | πŸ’»πŸ”§πŸ“’ | | Mathieu Boudreau | πŸ’¬πŸ€”πŸ“’ | -| Matt Cieslak | πŸ“– | | Matt Sanderson | πŸ“–πŸ’» | | Matteo Tonietto | πŸ“– | | Matthias GΓΌnther | πŸ“– | 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 From 5801f2fe67edfccdcacf1f0af0f2c1931c09b252 Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Wed, 24 Apr 2024 13:25:53 -0400 Subject: [PATCH 10/15] Add EPI+bval check. --- src/schema/meta/associations.yaml | 4 ++-- src/schema/rules/checks/fmap.yaml | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) 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/rules/checks/fmap.yaml b/src/schema/rules/checks/fmap.yaml index af042351d8..6044f84235 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 + +EPIWithBValsHasHighBVals: + issue: + code: EPI_WITH_BVALS_HAS_HIGH_BVALS + message: | + EPI field maps with b-values should not include high b-values (i.e., b-values > 100). + level: error + selectors: + - datatype == "fmap" + - suffix == "epi" + - '"bval" in associations' + checks: + - max(associations.bval.rows[0]) > 100 From 389ab29c9d60d7c62ad77657bad6f4017f7a3050 Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Wed, 24 Apr 2024 13:27:09 -0400 Subject: [PATCH 11/15] Remove Latin phrase. --- src/schema/rules/checks/fmap.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schema/rules/checks/fmap.yaml b/src/schema/rules/checks/fmap.yaml index 6044f84235..c484a40684 100644 --- a/src/schema/rules/checks/fmap.yaml +++ b/src/schema/rules/checks/fmap.yaml @@ -54,7 +54,7 @@ EPIWithBValsHasHighBVals: issue: code: EPI_WITH_BVALS_HAS_HIGH_BVALS message: | - EPI field maps with b-values should not include high b-values (i.e., b-values > 100). + EPI field maps with b-values should not include high b-values (in essence, b-values > 100). level: error selectors: - datatype == "fmap" From abd2a5bf931f15932e851ff47184afff74de37ff Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Wed, 24 Apr 2024 13:59:56 -0400 Subject: [PATCH 12/15] Update src/schema/rules/checks/fmap.yaml Co-authored-by: Chris Markiewicz --- src/schema/rules/checks/fmap.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/schema/rules/checks/fmap.yaml b/src/schema/rules/checks/fmap.yaml index c484a40684..6bbc122325 100644 --- a/src/schema/rules/checks/fmap.yaml +++ b/src/schema/rules/checks/fmap.yaml @@ -50,11 +50,11 @@ MagnitudeFileWithTooManyDimensions: checks: - nifti_header.dim[0] == 3 -EPIWithBValsHasHighBVals: +EPISmallBVals: issue: - code: EPI_WITH_BVALS_HAS_HIGH_BVALS + code: EPI_WITH_BVALS_NEEDS_SMALL_BVALS message: | - EPI field maps with b-values should not include high b-values (in essence, b-values > 100). + EPI field maps with b-values should include small (b<100) values. level: error selectors: - datatype == "fmap" From aa954f0d2abaa8003859995b37cab46e963ca677 Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Wed, 24 Apr 2024 14:00:56 -0400 Subject: [PATCH 13/15] Change max to min. --- src/schema/rules/checks/fmap.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schema/rules/checks/fmap.yaml b/src/schema/rules/checks/fmap.yaml index 6bbc122325..2cdb04e613 100644 --- a/src/schema/rules/checks/fmap.yaml +++ b/src/schema/rules/checks/fmap.yaml @@ -61,4 +61,4 @@ EPISmallBVals: - suffix == "epi" - '"bval" in associations' checks: - - max(associations.bval.rows[0]) > 100 + - min(associations.bval.rows[0]) > 100 From 0cf5c0abbe519c11a1e41d66ea2f00014500a11a Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Wed, 24 Apr 2024 14:29:16 -0400 Subject: [PATCH 14/15] Address review. --- src/schema/meta/context.yaml | 5 +++++ src/schema/rules/checks/fmap.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) 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/fmap.yaml b/src/schema/rules/checks/fmap.yaml index 2cdb04e613..b6e8e621cc 100644 --- a/src/schema/rules/checks/fmap.yaml +++ b/src/schema/rules/checks/fmap.yaml @@ -61,4 +61,4 @@ EPISmallBVals: - suffix == "epi" - '"bval" in associations' checks: - - min(associations.bval.rows[0]) > 100 + - min(associations.bval.values) < 100 From 7e5eae91fc8ff3654ed541e2247fceaa17caafbb Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Wed, 24 Apr 2024 14:30:53 -0400 Subject: [PATCH 15/15] Bump schema version. --- src/schema/SCHEMA_VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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