nifti-reader-js
Advanced tools
Comparing version
{ | ||
"name": "nifti-reader-js", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "A JavaScript NIfTI file format reader.", | ||
@@ -5,0 +5,0 @@ "main": "src/nifti.js", |
# NIFTI-Reader-JS | ||
A JavaScript [NIfTI](http://nifti.nimh.nih.gov/) file format reader. This reader supports both NIfTI-1 and NIfT1-2 file formats, both compressed (.nii.gz) and uncompressed (.nii). Current [TODO](https://github.com/rii-mango/NIFTI-Reader-JS/wiki/TODO) list. | ||
A JavaScript [NIfTI](http://nifti.nimh.nih.gov/) file format reader. This reader supports both NIfTI-1 and NIfT1-2 file formats, both compressed (.nii.gz) and uncompressed (.nii). | ||
@@ -10,3 +10,4 @@ ###Usage | ||
var niftiHeader = null, | ||
niftiImage = null; | ||
niftiImage = null, | ||
niftiExt = null; | ||
@@ -17,6 +18,10 @@ if (nifti.isCompressed(data)) { | ||
if (nifti.isNIFTI1(data)) { | ||
if (nifti.isNIFTI(data)) { | ||
niftiHeader = nifti.readHeader(data); | ||
console.log(niftiHeader.toFormattedString()); | ||
niftiImage = nifti.readerImage(niftiHeader, data); | ||
niftiImage = nifti.readImage(niftiHeader, data); | ||
if (nifti.hasExtension(niftiHeader)) { | ||
niftiExt = nifti.readExtensionData(niftiHeader, data); | ||
} | ||
} | ||
@@ -23,0 +28,0 @@ ``` |
@@ -86,2 +86,6 @@ | ||
if (nifti.isCompressed(data)) { | ||
data = nifti.decompress(data); | ||
} | ||
if (nifti.isNIFTI1(data)) { | ||
@@ -95,2 +99,4 @@ header = new nifti.NIFTI1(); | ||
header.readHeader(data); | ||
} else { | ||
console.error("That file does not appear to be NIFTI!"); | ||
} | ||
@@ -97,0 +103,0 @@ |
@@ -245,7 +245,7 @@ | ||
string += ("Image Offset = " + this.vox_offset + "\n"); | ||
string += ("Data Scale: Slope = " + this.scl_slope + " Intercept = " + this.scl_inter+ "\n"); | ||
string += ("Data Scale: Slope = " + fmt(this.scl_slope) + " Intercept = " + fmt(this.scl_inter) + "\n"); | ||
string += ("Slice End = " + this.slice_end + "\n"); | ||
string += ("Slice Code = " + this.slice_code + "\n"); | ||
string += ("Units Code = " + this.xyzt_units + " (" + this.getUnitsCodeString(nifti.NIFTI1.SPATIAL_UNITS_MASK & this.xyzt_units) + ", " + this.getUnitsCodeString(nifti.NIFTI1.TEMPORAL_UNITS_MASK & this.xyzt_units) + ")\n"); | ||
string += ("Display Range: Max = " + this.cal_max + " Min = " + this.cal_min + "\n"); | ||
string += ("Display Range: Max = " + fmt(this.cal_max) + " Min = " + fmt(this.cal_min) + "\n"); | ||
string += ("Slice Duration = " + this.slice_duration + "\n"); | ||
@@ -252,0 +252,0 @@ string += ("Time Axis Shift = " + this.toffset + "\n"); |
@@ -201,4 +201,4 @@ | ||
string += ("Image Offset = " + this.vox_offset + "\n"); | ||
string += ("Data Scale: Slope = " + this.scl_slope + " Intercept = " + this.scl_inter+ "\n"); | ||
string += ("Display Range: Max = " + this.cal_max + " Min = " + this.cal_min + "\n"); | ||
string += ("Data Scale: Slope = " + fmt(this.scl_slope) + " Intercept = " + fmt(this.scl_inter) + "\n"); | ||
string += ("Display Range: Max = " + fmt(this.cal_max) + " Min = " + fmt(this.cal_min) + "\n"); | ||
string += ("Slice Duration = " + this.slice_duration + "\n"); | ||
@@ -205,0 +205,0 @@ string += ("Time Axis Shift = " + this.toffset + "\n"); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
8357
0.12%64
8.47%2806029
-62.32%