Skip to content

Commit

Permalink
Merge pull request #567 from olgn/incorrect-header-dim-indexing
Browse files Browse the repository at this point in the history
fix magnitude and t1w dimension check
  • Loading branch information
chrisgorgo authored Sep 18, 2018
2 parents db97e26 + 88b1120 commit 78cc9ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions tests/headerField.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const assert = require('assert')
const headerFields = require('../validators/headerFields')

describe('headerFields', () => {
it('should throw an error if _magnitude1 or _magnitude2 files do not have exactly dimensions.', () => {
it('should throw an error if _magnitude1 or _magnitude2 files do not have exactly 3 dimensions.', () => {
const headers = [
// each of these headers has one too many dimensions on the 'dim' field.
[
Expand Down Expand Up @@ -69,9 +69,9 @@ describe('headerFields', () => {
relativePath: 'sub-01_magnitude1.nii',
},
{
dim: [4, 1, 1, 1],
pixdim: [4, 1, 1, 1],
xyzt_units: [4, 1, 1, 1],
dim: [3, 1, 1, 1],
pixdim: [3, 1, 1, 1],
xyzt_units: [3, 1, 1, 1],
},
],
[
Expand All @@ -80,9 +80,9 @@ describe('headerFields', () => {
relativePath: 'sub-01_magnitude2.nii',
},
{
dim: [4, 1, 1, 1],
pixdim: [4, 1, 1, 1],
xyzt_units: [4, 1, 1, 1],
dim: [3, 1, 1, 1],
pixdim: [3, 1, 1, 1],
xyzt_units: [3, 1, 1, 1],
},
],
]
Expand Down Expand Up @@ -131,8 +131,8 @@ describe('headerFields', () => {
relativePath: 'sub-01_T1w.nii',
},
{
dim: [4, 1, 1, 1],
pixdim: [4, 1, 1, 1],
dim: [3, 1, 1, 1],
pixdim: [3, 1, 1, 1],
xyzt_units: [4, 1, 1, 1],
},
],
Expand Down
4 changes: 2 additions & 2 deletions validators/headerFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ var headerField = function headerField(headers, field) {
} else if (
(file.name.indexOf('magnitude1') > -1 ||
file.name.indexOf('magnitude2') > -1) &&
header[field][0] !== 4
header[field].length !== 4
) {
issues[file.relativePath] = new Issue({
file: file,
code: 94,
evidence: 'this magnitude file has more than three dimensions. ',
})
} else if (file.name.indexOf('T1w') > -1 && header[field][0] !== 4) {
} else if (file.name.indexOf('T1w') > -1 && header[field].length !== 4) {
issues[file.relativePath] = new Issue({
file: file,
code: 95,
Expand Down

0 comments on commit 78cc9ce

Please sign in to comment.