-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2036 from effigies/fix/nifti_reading
fix(nifti): Load NIfTI headers
- Loading branch information
Showing
3 changed files
with
59 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { isCompressed, readHeader } from 'https://esm.sh/[email protected]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { assert } from '../deps/asserts.ts' | ||
import { FileIgnoreRules } from './ignore.ts' | ||
import { BIDSFileDeno } from './deno.ts' | ||
|
||
import { loadHeader } from './nifti.ts' | ||
|
||
Deno.test('Test loading nifti header', async (t) => { | ||
const ignore = new FileIgnoreRules([]) | ||
await t.step('Load header from compressed file', async () => { | ||
const path = "sub-01/func/sub-01_task-rhymejudgment_bold.nii.gz" | ||
const root = "./tests/data/valid_headers" | ||
const file = new BIDSFileDeno(root, path, ignore) | ||
const header = await loadHeader(file) | ||
assert(header !== undefined) | ||
assert(header['pixdim'].length === 8) | ||
}) | ||
await t.step('Fail on non-nifti file', async () => { | ||
const path = "sub-01/func/sub-01_task-rhymejudgment_events.tsv" | ||
const root = "./tests/data/valid_headers" | ||
const file = new BIDSFileDeno(root, path, ignore) | ||
const header = await loadHeader(file) | ||
assert(header !== undefined) | ||
assert(header === null) | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters