Skip to content

Commit 466e348

Browse files
committed
simplify?
1 parent 8c9cbb7 commit 466e348

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

validators/nii.js

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -159,29 +159,27 @@ module.exports = function NIFTI (header, file, jsonContentsDict, bContentsDict,
159159
}));
160160
}
161161

162-
if(header) {
163-
if (typeof repetitionTime === 'undefined') {
162+
if (typeof repetitionTime === 'undefined' && header) {
163+
issues.push(new Issue({
164+
file: file,
165+
code: 75
166+
}));
167+
}
168+
else if (mergedDictionary.RepetitionTime && header) {
169+
if (repetitionUnit !== 's') {
164170
issues.push(new Issue({
165171
file: file,
166-
code: 75
172+
code: 11
167173
}));
168-
}
169-
else if (mergedDictionary.RepetitionTime) {
170-
if (repetitionUnit !== 's') {
174+
} else {
175+
var niftiTR = Number((repetitionTime).toFixed(3));
176+
var jsonTR = Number((mergedDictionary.RepetitionTime).toFixed(3));
177+
if (niftiTR !== jsonTR) {
171178
issues.push(new Issue({
172179
file: file,
173-
code: 11
180+
code: 12,
181+
reason: "Repetition time defined in the JSON (" + jsonTR + " sec.) did not match the one defined in the NIFTI header (" + niftiTR + " sec.)"
174182
}));
175-
} else {
176-
var niftiTR = Number((repetitionTime).toFixed(3));
177-
var jsonTR = Number((mergedDictionary.RepetitionTime).toFixed(3));
178-
if (niftiTR !== jsonTR) {
179-
issues.push(new Issue({
180-
file: file,
181-
code: 12,
182-
reason: "Repetition time defined in the JSON (" + jsonTR + " sec.) did not match the one defined in the NIFTI header (" + niftiTR + " sec.)"
183-
}));
184-
}
185183
}
186184
}
187185
}

0 commit comments

Comments
 (0)