Skip to content

Commit 646bb1a

Browse files
authored
Merge pull request #467 from chrisfilo/enh/echospacing_check
Extra echo spacing check
2 parents d82c190 + 96847cf commit 646bb1a

File tree

4 files changed

+24
-27
lines changed

4 files changed

+24
-27
lines changed

utils/issues/list.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,21 +171,11 @@ module.exports = {
171171
severity: 'error',
172172
reason: "DWI scans should have a corresponding .bval file."
173173
},
174-
34: {
175-
key: 'PHASE_ENCODING_DIRECTION',
176-
severity: 'error',
177-
reason: "'PhaseEncodingDirection' needs to be one of 'i', 'i-, 'j', 'j-', 'k', or k-'"
178-
},
179174
36: {
180175
key: 'NIFTI_TOO_SMALL',
181176
severity: 'error',
182177
reason: "This file is too small to contain the minimal NIfTI header."
183178
},
184-
35: {
185-
key: 'SLICE_ENCODING_DIRECTION',
186-
severity: 'error',
187-
reason: "'SliceEncodingDirection' needs to be one of 'i', 'i-, 'j', 'j-', 'k', or k-'"
188-
},
189179
37: {
190180
key: 'INTENDED_FOR',
191181
severity: 'error',
@@ -376,5 +366,10 @@ module.exports = {
376366
key: 'NIFTI_PIXDIM4',
377367
severity: 'error',
378368
reason: "Nifti file's header is missing time dimension information."
369+
},
370+
76: {
371+
key: 'EFFECTIVEECHOSPACING_TOO_LARGE',
372+
severity: 'error',
373+
reason: "Abnormally high value of 'EffectiveEchoSpacing'."
379374
}
380375
};

validators/json.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,5 @@ function checkUnits (file, sidecar) {
8888
code: 5
8989
}));
9090
}
91-
if (sidecar.hasOwnProperty('PhaseEncodingDirection') && ["i", "i-", "j", "j-", "k", "k-"].indexOf(sidecar["PhaseEncodingDirection"]) == -1) {
92-
issues.push(new Issue({
93-
file: file,
94-
code: 34
95-
}));
96-
}
97-
if (sidecar.hasOwnProperty('SliceEncodingDirection') && ["i", "i-", "j", "j-", "k", "k-"].indexOf(sidecar["SliceEncodingDirection"]) == -1) {
98-
issues.push(new Issue({
99-
file: file,
100-
code: 35
101-
}));
102-
}
10391
return issues;
10492
}

validators/nii.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,15 @@ module.exports = function NIFTI (header, file, jsonContentsDict, bContentsDict,
157157
code: 10,
158158
reason: "You have to define 'RepetitionTime' for this file. " + sidecarMessage
159159
}));
160+
} else if (header && mergedDictionary.EffectiveEchoSpacing && mergedDictionary.PhaseEncodingDirection) {
161+
var axes = { i:0, j:1, k:2 };
162+
if (mergedDictionary.EffectiveEchoSpacing * header.dim[axes[mergedDictionary.PhaseEncodingDirection[0]]] > mergedDictionary.RepetitionTime){
163+
issues.push(new Issue({
164+
file: file,
165+
code: 76,
166+
reason: "Abnormally high value of 'EffectiveEchoSpacing' (" + mergedDictionary.EffectiveEchoSpacing + " seconds)."
167+
}));
168+
}
160169
}
161170

162171
if (typeof repetitionTime === 'undefined' && header) {

validators/schemas/bold.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,24 @@
99
"type": "string"
1010
},
1111
"EchoTime": {
12-
"type": "number"
12+
"type": "number",
13+
"exclusiveMinimum": 0
1314
},
1415
"EffectiveEchoSpacing": {
15-
"type": "number"
16+
"type": "number",
17+
"exclusiveMinimum": 0
1618
},
1719
"PhaseEncodingDirection": {
18-
"type": "string"
20+
"type": "string",
21+
"enum": ["i", "j", "k", "i-", "j-", "k-"]
1922
},
2023
"RepetitionTime": {
21-
"type": "number"
24+
"type": "number",
25+
"exclusiveMinimum": 0
2226
},
2327
"SliceEncodingDirection": {
24-
"type": "string"
28+
"type": "string",
29+
"enum": ["i", "j", "k", "i-", "j-", "k-"]
2530
},
2631
"SliceTiming": {
2732
"type": "array",

0 commit comments

Comments
 (0)