Skip to content

Commit

Permalink
Merge remote-tracking branch 'legacy/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Oct 31, 2024
2 parents fb6486e + 29cbc5c commit fbd9129
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bids-validator/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@hed/validator": "npm:[email protected]",
"@ignore": "npm:[email protected]",
"@libs/xml": "jsr:@libs/[email protected]",
"@mango/nifti": "npm:[email protected].8",
"@mango/nifti": "npm:@bids/[email protected].9",
"@std/assert": "jsr:@std/[email protected]",
"@std/fmt": "jsr:@std/[email protected]",
"@std/fs": "jsr:@std/[email protected]",
Expand Down
13 changes: 1 addition & 12 deletions bids-validator/src/files/nifti.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,11 @@ async function extract(buffer: Uint8Array, nbytes: number): Promise<Uint8Array>
return result
}

function readHeaderQuiet(buf: ArrayBuffer) {
const console_error = console.error
const console_log = console.log
console.error = (msg: string) => { logger.info(msg)}
console.log = (msg: string) => { logger.info(msg)}
const header = readHeader(buf)
console.error = console_error
console.log = console_log
return header
}

export async function loadHeader(file: BIDSFile): Promise<NiftiHeader> {
try {
const buf = await file.readBytes(1024)
const data = isCompressed(buf.buffer) ? await extract(buf, 540) : buf
const header = readHeaderQuiet(data.buffer)
const header = readHeader(data.buffer)
if (!header) {
throw { key: 'NIFTI_HEADER_UNREADABLE' }
}
Expand Down

0 comments on commit fbd9129

Please sign in to comment.