Skip to content

Commit 968fd76

Browse files
authored
Merge pull request #31 from rii-mango/FIX/method0-fix-in-ts
Fix/method0 fix in ts
2 parents f145529 + 6c156e8 commit 968fd76

File tree

8 files changed

+28
-11
lines changed

8 files changed

+28
-11
lines changed

dist/src/nifti1.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/nifti1.js

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/nifti1.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nifti-reader-js",
3-
"version": "0.6.5",
3+
"version": "0.6.6",
44
"description": "A JavaScript NIfTI file format reader.",
55
"main": "dist/src/nifti.js",
66
"types": "dist/src/nifti.d.ts",

release/current/nifti-reader-min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release/current/nifti-reader.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2483,7 +2483,12 @@
24832483
this.qoffset_x = utilities_1.Utils.getFloatAt(rawData, 268, this.littleEndian);
24842484
this.qoffset_y = utilities_1.Utils.getFloatAt(rawData, 272, this.littleEndian);
24852485
this.qoffset_z = utilities_1.Utils.getFloatAt(rawData, 276, this.littleEndian);
2486-
if (this.qform_code > 0) {
2486+
if (this.qform_code < 1 && this.sform_code < 1) {
2487+
this.affine[0][0] = this.pixDims[1];
2488+
this.affine[1][1] = this.pixDims[2];
2489+
this.affine[2][2] = this.pixDims[3];
2490+
}
2491+
if (this.qform_code > 0 && this.sform_code < this.qform_code) {
24872492
const a = this.quatern_a;
24882493
const b = this.quatern_b;
24892494
const c = this.quatern_c;

src/nifti1.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,13 @@ import { Utils } from "./utilities";
255255
// Added by znshje on 27/11/2021
256256
//
257257
/* See: https://nifti.nimh.nih.gov/pub/dist/src/niftilib/nifti1.h */
258-
if (this.qform_code > 0) {
258+
if ((this.qform_code < 1) && (this.sform_code < 1)) {
259+
// METHOD 0 (used when both SFORM and QFORM are unknown)
260+
this.affine[0][0] = this.pixDims[1];
261+
this.affine[1][1] = this.pixDims[2];
262+
this.affine[2][2] = this.pixDims[3];
263+
}
264+
if ((this.qform_code > 0) && (this.sform_code < this.qform_code)) {
259265
// METHOD 2 (used when qform_code > 0, which should be the "normal" case):
260266
// ---------------------------------------------------------------------
261267
// The (x,y,z) coordinates are given by the pixdim[] scales, a rotation

0 commit comments

Comments
 (0)