Skip to content

Commit

Permalink
Merge pull request #31 from rii-mango/FIX/method0-fix-in-ts
Browse files Browse the repository at this point in the history
Fix/method0 fix in ts
  • Loading branch information
hanayik authored May 12, 2023
2 parents f145529 + 6c156e8 commit 968fd76
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dist/src/nifti1.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion dist/src/nifti1.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/nifti1.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nifti-reader-js",
"version": "0.6.5",
"version": "0.6.6",
"description": "A JavaScript NIfTI file format reader.",
"main": "dist/src/nifti.js",
"types": "dist/src/nifti.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions release/current/nifti-reader-min.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion release/current/nifti-reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2483,7 +2483,12 @@
this.qoffset_x = utilities_1.Utils.getFloatAt(rawData, 268, this.littleEndian);
this.qoffset_y = utilities_1.Utils.getFloatAt(rawData, 272, this.littleEndian);
this.qoffset_z = utilities_1.Utils.getFloatAt(rawData, 276, this.littleEndian);
if (this.qform_code > 0) {
if (this.qform_code < 1 && this.sform_code < 1) {
this.affine[0][0] = this.pixDims[1];
this.affine[1][1] = this.pixDims[2];
this.affine[2][2] = this.pixDims[3];
}
if (this.qform_code > 0 && this.sform_code < this.qform_code) {
const a = this.quatern_a;
const b = this.quatern_b;
const c = this.quatern_c;
Expand Down
8 changes: 7 additions & 1 deletion src/nifti1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,13 @@ import { Utils } from "./utilities";
// Added by znshje on 27/11/2021
//
/* See: https://nifti.nimh.nih.gov/pub/dist/src/niftilib/nifti1.h */
if (this.qform_code > 0) {
if ((this.qform_code < 1) && (this.sform_code < 1)) {
// METHOD 0 (used when both SFORM and QFORM are unknown)
this.affine[0][0] = this.pixDims[1];
this.affine[1][1] = this.pixDims[2];
this.affine[2][2] = this.pixDims[3];
}
if ((this.qform_code > 0) && (this.sform_code < this.qform_code)) {
// METHOD 2 (used when qform_code > 0, which should be the "normal" case):
// ---------------------------------------------------------------------
// The (x,y,z) coordinates are given by the pixdim[] scales, a rotation
Expand Down

0 comments on commit 968fd76

Please sign in to comment.