Skip to content

Commit 07efb46

Browse files
committed
test: Add a test file with a couple kB of header extensions
1 parent f8e2997 commit 07efb46

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/files/nifti.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,23 @@ Deno.test('Test loading nifti header', async (t) => {
5353
})
5454
assertObjectMatch(error, { key: 'NIFTI_HEADER_UNREADABLE' })
5555
})
56+
57+
await t.step('Tolerate big headers', async () => {
58+
const path = 'big_header.nii.gz'
59+
const root = './tests/data/'
60+
const file = new BIDSFileDeno(root, path, ignore)
61+
let error: any = undefined
62+
const header = await loadHeader(file)
63+
assert(header !== undefined)
64+
assertObjectMatch(header, {
65+
dim: [3, 1, 1, 1, 1, 1, 1],
66+
pixdim: [1, 1, 1, 1, 1, 1, 1],
67+
shape: [1, 1, 1],
68+
voxel_sizes: [1, 1, 1],
69+
dim_info: { freq: 0, phase: 0, slice: 0 },
70+
xyzt_units: { xyz: 'unknown', t: 'unknown' },
71+
qform_code: 0,
72+
sform_code: 2,
73+
})
74+
})
5675
})

tests/data/big_header.nii.gz

119 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)