@cornerstonejs/nifti-volume-loader 1.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/esm/NiftiImageVolume.d.ts +21 -0
- package/dist/esm/NiftiImageVolume.js +26 -0
- package/dist/esm/NiftiImageVolume.js.map +1 -0
- package/dist/esm/constants/index.d.ts +2 -0
- package/dist/esm/constants/index.js +3 -0
- package/dist/esm/constants/index.js.map +1 -0
- package/dist/esm/constants/niftiLoaderScheme.d.ts +2 -0
- package/dist/esm/constants/niftiLoaderScheme.js +3 -0
- package/dist/esm/constants/niftiLoaderScheme.js.map +1 -0
- package/dist/esm/cornerstoneNiftiImageLoader.d.ts +7 -0
- package/dist/esm/cornerstoneNiftiImageLoader.js +10 -0
- package/dist/esm/cornerstoneNiftiImageLoader.js.map +1 -0
- package/dist/esm/enums/Events.d.ts +5 -0
- package/dist/esm/enums/Events.js +7 -0
- package/dist/esm/enums/Events.js.map +1 -0
- package/dist/esm/enums/index.d.ts +2 -0
- package/dist/esm/enums/index.js +3 -0
- package/dist/esm/enums/index.js.map +1 -0
- package/dist/esm/helpers/affineUtilities.d.ts +8 -0
- package/dist/esm/helpers/affineUtilities.js +45 -0
- package/dist/esm/helpers/affineUtilities.js.map +1 -0
- package/dist/esm/helpers/convert.d.ts +19 -0
- package/dist/esm/helpers/convert.js +83 -0
- package/dist/esm/helpers/convert.js.map +1 -0
- package/dist/esm/helpers/fetchAndAllocateNiftiVolume.d.ts +4 -0
- package/dist/esm/helpers/fetchAndAllocateNiftiVolume.js +163 -0
- package/dist/esm/helpers/fetchAndAllocateNiftiVolume.js.map +1 -0
- package/dist/esm/helpers/index.d.ts +4 -0
- package/dist/esm/helpers/index.js +5 -0
- package/dist/esm/helpers/index.js.map +1 -0
- package/dist/esm/helpers/makeVolumeMetadata.d.ts +2 -0
- package/dist/esm/helpers/makeVolumeMetadata.js +51 -0
- package/dist/esm/helpers/makeVolumeMetadata.js.map +1 -0
- package/dist/esm/helpers/modalityScaleNifti.d.ts +1 -0
- package/dist/esm/helpers/modalityScaleNifti.js +11 -0
- package/dist/esm/helpers/modalityScaleNifti.js.map +1 -0
- package/dist/esm/helpers/niftiConstants.d.ts +43 -0
- package/dist/esm/helpers/niftiConstants.js +44 -0
- package/dist/esm/helpers/niftiConstants.js.map +1 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/umd/index.js +3 -0
- package/dist/umd/index.js.LICENSE.txt +1 -0
- package/dist/umd/index.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
declare const NIFTI_TYPE_UINT8 = 2;
|
|
2
|
+
declare const NIFTI_TYPE_INT16 = 4;
|
|
3
|
+
declare const NIFTI_TYPE_INT32 = 8;
|
|
4
|
+
declare const NIFTI_TYPE_FLOAT32 = 16;
|
|
5
|
+
declare const NIFTI_TYPE_COMPLEX64 = 32;
|
|
6
|
+
declare const NIFTI_TYPE_FLOAT64 = 64;
|
|
7
|
+
declare const NIFTI_TYPE_RGB24 = 128;
|
|
8
|
+
declare const NIFTI_TYPE_INT8 = 256;
|
|
9
|
+
declare const NIFTI_TYPE_UINT16 = 512;
|
|
10
|
+
declare const NIFTI_TYPE_UINT32 = 768;
|
|
11
|
+
declare const NIFTI_TYPE_INT64 = 1024;
|
|
12
|
+
declare const NIFTI_TYPE_UINT64 = 1280;
|
|
13
|
+
declare const NIFTI_TYPE_FLOAT128 = 1536;
|
|
14
|
+
declare const NIFTI_TYPE_COMPLEX128 = 1792;
|
|
15
|
+
declare const NIFTI_TYPE_COMPLEX256 = 2048;
|
|
16
|
+
declare const NIFTI_TYPE_RGBA32 = 2304;
|
|
17
|
+
declare const NIFTI2_HEADER_TOTAL_LENGTH_BYTES = 540;
|
|
18
|
+
declare const NIFTI2_HEADER_TOTAL_LENGTH_BITS = 4320;
|
|
19
|
+
declare const NIFTI1_HEADER_TOTAL_LENGTH_BYTES = 348;
|
|
20
|
+
declare const NIFTI1_HEADER_TOTAL_LENGTH_BITS = 2784;
|
|
21
|
+
declare const NIFTI2_HEADER_MAGIC_LENGTH_BYTES = 8;
|
|
22
|
+
declare const NIFTI2_HEADER_DESCRIPTION_LENGTH_BYTES = 80;
|
|
23
|
+
declare const NIFTI2_HEADER_AUX_FILE_LENGTH_BYTES = 24;
|
|
24
|
+
declare const NIFTI2_HEADER_INTENT_NAME_LENGTH_BYTES = 16;
|
|
25
|
+
declare const NIFTI2_HEADER_DIM_INFO_LENGTH_BYTES = 1;
|
|
26
|
+
declare const NIFTI2_HEADER_ENDOFFILE_LENGTH_BYTES = 15;
|
|
27
|
+
declare const NIFTI2_VOX_OFFSET_BYTES = 544;
|
|
28
|
+
declare const NIFTI2_HEADER_MAGIC_STRING = "n+2\0";
|
|
29
|
+
declare const NIFTI2_HEADER_ENDOFFILE_STRING = "000000000000000";
|
|
30
|
+
declare const NIFTI2_ALIGNED_ANAT = 2;
|
|
31
|
+
declare const NIFTI2_XYZT_UNITS_UNKNOWN = 0;
|
|
32
|
+
declare const NIFTI1_HEADER_MAGIC_LENGTH_BYTES = 4;
|
|
33
|
+
declare const NIFTI1_HEADER_DESCRIPTION_LENGTH_BYTES = 80;
|
|
34
|
+
declare const NIFTI1_HEADER_AUX_FILE_LENGTH_BYTES = 24;
|
|
35
|
+
declare const NIFTI1_HEADER_INTENT_NAME_LENGTH_BYTES = 16;
|
|
36
|
+
declare const NIFTI1_HEADER_DIM_INFO_LENGTH_BYTES = 1;
|
|
37
|
+
declare const NIFTI1_HEADER_ENDOFFILE_LENGTH_BYTES = 4;
|
|
38
|
+
declare const NIFTI1_VOX_OFFSET_BYTES = 352;
|
|
39
|
+
declare const NIFTI1_HEADER_MAGIC_STRING = "n+1\0";
|
|
40
|
+
declare const NIFTI1_HEADER_ENDOFFILE_STRING = "0000";
|
|
41
|
+
declare const NIFTI1_ALIGNED_ANAT = 2;
|
|
42
|
+
declare const NIFTI1_XYZT_UNITS_UNKNOWN = 0;
|
|
43
|
+
export { NIFTI_TYPE_UINT8, NIFTI_TYPE_INT16, NIFTI_TYPE_INT32, NIFTI_TYPE_FLOAT32, NIFTI_TYPE_COMPLEX64, NIFTI_TYPE_FLOAT64, NIFTI_TYPE_RGB24, NIFTI_TYPE_INT8, NIFTI_TYPE_UINT16, NIFTI_TYPE_UINT32, NIFTI_TYPE_INT64, NIFTI_TYPE_UINT64, NIFTI_TYPE_FLOAT128, NIFTI_TYPE_COMPLEX128, NIFTI_TYPE_COMPLEX256, NIFTI_TYPE_RGBA32, NIFTI2_HEADER_TOTAL_LENGTH_BYTES, NIFTI2_HEADER_TOTAL_LENGTH_BITS, NIFTI2_HEADER_MAGIC_LENGTH_BYTES, NIFTI2_HEADER_DESCRIPTION_LENGTH_BYTES, NIFTI2_HEADER_AUX_FILE_LENGTH_BYTES, NIFTI2_HEADER_INTENT_NAME_LENGTH_BYTES, NIFTI2_HEADER_DIM_INFO_LENGTH_BYTES, NIFTI2_HEADER_ENDOFFILE_LENGTH_BYTES, NIFTI2_VOX_OFFSET_BYTES, NIFTI2_HEADER_MAGIC_STRING, NIFTI2_HEADER_ENDOFFILE_STRING, NIFTI2_ALIGNED_ANAT, NIFTI2_XYZT_UNITS_UNKNOWN, NIFTI1_HEADER_TOTAL_LENGTH_BYTES, NIFTI1_HEADER_TOTAL_LENGTH_BITS, NIFTI1_HEADER_MAGIC_LENGTH_BYTES, NIFTI1_HEADER_DESCRIPTION_LENGTH_BYTES, NIFTI1_HEADER_AUX_FILE_LENGTH_BYTES, NIFTI1_HEADER_INTENT_NAME_LENGTH_BYTES, NIFTI1_HEADER_DIM_INFO_LENGTH_BYTES, NIFTI1_HEADER_ENDOFFILE_LENGTH_BYTES, NIFTI1_VOX_OFFSET_BYTES, NIFTI1_HEADER_MAGIC_STRING, NIFTI1_HEADER_ENDOFFILE_STRING, NIFTI1_ALIGNED_ANAT, NIFTI1_XYZT_UNITS_UNKNOWN, };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const NIFTI_TYPE_UINT8 = 2;
|
|
2
|
+
const NIFTI_TYPE_INT16 = 4;
|
|
3
|
+
const NIFTI_TYPE_INT32 = 8;
|
|
4
|
+
const NIFTI_TYPE_FLOAT32 = 16;
|
|
5
|
+
const NIFTI_TYPE_COMPLEX64 = 32;
|
|
6
|
+
const NIFTI_TYPE_FLOAT64 = 64;
|
|
7
|
+
const NIFTI_TYPE_RGB24 = 128;
|
|
8
|
+
const NIFTI_TYPE_INT8 = 256;
|
|
9
|
+
const NIFTI_TYPE_UINT16 = 512;
|
|
10
|
+
const NIFTI_TYPE_UINT32 = 768;
|
|
11
|
+
const NIFTI_TYPE_INT64 = 1024;
|
|
12
|
+
const NIFTI_TYPE_UINT64 = 1280;
|
|
13
|
+
const NIFTI_TYPE_FLOAT128 = 1536;
|
|
14
|
+
const NIFTI_TYPE_COMPLEX128 = 1792;
|
|
15
|
+
const NIFTI_TYPE_COMPLEX256 = 2048;
|
|
16
|
+
const NIFTI_TYPE_RGBA32 = 2304;
|
|
17
|
+
const NIFTI2_HEADER_TOTAL_LENGTH_BYTES = 540;
|
|
18
|
+
const NIFTI2_HEADER_TOTAL_LENGTH_BITS = 4320;
|
|
19
|
+
const NIFTI1_HEADER_TOTAL_LENGTH_BYTES = 348;
|
|
20
|
+
const NIFTI1_HEADER_TOTAL_LENGTH_BITS = 2784;
|
|
21
|
+
const NIFTI2_HEADER_MAGIC_LENGTH_BYTES = 8;
|
|
22
|
+
const NIFTI2_HEADER_DESCRIPTION_LENGTH_BYTES = 80;
|
|
23
|
+
const NIFTI2_HEADER_AUX_FILE_LENGTH_BYTES = 24;
|
|
24
|
+
const NIFTI2_HEADER_INTENT_NAME_LENGTH_BYTES = 16;
|
|
25
|
+
const NIFTI2_HEADER_DIM_INFO_LENGTH_BYTES = 1;
|
|
26
|
+
const NIFTI2_HEADER_ENDOFFILE_LENGTH_BYTES = 15;
|
|
27
|
+
const NIFTI2_VOX_OFFSET_BYTES = 544;
|
|
28
|
+
const NIFTI2_HEADER_MAGIC_STRING = 'n+2\0';
|
|
29
|
+
const NIFTI2_HEADER_ENDOFFILE_STRING = '000000000000000';
|
|
30
|
+
const NIFTI2_ALIGNED_ANAT = 2;
|
|
31
|
+
const NIFTI2_XYZT_UNITS_UNKNOWN = 0;
|
|
32
|
+
const NIFTI1_HEADER_MAGIC_LENGTH_BYTES = 4;
|
|
33
|
+
const NIFTI1_HEADER_DESCRIPTION_LENGTH_BYTES = 80;
|
|
34
|
+
const NIFTI1_HEADER_AUX_FILE_LENGTH_BYTES = 24;
|
|
35
|
+
const NIFTI1_HEADER_INTENT_NAME_LENGTH_BYTES = 16;
|
|
36
|
+
const NIFTI1_HEADER_DIM_INFO_LENGTH_BYTES = 1;
|
|
37
|
+
const NIFTI1_HEADER_ENDOFFILE_LENGTH_BYTES = 4;
|
|
38
|
+
const NIFTI1_VOX_OFFSET_BYTES = 352;
|
|
39
|
+
const NIFTI1_HEADER_MAGIC_STRING = 'n+1\0';
|
|
40
|
+
const NIFTI1_HEADER_ENDOFFILE_STRING = '0000';
|
|
41
|
+
const NIFTI1_ALIGNED_ANAT = 2;
|
|
42
|
+
const NIFTI1_XYZT_UNITS_UNKNOWN = 0;
|
|
43
|
+
export { NIFTI_TYPE_UINT8, NIFTI_TYPE_INT16, NIFTI_TYPE_INT32, NIFTI_TYPE_FLOAT32, NIFTI_TYPE_COMPLEX64, NIFTI_TYPE_FLOAT64, NIFTI_TYPE_RGB24, NIFTI_TYPE_INT8, NIFTI_TYPE_UINT16, NIFTI_TYPE_UINT32, NIFTI_TYPE_INT64, NIFTI_TYPE_UINT64, NIFTI_TYPE_FLOAT128, NIFTI_TYPE_COMPLEX128, NIFTI_TYPE_COMPLEX256, NIFTI_TYPE_RGBA32, NIFTI2_HEADER_TOTAL_LENGTH_BYTES, NIFTI2_HEADER_TOTAL_LENGTH_BITS, NIFTI2_HEADER_MAGIC_LENGTH_BYTES, NIFTI2_HEADER_DESCRIPTION_LENGTH_BYTES, NIFTI2_HEADER_AUX_FILE_LENGTH_BYTES, NIFTI2_HEADER_INTENT_NAME_LENGTH_BYTES, NIFTI2_HEADER_DIM_INFO_LENGTH_BYTES, NIFTI2_HEADER_ENDOFFILE_LENGTH_BYTES, NIFTI2_VOX_OFFSET_BYTES, NIFTI2_HEADER_MAGIC_STRING, NIFTI2_HEADER_ENDOFFILE_STRING, NIFTI2_ALIGNED_ANAT, NIFTI2_XYZT_UNITS_UNKNOWN, NIFTI1_HEADER_TOTAL_LENGTH_BYTES, NIFTI1_HEADER_TOTAL_LENGTH_BITS, NIFTI1_HEADER_MAGIC_LENGTH_BYTES, NIFTI1_HEADER_DESCRIPTION_LENGTH_BYTES, NIFTI1_HEADER_AUX_FILE_LENGTH_BYTES, NIFTI1_HEADER_INTENT_NAME_LENGTH_BYTES, NIFTI1_HEADER_DIM_INFO_LENGTH_BYTES, NIFTI1_HEADER_ENDOFFILE_LENGTH_BYTES, NIFTI1_VOX_OFFSET_BYTES, NIFTI1_HEADER_MAGIC_STRING, NIFTI1_HEADER_ENDOFFILE_STRING, NIFTI1_ALIGNED_ANAT, NIFTI1_XYZT_UNITS_UNKNOWN, };
|
|
44
|
+
//# sourceMappingURL=niftiConstants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"niftiConstants.js","sourceRoot":"","sources":["../../../src/helpers/niftiConstants.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAG/B,MAAM,gCAAgC,GAAG,GAAG,CAAC;AAC7C,MAAM,+BAA+B,GAAG,IAAI,CAAC;AAE7C,MAAM,gCAAgC,GAAG,GAAG,CAAC;AAC7C,MAAM,+BAA+B,GAAG,IAAI,CAAC;AAG7C,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAC3C,MAAM,sCAAsC,GAAG,EAAE,CAAC;AAClD,MAAM,mCAAmC,GAAG,EAAE,CAAC;AAC/C,MAAM,sCAAsC,GAAG,EAAE,CAAC;AAClD,MAAM,mCAAmC,GAAG,CAAC,CAAC;AAC9C,MAAM,oCAAoC,GAAG,EAAE,CAAC;AAChD,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAGpC,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAC3C,MAAM,8BAA8B,GAAG,iBAAiB,CAAC;AAGzD,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAEpC,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAC3C,MAAM,sCAAsC,GAAG,EAAE,CAAC;AAClD,MAAM,mCAAmC,GAAG,EAAE,CAAC;AAC/C,MAAM,sCAAsC,GAAG,EAAE,CAAC;AAClD,MAAM,mCAAmC,GAAG,CAAC,CAAC;AAC9C,MAAM,oCAAoC,GAAG,CAAC,CAAC;AAC/C,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAGpC,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAC3C,MAAM,8BAA8B,GAAG,MAAM,CAAC;AAG9C,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAEpC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,gCAAgC,EAChC,+BAA+B,EAC/B,gCAAgC,EAChC,sCAAsC,EACtC,mCAAmC,EACnC,sCAAsC,EACtC,mCAAmC,EACnC,oCAAoC,EACpC,uBAAuB,EACvB,0BAA0B,EAC1B,8BAA8B,EAC9B,mBAAmB,EACnB,yBAAyB,EACzB,gCAAgC,EAChC,+BAA+B,EAC/B,gCAAgC,EAChC,sCAAsC,EACtC,mCAAmC,EACnC,sCAAsC,EACtC,mCAAmC,EACnC,oCAAoC,EACpC,uBAAuB,EACvB,0BAA0B,EAC1B,8BAA8B,EAC9B,mBAAmB,EACnB,yBAAyB,GAC1B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import cornerstoneNiftiImageVolumeLoader from './cornerstoneNiftiImageLoader';
|
|
2
|
+
import NiftiImageVolume from './NiftiImageVolume';
|
|
3
|
+
import * as helpers from './helpers';
|
|
4
|
+
import * as Enums from './enums';
|
|
5
|
+
export { cornerstoneNiftiImageVolumeLoader, NiftiImageVolume, helpers, Enums };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import cornerstoneNiftiImageVolumeLoader from './cornerstoneNiftiImageLoader';
|
|
2
|
+
import NiftiImageVolume from './NiftiImageVolume';
|
|
3
|
+
import * as helpers from './helpers';
|
|
4
|
+
import * as Enums from './enums';
|
|
5
|
+
export { cornerstoneNiftiImageVolumeLoader, NiftiImageVolume, helpers, Enums };
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,iCAAiC,MAAM,+BAA+B,CAAC;AAC9E,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,iCAAiC,EAAE,gBAAgB,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@cornerstonejs/core"),require("gl-matrix")):"function"==typeof define&&define.amd?define(["@cornerstonejs/core","gl-matrix"],e):"object"==typeof exports?exports.cornerstoneNiftiVolumeLoader=e(require("@cornerstonejs/core"),require("gl-matrix")):t.cornerstoneNiftiVolumeLoader=e(t.cornerstone3D,t.window)}(self,(function(t,e){return function(){var n={237:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NIFTIEXTENSION=void 0,e.NIFTIEXTENSION=class{esize;ecode;edata;littleEndian;constructor(t,e,n,i){if(t%16!=0)throw new Error("This does not appear to be a NIFTI extension");this.esize=t,this.ecode=e,this.edata=n,this.littleEndian=i}toArrayBuffer(){let t=new Uint8Array(this.esize),e=new Uint8Array(this.edata);t.set(e,8);let n=new DataView(t.buffer);return n.setInt32(0,this.esize,this.littleEndian),n.setInt32(4,this.ecode,this.littleEndian),t.buffer}}},130:function(t,e,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&!("get"in r?!e.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,r)}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),r=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return r(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.readExtensionData=e.readExtension=e.readImage=e.hasExtension=e.readHeader=e.decompress=e.isCompressed=e.isNIFTI=e.isNIFTI2=e.isNIFTI1=e.NIFTIEXTENSION=e.Utils=e.NIFTI2=e.NIFTI1=void 0;const o=s(n(876)),a=n(232),l=n(103),f=n(517);var h=n(232);Object.defineProperty(e,"NIFTI1",{enumerable:!0,get:function(){return h.NIFTI1}});var u=n(103);Object.defineProperty(e,"NIFTI2",{enumerable:!0,get:function(){return u.NIFTI2}});var c=n(517);Object.defineProperty(e,"Utils",{enumerable:!0,get:function(){return c.Utils}});var d=n(237);function p(t,e=!1){var n,i,r,s;return!(t.byteLength<a.NIFTI1.STANDARD_HEADER_SIZE||((n=new DataView(t))&&(i=n.getUint8(a.NIFTI1.MAGIC_NUMBER_LOCATION)),r=n.getUint8(a.NIFTI1.MAGIC_NUMBER_LOCATION+1),s=n.getUint8(a.NIFTI1.MAGIC_NUMBER_LOCATION+2),!(e&&i===a.NIFTI1.MAGIC_NUMBER2[0]&&r===a.NIFTI1.MAGIC_NUMBER2[1]&&s===a.NIFTI1.MAGIC_NUMBER2[2]||i===a.NIFTI1.MAGIC_NUMBER[0]&&r===a.NIFTI1.MAGIC_NUMBER[1]&&s===a.NIFTI1.MAGIC_NUMBER[2])))}function g(t,e=!1){var n,i,r,s;return!(t.byteLength<a.NIFTI1.STANDARD_HEADER_SIZE||(i=(n=new DataView(t)).getUint8(l.NIFTI2.MAGIC_NUMBER_LOCATION),r=n.getUint8(l.NIFTI2.MAGIC_NUMBER_LOCATION+1),s=n.getUint8(l.NIFTI2.MAGIC_NUMBER_LOCATION+2),!(e&&i===l.NIFTI2.MAGIC_NUMBER2[0]&&r===l.NIFTI2.MAGIC_NUMBER2[1]&&s===l.NIFTI2.MAGIC_NUMBER2[2]||i===l.NIFTI2.MAGIC_NUMBER[0]&&r===l.NIFTI2.MAGIC_NUMBER[1]&&s===l.NIFTI2.MAGIC_NUMBER[2])))}function v(t){var e,n,i;if(t){if(n=(e=new DataView(t)).getUint8(0),i=e.getUint8(1),n===f.Utils.GUNZIP_MAGIC_COOKIE1)return!0;if(i===f.Utils.GUNZIP_MAGIC_COOKIE2)return!0}return!1}function m(t){return o.decompressSync(new Uint8Array(t)).buffer}Object.defineProperty(e,"NIFTIEXTENSION",{enumerable:!0,get:function(){return d.NIFTIEXTENSION}}),e.isNIFTI1=p,e.isNIFTI2=g,e.isNIFTI=function(t,e=!1){return p(t,e)||g(t,e)},e.isCompressed=v,e.decompress=m,e.readHeader=function(t,e=!1){var n=null;return v(t)&&(t=m(t)),p(t,e)?n=new a.NIFTI1:g(t,e)&&(n=new l.NIFTI2),n?n.readHeader(t):console.error("That file does not appear to be NIFTI!"),n},e.hasExtension=function(t){return 0!=t.extensionFlag[0]},e.readImage=function(t,e){var n=t.vox_offset,i=1,r=1;t.dims[4]&&(i=t.dims[4]),t.dims[5]&&(r=t.dims[5]);var s=t.dims[1]*t.dims[2]*t.dims[3]*i*r*(t.numBitsPerVoxel/8);return e.slice(n,n+s)},e.readExtension=function(t,e){var n=t.getExtensionLocation(),i=t.extensionSize;return e.slice(n,n+i)},e.readExtensionData=function(t,e){var n=t.getExtensionLocation(),i=t.extensionSize;return e.slice(n+8,n+i)}},232:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NIFTI1=void 0;const i=n(517);class r{littleEndian=!1;dim_info=0;dims=[];intent_p1=0;intent_p2=0;intent_p3=0;intent_code=0;datatypeCode=0;numBitsPerVoxel=0;slice_start=0;slice_end=0;slice_code=0;pixDims=[];vox_offset=0;scl_slope=1;scl_inter=0;xyzt_units=0;cal_max=0;cal_min=0;slice_duration=0;toffset=0;description="";aux_file="";intent_name="";qform_code=0;sform_code=0;quatern_a=0;quatern_b=0;quatern_c=0;quatern_d=0;qoffset_x=0;qoffset_y=0;qoffset_z=0;affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];qfac=1;quatern_R;magic="0";isHDR=!1;extensionFlag=[0,0,0,0];extensionSize=0;extensionCode=0;extensions=[];static TYPE_NONE=0;static TYPE_BINARY=1;static TYPE_UINT8=2;static TYPE_INT16=4;static TYPE_INT32=8;static TYPE_FLOAT32=16;static TYPE_COMPLEX64=32;static TYPE_FLOAT64=64;static TYPE_RGB24=128;static TYPE_INT8=256;static TYPE_UINT16=512;static TYPE_UINT32=768;static TYPE_INT64=1024;static TYPE_UINT64=1280;static TYPE_FLOAT128=1536;static TYPE_COMPLEX128=1792;static TYPE_COMPLEX256=2048;static XFORM_UNKNOWN=0;static XFORM_SCANNER_ANAT=1;static XFORM_ALIGNED_ANAT=2;static XFORM_TALAIRACH=3;static XFORM_MNI_152=4;static SPATIAL_UNITS_MASK=7;static TEMPORAL_UNITS_MASK=56;static UNITS_UNKNOWN=0;static UNITS_METER=1;static UNITS_MM=2;static UNITS_MICRON=3;static UNITS_SEC=8;static UNITS_MSEC=16;static UNITS_USEC=24;static UNITS_HZ=32;static UNITS_PPM=40;static UNITS_RADS=48;static MAGIC_COOKIE=348;static STANDARD_HEADER_SIZE=348;static MAGIC_NUMBER_LOCATION=344;static MAGIC_NUMBER=[110,43,49];static MAGIC_NUMBER2=[110,105,49];static EXTENSION_HEADER_SIZE=8;readHeader(t){var e,n,s,o,a=new DataView(t),l=i.Utils.getIntAt(a,0,this.littleEndian);if(l!==r.MAGIC_COOKIE&&(this.littleEndian=!0,l=i.Utils.getIntAt(a,0,this.littleEndian)),l!==r.MAGIC_COOKIE)throw new Error("This does not appear to be a NIFTI file!");for(this.dim_info=i.Utils.getByteAt(a,39),e=0;e<8;e+=1)o=40+2*e,this.dims[e]=i.Utils.getShortAt(a,o,this.littleEndian);for(this.intent_p1=i.Utils.getFloatAt(a,56,this.littleEndian),this.intent_p2=i.Utils.getFloatAt(a,60,this.littleEndian),this.intent_p3=i.Utils.getFloatAt(a,64,this.littleEndian),this.intent_code=i.Utils.getShortAt(a,68,this.littleEndian),this.datatypeCode=i.Utils.getShortAt(a,70,this.littleEndian),this.numBitsPerVoxel=i.Utils.getShortAt(a,72,this.littleEndian),this.slice_start=i.Utils.getShortAt(a,74,this.littleEndian),e=0;e<8;e+=1)o=76+4*e,this.pixDims[e]=i.Utils.getFloatAt(a,o,this.littleEndian);if(this.vox_offset=i.Utils.getFloatAt(a,108,this.littleEndian),this.scl_slope=i.Utils.getFloatAt(a,112,this.littleEndian),this.scl_inter=i.Utils.getFloatAt(a,116,this.littleEndian),this.slice_end=i.Utils.getShortAt(a,120,this.littleEndian),this.slice_code=i.Utils.getByteAt(a,122),this.xyzt_units=i.Utils.getByteAt(a,123),this.cal_max=i.Utils.getFloatAt(a,124,this.littleEndian),this.cal_min=i.Utils.getFloatAt(a,128,this.littleEndian),this.slice_duration=i.Utils.getFloatAt(a,132,this.littleEndian),this.toffset=i.Utils.getFloatAt(a,136,this.littleEndian),this.description=i.Utils.getStringAt(a,148,228),this.aux_file=i.Utils.getStringAt(a,228,252),this.qform_code=i.Utils.getShortAt(a,252,this.littleEndian),this.sform_code=i.Utils.getShortAt(a,254,this.littleEndian),this.quatern_b=i.Utils.getFloatAt(a,256,this.littleEndian),this.quatern_c=i.Utils.getFloatAt(a,260,this.littleEndian),this.quatern_d=i.Utils.getFloatAt(a,264,this.littleEndian),this.quatern_a=Math.sqrt(1-(Math.pow(this.quatern_b,2)+Math.pow(this.quatern_c,2)+Math.pow(this.quatern_d,2))),this.qoffset_x=i.Utils.getFloatAt(a,268,this.littleEndian),this.qoffset_y=i.Utils.getFloatAt(a,272,this.littleEndian),this.qoffset_z=i.Utils.getFloatAt(a,276,this.littleEndian),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]),this.qform_code>0&&this.sform_code<this.qform_code){const t=this.quatern_a,e=this.quatern_b,i=this.quatern_c,r=this.quatern_d;for(this.qfac=0===this.pixDims[0]?1:this.pixDims[0],this.quatern_R=[[t*t+e*e-i*i-r*r,2*e*i-2*t*r,2*e*r+2*t*i],[2*e*i+2*t*r,t*t+i*i-e*e-r*r,2*i*r-2*t*e],[2*e*r-2*t*i,2*i*r+2*t*e,t*t+r*r-i*i-e*e]],n=0;n<3;n+=1)for(s=0;s<3;s+=1)this.affine[n][s]=this.quatern_R[n][s]*this.pixDims[s+1],2===s&&(this.affine[n][s]*=this.qfac);this.affine[0][3]=this.qoffset_x,this.affine[1][3]=this.qoffset_y,this.affine[2][3]=this.qoffset_z}else if(this.sform_code>0)for(n=0;n<3;n+=1)for(s=0;s<4;s+=1)o=280+4*(4*n+s),this.affine[n][s]=i.Utils.getFloatAt(a,o,this.littleEndian);this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.intent_name=i.Utils.getStringAt(a,328,344),this.magic=i.Utils.getStringAt(a,344,348),this.isHDR=this.magic===String.fromCharCode.apply(null,r.MAGIC_NUMBER2),a.byteLength>r.MAGIC_COOKIE&&(this.extensionFlag[0]=i.Utils.getByteAt(a,348),this.extensionFlag[1]=i.Utils.getByteAt(a,349),this.extensionFlag[2]=i.Utils.getByteAt(a,350),this.extensionFlag[3]=i.Utils.getByteAt(a,351),this.extensionFlag[0]&&(this.extensions=i.Utils.getExtensionsAt(a,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode))}toFormattedString(){var t=i.Utils.formatNumber,e="";return e+="Dim Info = "+this.dim_info+"\n",e+="Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7]+"\n",e+="Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3+"\n",e+="Intent Code = "+this.intent_code+"\n",e+="Datatype = "+this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode)+")\n",e+="Bits Per Voxel = "+this.numBitsPerVoxel+"\n",e+="Slice Start = "+this.slice_start+"\n",e+="Voxel Dimensions (1-8): "+t(this.pixDims[0])+", "+t(this.pixDims[1])+", "+t(this.pixDims[2])+", "+t(this.pixDims[3])+", "+t(this.pixDims[4])+", "+t(this.pixDims[5])+", "+t(this.pixDims[6])+", "+t(this.pixDims[7])+"\n",e+="Image Offset = "+this.vox_offset+"\n",e+="Data Scale: Slope = "+t(this.scl_slope)+" Intercept = "+t(this.scl_inter)+"\n",e+="Slice End = "+this.slice_end+"\n",e+="Slice Code = "+this.slice_code+"\n",e+="Units Code = "+this.xyzt_units+" ("+this.getUnitsCodeString(r.SPATIAL_UNITS_MASK&this.xyzt_units)+", "+this.getUnitsCodeString(r.TEMPORAL_UNITS_MASK&this.xyzt_units)+")\n",e+="Display Range: Max = "+t(this.cal_max)+" Min = "+t(this.cal_min)+"\n",e+="Slice Duration = "+this.slice_duration+"\n",e+="Time Axis Shift = "+this.toffset+"\n",e+='Description: "'+this.description+'"\n',e+='Auxiliary File: "'+this.aux_file+'"\n',e+="Q-Form Code = "+this.qform_code+" ("+this.getTransformCodeString(this.qform_code)+")\n",e+="S-Form Code = "+this.sform_code+" ("+this.getTransformCodeString(this.sform_code)+")\n",e+="Quaternion Parameters: b = "+t(this.quatern_b)+" c = "+t(this.quatern_c)+" d = "+t(this.quatern_d)+"\n",e+="Quaternion Offsets: x = "+this.qoffset_x+" y = "+this.qoffset_y+" z = "+this.qoffset_z+"\n",e+="S-Form Parameters X: "+t(this.affine[0][0])+", "+t(this.affine[0][1])+", "+t(this.affine[0][2])+", "+t(this.affine[0][3])+"\n",e+="S-Form Parameters Y: "+t(this.affine[1][0])+", "+t(this.affine[1][1])+", "+t(this.affine[1][2])+", "+t(this.affine[1][3])+"\n",e+="S-Form Parameters Z: "+t(this.affine[2][0])+", "+t(this.affine[2][1])+", "+t(this.affine[2][2])+", "+t(this.affine[2][3])+"\n",e+='Intent Name: "'+this.intent_name+'"\n',this.extensionFlag[0]&&(e+="Extension: Size = "+this.extensionSize+" Code = "+this.extensionCode+"\n"),e}getDatatypeCodeString=function(t){return t===r.TYPE_UINT8?"1-Byte Unsigned Integer":t===r.TYPE_INT16?"2-Byte Signed Integer":t===r.TYPE_INT32?"4-Byte Signed Integer":t===r.TYPE_FLOAT32?"4-Byte Float":t===r.TYPE_FLOAT64?"8-Byte Float":t===r.TYPE_RGB24?"RGB":t===r.TYPE_INT8?"1-Byte Signed Integer":t===r.TYPE_UINT16?"2-Byte Unsigned Integer":t===r.TYPE_UINT32?"4-Byte Unsigned Integer":t===r.TYPE_INT64?"8-Byte Signed Integer":t===r.TYPE_UINT64?"8-Byte Unsigned Integer":"Unknown"};getTransformCodeString=function(t){return t===r.XFORM_SCANNER_ANAT?"Scanner":t===r.XFORM_ALIGNED_ANAT?"Aligned":t===r.XFORM_TALAIRACH?"Talairach":t===r.XFORM_MNI_152?"MNI":"Unknown"};getUnitsCodeString=function(t){return t===r.UNITS_METER?"Meters":t===r.UNITS_MM?"Millimeters":t===r.UNITS_MICRON?"Microns":t===r.UNITS_SEC?"Seconds":t===r.UNITS_MSEC?"Milliseconds":t===r.UNITS_USEC?"Microseconds":t===r.UNITS_HZ?"Hz":t===r.UNITS_PPM?"PPM":t===r.UNITS_RADS?"Rads":"Unknown"};getQformMat(){return this.convertNiftiQFormToNiftiSForm(this.quatern_b,this.quatern_c,this.quatern_d,this.qoffset_x,this.qoffset_y,this.qoffset_z,this.pixDims[1],this.pixDims[2],this.pixDims[3],this.pixDims[0])}convertNiftiQFormToNiftiSForm(t,e,n,i,r,s,o,a,l,f){var h,u,c,d,p=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],g=t,v=e,m=n;return p[3][0]=p[3][1]=p[3][2]=0,p[3][3]=1,(h=1-(g*g+v*v+m*m))<1e-7?(g*=h=1/Math.sqrt(g*g+v*v+m*m),v*=h,m*=h,h=0):h=Math.sqrt(h),u=o>0?o:1,c=a>0?a:1,d=l>0?l:1,f<0&&(d=-d),p[0][0]=(h*h+g*g-v*v-m*m)*u,p[0][1]=2*(g*v-h*m)*c,p[0][2]=2*(g*m+h*v)*d,p[1][0]=2*(g*v+h*m)*u,p[1][1]=(h*h+v*v-g*g-m*m)*c,p[1][2]=2*(v*m-h*g)*d,p[2][0]=2*(g*m-h*v)*u,p[2][1]=2*(v*m+h*g)*c,p[2][2]=(h*h+m*m-v*v-g*g)*d,p[0][3]=i,p[1][3]=r,p[2][3]=s,p}convertNiftiSFormToNEMA(t){var e,n,i,r,s,o,a,l,f,h,u,c,d,p,g,v,m,y,_,I,E,b,x,A,w,T,N,U,S,F,M,C,O;if(p=0,T=[[0,0,0],[0,0,0],[0,0,0]],N=[[0,0,0],[0,0,0],[0,0,0]],e=t[0][0],n=t[0][1],i=t[0][2],r=t[1][0],s=t[1][1],o=t[1][2],a=t[2][0],l=t[2][1],f=t[2][2],0===(h=Math.sqrt(e*e+r*r+a*a)))return null;if(e/=h,r/=h,a/=h,0===(h=Math.sqrt(n*n+s*s+l*l)))return null;if(h=e*(n/=h)+r*(s/=h)+a*(l/=h),Math.abs(h)>1e-4){if(n-=h*e,s-=h*r,l-=h*a,0===(h=Math.sqrt(n*n+s*s+l*l)))return null;n/=h,s/=h,l/=h}if(0===(h=Math.sqrt(i*i+o*o+f*f))?(i=r*l-a*s,o=a*n-l*e,f=e*s-r*n):(i/=h,o/=h,f/=h),h=e*i+r*o+a*f,Math.abs(h)>1e-4){if(i-=h*e,o-=h*r,f-=h*a,0===(h=Math.sqrt(i*i+o*o+f*f)))return null;i/=h,o/=h,f/=h}if(h=n*i+s*o+l*f,Math.abs(h)>1e-4){if(i-=h*n,o-=h*s,f-=h*l,0===(h=Math.sqrt(i*i+o*o+f*f)))return null;i/=h,o/=h,f/=h}if(T[0][0]=e,T[0][1]=n,T[0][2]=i,T[1][0]=r,T[1][1]=s,T[1][2]=o,T[2][0]=a,T[2][1]=l,T[2][2]=f,0===(u=this.nifti_mat33_determ(T)))return null;for(w=-666,y=E=b=x=1,_=2,I=3,c=1;c<=3;c+=1)for(d=1;d<=3;d+=1)if(c!==d)for(p=1;p<=3;p+=1)if(c!==p&&d!==p)for(N[0][0]=N[0][1]=N[0][2]=N[1][0]=N[1][1]=N[1][2]=N[2][0]=N[2][1]=N[2][2]=0,g=-1;g<=1;g+=2)for(v=-1;v<=1;v+=2)for(m=-1;m<=1;m+=2)N[0][c-1]=g,N[1][d-1]=v,N[2][p-1]=m,this.nifti_mat33_determ(N)*u>0&&(h=(A=this.nifti_mat33_mul(N,T))[0][0]+A[1][1]+A[2][2])>w&&(w=h,y=c,_=d,I=p,E=g,b=v,x=m);switch(U=S=F=M=C=O="",y*E){case 1:U="X",M="+";break;case-1:U="X",M="-";break;case 2:U="Y",M="+";break;case-2:U="Y",M="-";break;case 3:U="Z",M="+";break;case-3:U="Z",M="-"}switch(_*b){case 1:S="X",C="+";break;case-1:S="X",C="-";break;case 2:S="Y",C="+";break;case-2:S="Y",C="-";break;case 3:S="Z",C="+";break;case-3:S="Z",C="-"}switch(I*x){case 1:F="X",O="+";break;case-1:F="X",O="-";break;case 2:F="Y",O="+";break;case-2:F="Y",O="-";break;case 3:F="Z",O="+";break;case-3:F="Z",O="-"}return U+S+F+M+C+O}nifti_mat33_mul=function(t,e){var n,i,r=[[0,0,0],[0,0,0],[0,0,0]];for(n=0;n<3;n+=1)for(i=0;i<3;i+=1)r[n][i]=t[n][0]*e[0][i]+t[n][1]*e[1][i]+t[n][2]*e[2][i];return r};nifti_mat33_determ=function(t){var e,n,i,r,s,o,a,l,f;return e=t[0][0],n=t[0][1],i=t[0][2],r=t[1][0],s=t[1][1],o=t[1][2],a=t[2][0],l=t[2][1],e*s*(f=t[2][2])-e*l*o-r*n*f+r*l*i+a*n*o-a*s*i};getExtensionLocation(){return r.MAGIC_COOKIE+4}getExtensionSize(t){return i.Utils.getIntAt(t,this.getExtensionLocation(),this.littleEndian)}getExtensionCode(t){return i.Utils.getIntAt(t,this.getExtensionLocation()+4,this.littleEndian)}addExtension(t,e=-1){-1==e?this.extensions.push(t):this.extensions.splice(e,0,t),this.vox_offset+=t.esize}removeExtension(t){let e=this.extensions[t];e&&(this.vox_offset-=e.esize),this.extensions.splice(t,1)}toArrayBuffer(t=!1){let e=352;if(t)for(let t of this.extensions)e+=t.esize;let n=new Uint8Array(e),i=new DataView(n.buffer);i.setInt32(0,348,this.littleEndian),i.setUint8(39,this.dim_info);for(let t=0;t<8;t++)i.setUint16(40+2*t,this.dims[t],this.littleEndian);i.setFloat32(56,this.intent_p1,this.littleEndian),i.setFloat32(60,this.intent_p2,this.littleEndian),i.setFloat32(64,this.intent_p3,this.littleEndian),i.setInt16(68,this.intent_code,this.littleEndian),i.setInt16(70,this.datatypeCode,this.littleEndian),i.setInt16(72,this.numBitsPerVoxel,this.littleEndian),i.setInt16(74,this.slice_start,this.littleEndian);for(let t=0;t<8;t++)i.setFloat32(76+4*t,this.pixDims[t],this.littleEndian);i.setFloat32(108,this.vox_offset,this.littleEndian),i.setFloat32(112,this.scl_slope,this.littleEndian),i.setFloat32(116,this.scl_inter,this.littleEndian),i.setInt16(120,this.slice_end,this.littleEndian),i.setUint8(122,this.slice_code),i.setUint8(123,this.xyzt_units),i.setFloat32(124,this.cal_max,this.littleEndian),i.setFloat32(128,this.cal_min,this.littleEndian),i.setFloat32(132,this.slice_duration,this.littleEndian),i.setFloat32(136,this.toffset,this.littleEndian),n.set(Buffer.from(this.description),148),n.set(Buffer.from(this.aux_file),228),i.setInt16(252,this.qform_code,this.littleEndian),i.setInt16(254,this.sform_code,this.littleEndian),i.setFloat32(256,this.quatern_b,this.littleEndian),i.setFloat32(260,this.quatern_c,this.littleEndian),i.setFloat32(264,this.quatern_d,this.littleEndian),i.setFloat32(268,this.qoffset_x,this.littleEndian),i.setFloat32(272,this.qoffset_y,this.littleEndian),i.setFloat32(276,this.qoffset_z,this.littleEndian);const r=this.affine.flat();for(let t=0;t<12;t++)i.setFloat32(280+4*t,r[t],this.littleEndian);if(n.set(Buffer.from(this.intent_name),328),n.set(Buffer.from(this.magic),344),t){n.set(Uint8Array.from([1,0,0,0]),348);let t=this.getExtensionLocation();for(const e of this.extensions)i.setInt32(t,e.esize,e.littleEndian),i.setInt32(t+4,e.ecode,e.littleEndian),n.set(new Uint8Array(e.edata),t+8),t+=e.esize}else n.set(new Uint8Array(4).fill(0),348);return n.buffer}}e.NIFTI1=r},103:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NIFTI2=void 0;const i=n(232),r=n(517);class s{littleEndian=!1;dim_info=0;dims=[];intent_p1=0;intent_p2=0;intent_p3=0;intent_code=0;datatypeCode=0;numBitsPerVoxel=0;slice_start=0;slice_end=0;slice_code=0;pixDims=[];vox_offset=0;scl_slope=1;scl_inter=0;xyzt_units=0;cal_max=0;cal_min=0;slice_duration=0;toffset=0;description="";aux_file="";intent_name="";qform_code=0;sform_code=0;quatern_b=0;quatern_c=0;quatern_d=0;qoffset_x=0;qoffset_y=0;qoffset_z=0;affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];magic="0";extensionFlag=[0,0,0,0];extensions=[];extensionSize=0;extensionCode=0;static MAGIC_COOKIE=540;static MAGIC_NUMBER_LOCATION=4;static MAGIC_NUMBER=[110,43,50,0,13,10,26,10];static MAGIC_NUMBER2=[110,105,50,0,13,10,26,10];readHeader(t){var e,n,i,o,a=new DataView(t),l=r.Utils.getIntAt(a,0,this.littleEndian);if(l!==s.MAGIC_COOKIE&&(this.littleEndian=!0,l=r.Utils.getIntAt(a,0,this.littleEndian)),l!==s.MAGIC_COOKIE)throw new Error("This does not appear to be a NIFTI file!");for(this.magic=r.Utils.getStringAt(a,4,12),this.datatypeCode=r.Utils.getShortAt(a,12,this.littleEndian),this.numBitsPerVoxel=r.Utils.getShortAt(a,14,this.littleEndian),e=0;e<8;e+=1)o=16+8*e,this.dims[e]=r.Utils.getLongAt(a,o,this.littleEndian);for(this.intent_p1=r.Utils.getDoubleAt(a,80,this.littleEndian),this.intent_p2=r.Utils.getDoubleAt(a,88,this.littleEndian),this.intent_p3=r.Utils.getDoubleAt(a,96,this.littleEndian),e=0;e<8;e+=1)o=104+8*e,this.pixDims[e]=r.Utils.getDoubleAt(a,o,this.littleEndian);for(this.vox_offset=r.Utils.getLongAt(a,168,this.littleEndian),this.scl_slope=r.Utils.getDoubleAt(a,176,this.littleEndian),this.scl_inter=r.Utils.getDoubleAt(a,184,this.littleEndian),this.cal_max=r.Utils.getDoubleAt(a,192,this.littleEndian),this.cal_min=r.Utils.getDoubleAt(a,200,this.littleEndian),this.slice_duration=r.Utils.getDoubleAt(a,208,this.littleEndian),this.toffset=r.Utils.getDoubleAt(a,216,this.littleEndian),this.slice_start=r.Utils.getLongAt(a,224,this.littleEndian),this.slice_end=r.Utils.getLongAt(a,232,this.littleEndian),this.description=r.Utils.getStringAt(a,240,320),this.aux_file=r.Utils.getStringAt(a,320,344),this.qform_code=r.Utils.getIntAt(a,344,this.littleEndian),this.sform_code=r.Utils.getIntAt(a,348,this.littleEndian),this.quatern_b=r.Utils.getDoubleAt(a,352,this.littleEndian),this.quatern_c=r.Utils.getDoubleAt(a,360,this.littleEndian),this.quatern_d=r.Utils.getDoubleAt(a,368,this.littleEndian),this.qoffset_x=r.Utils.getDoubleAt(a,376,this.littleEndian),this.qoffset_y=r.Utils.getDoubleAt(a,384,this.littleEndian),this.qoffset_z=r.Utils.getDoubleAt(a,392,this.littleEndian),n=0;n<3;n+=1)for(i=0;i<4;i+=1)o=400+8*(4*n+i),this.affine[n][i]=r.Utils.getDoubleAt(a,o,this.littleEndian);this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.slice_code=r.Utils.getIntAt(a,496,this.littleEndian),this.xyzt_units=r.Utils.getIntAt(a,500,this.littleEndian),this.intent_code=r.Utils.getIntAt(a,504,this.littleEndian),this.intent_name=r.Utils.getStringAt(a,508,524),this.dim_info=r.Utils.getByteAt(a,524),a.byteLength>s.MAGIC_COOKIE&&(this.extensionFlag[0]=r.Utils.getByteAt(a,540),this.extensionFlag[1]=r.Utils.getByteAt(a,541),this.extensionFlag[2]=r.Utils.getByteAt(a,542),this.extensionFlag[3]=r.Utils.getByteAt(a,543),this.extensionFlag[0]&&(this.extensions=r.Utils.getExtensionsAt(a,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode))}toFormattedString(){var t=r.Utils.formatNumber,e="";return e+="Datatype = "+ +this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode)+")\n",e+="Bits Per Voxel = = "+this.numBitsPerVoxel+"\n",e+="Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7]+"\n",e+="Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3+"\n",e+="Voxel Dimensions (1-8): "+t(this.pixDims[0])+", "+t(this.pixDims[1])+", "+t(this.pixDims[2])+", "+t(this.pixDims[3])+", "+t(this.pixDims[4])+", "+t(this.pixDims[5])+", "+t(this.pixDims[6])+", "+t(this.pixDims[7])+"\n",e+="Image Offset = "+this.vox_offset+"\n",e+="Data Scale: Slope = "+t(this.scl_slope)+" Intercept = "+t(this.scl_inter)+"\n",e+="Display Range: Max = "+t(this.cal_max)+" Min = "+t(this.cal_min)+"\n",e+="Slice Duration = "+this.slice_duration+"\n",e+="Time Axis Shift = "+this.toffset+"\n",e+="Slice Start = "+this.slice_start+"\n",e+="Slice End = "+this.slice_end+"\n",e+='Description: "'+this.description+'"\n',e+='Auxiliary File: "'+this.aux_file+'"\n',e+="Q-Form Code = "+this.qform_code+" ("+this.getTransformCodeString(this.qform_code)+")\n",e+="S-Form Code = "+this.sform_code+" ("+this.getTransformCodeString(this.sform_code)+")\n",e+="Quaternion Parameters: b = "+t(this.quatern_b)+" c = "+t(this.quatern_c)+" d = "+t(this.quatern_d)+"\n",e+="Quaternion Offsets: x = "+this.qoffset_x+" y = "+this.qoffset_y+" z = "+this.qoffset_z+"\n",e+="S-Form Parameters X: "+t(this.affine[0][0])+", "+t(this.affine[0][1])+", "+t(this.affine[0][2])+", "+t(this.affine[0][3])+"\n",e+="S-Form Parameters Y: "+t(this.affine[1][0])+", "+t(this.affine[1][1])+", "+t(this.affine[1][2])+", "+t(this.affine[1][3])+"\n",e+="S-Form Parameters Z: "+t(this.affine[2][0])+", "+t(this.affine[2][1])+", "+t(this.affine[2][2])+", "+t(this.affine[2][3])+"\n",e+="Slice Code = "+this.slice_code+"\n",e+="Units Code = "+this.xyzt_units+" ("+this.getUnitsCodeString(i.NIFTI1.SPATIAL_UNITS_MASK&this.xyzt_units)+", "+this.getUnitsCodeString(i.NIFTI1.TEMPORAL_UNITS_MASK&this.xyzt_units)+")\n",e+="Intent Code = "+this.intent_code+"\n",(e+='Intent Name: "'+this.intent_name+'"\n')+"Dim Info = "+this.dim_info+"\n"}getExtensionLocation=function(){return s.MAGIC_COOKIE+4};getExtensionSize=i.NIFTI1.prototype.getExtensionSize;getExtensionCode=i.NIFTI1.prototype.getExtensionCode;addExtension=i.NIFTI1.prototype.addExtension;removeExtension=i.NIFTI1.prototype.removeExtension;getDatatypeCodeString=i.NIFTI1.prototype.getDatatypeCodeString;getTransformCodeString=i.NIFTI1.prototype.getTransformCodeString;getUnitsCodeString=i.NIFTI1.prototype.getUnitsCodeString;getQformMat=i.NIFTI1.prototype.getQformMat;convertNiftiQFormToNiftiSForm=i.NIFTI1.prototype.convertNiftiQFormToNiftiSForm;convertNiftiSFormToNEMA=i.NIFTI1.prototype.convertNiftiSFormToNEMA;nifti_mat33_mul=i.NIFTI1.prototype.nifti_mat33_mul;nifti_mat33_determ=i.NIFTI1.prototype.nifti_mat33_determ;toArrayBuffer(t=!1){let e=544;if(t)for(let t of this.extensions)e+=t.esize;let n=new Uint8Array(e),i=new DataView(n.buffer);i.setInt32(0,540,this.littleEndian),n.set(Buffer.from(this.magic),4),i.setInt16(12,this.datatypeCode,this.littleEndian),i.setInt16(14,this.numBitsPerVoxel,this.littleEndian);for(let t=0;t<8;t++)i.setBigInt64(16+8*t,BigInt(this.dims[t]),this.littleEndian);i.setFloat64(80,this.intent_p1,this.littleEndian),i.setFloat64(88,this.intent_p2,this.littleEndian),i.setFloat64(96,this.intent_p3,this.littleEndian);for(let t=0;t<8;t++)i.setFloat64(104+8*t,this.pixDims[t],this.littleEndian);i.setBigInt64(168,BigInt(this.vox_offset),this.littleEndian),i.setFloat64(176,this.scl_slope,this.littleEndian),i.setFloat64(184,this.scl_inter,this.littleEndian),i.setFloat64(192,this.cal_max,this.littleEndian),i.setFloat64(200,this.cal_min,this.littleEndian),i.setFloat64(208,this.slice_duration,this.littleEndian),i.setFloat64(216,this.toffset,this.littleEndian),i.setBigInt64(224,BigInt(this.slice_start),this.littleEndian),i.setBigInt64(232,BigInt(this.slice_end),this.littleEndian),n.set(Buffer.from(this.description),240),n.set(Buffer.from(this.aux_file),320),i.setInt32(344,this.qform_code,this.littleEndian),i.setInt32(348,this.sform_code,this.littleEndian),i.setFloat64(352,this.quatern_b,this.littleEndian),i.setFloat64(360,this.quatern_c,this.littleEndian),i.setFloat64(368,this.quatern_d,this.littleEndian),i.setFloat64(376,this.qoffset_x,this.littleEndian),i.setFloat64(384,this.qoffset_y,this.littleEndian),i.setFloat64(392,this.qoffset_z,this.littleEndian);const r=this.affine.flat();for(let t=0;t<12;t++)i.setFloat64(400+8*t,r[t],this.littleEndian);if(i.setInt32(496,this.slice_code,this.littleEndian),i.setInt32(500,this.xyzt_units,this.littleEndian),i.setInt32(504,this.intent_code,this.littleEndian),n.set(Buffer.from(this.intent_name),508),i.setUint8(524,this.dim_info),t){n.set(Uint8Array.from([1,0,0,0]),540);let t=this.getExtensionLocation();for(const e of this.extensions)i.setInt32(t,e.esize,e.littleEndian),i.setInt32(t+4,e.ecode,e.littleEndian),n.set(new Uint8Array(e.edata),t+8),t+=e.esize}else n.set(new Uint8Array(4).fill(0),540);return n.buffer}}e.NIFTI2=s},517:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Utils=void 0;const i=n(237);class r{static crcTable=null;static GUNZIP_MAGIC_COOKIE1=31;static GUNZIP_MAGIC_COOKIE2=139;static getStringAt(t,e,n){var i,r,s="";for(i=e;i<n;i+=1)0!==(r=t.getUint8(i))&&(s+=String.fromCharCode(r));return s}static getByteAt=function(t,e){return t.getInt8(e)};static getShortAt=function(t,e,n){return t.getInt16(e,n)};static getIntAt(t,e,n){return t.getInt32(e,n)}static getFloatAt(t,e,n){return t.getFloat32(e,n)}static getDoubleAt(t,e,n){return t.getFloat64(e,n)}static getLongAt(t,e,n){var i,s=[],o=0;for(i=0;i<8;i+=1)s[i]=r.getByteAt(t,e+i);for(i=s.length-1;i>=0;i--)o=256*o+s[i];return o}static getExtensionsAt(t,e,n,s){let o=[],a=e;for(;a<s;){let e=n,l=r.getIntAt(t,a,n);if(!l)break;if(l+a>s&&(e=!e,l=r.getIntAt(t,a,e),l+a>s))throw new Error("This does not appear to be a valid NIFTI extension");if(l%16!=0)throw new Error("This does not appear to be a NIFTI extension");let f=r.getIntAt(t,a+4,e),h=t.buffer.slice(a+8,a+l);console.log("extensionByteIndex: "+(a+8)+" esize: "+l),console.log(h);let u=new i.NIFTIEXTENSION(l,f,h,e);o.push(u),a+=l}return o}static toArrayBuffer(t){var e,n,i;for(e=new ArrayBuffer(t.length),n=new Uint8Array(e),i=0;i<t.length;i+=1)n[i]=t[i];return e}static isString(t){return"string"==typeof t||t instanceof String}static formatNumber(t,e=void 0){let n;return n=r.isString(t)?Number(t):t,n=e?n.toPrecision(5):n.toPrecision(7),parseFloat(n)}static makeCRCTable(){let t,e=[];for(var n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}static crc32(t){r.crcTable||(r.crcTable=r.makeCRCTable());const e=r.crcTable;let n=-1;for(var i=0;i<t.byteLength;i++)n=n>>>8^e[255&(n^t.getUint8(i))];return(-1^n)>>>0}}e.Utils=r},953:function(e){"use strict";e.exports=t},976:function(t){"use strict";t.exports=e},609:function(t,e,n){var i=n(425).default;function r(){"use strict";t.exports=r=function(){return e},t.exports.__esModule=!0,t.exports.default=t.exports;var e={},n=Object.prototype,s=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",f=a.asyncIterator||"@@asyncIterator",h=a.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,i){var r=e&&e.prototype instanceof g?e:g,s=Object.create(r.prototype),a=new U(i||[]);return o(s,"_invoke",{value:A(t,n,a)}),s}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var p={};function g(){}function v(){}function m(){}var y={};u(y,l,(function(){return this}));var _=Object.getPrototypeOf,I=_&&_(_(S([])));I&&I!==n&&s.call(I,l)&&(y=I);var E=m.prototype=g.prototype=Object.create(y);function b(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(r,o,a,l){var f=d(t[r],t,o);if("throw"!==f.type){var h=f.arg,u=h.value;return u&&"object"==i(u)&&s.call(u,"__await")?e.resolve(u.__await).then((function(t){n("next",t,a,l)}),(function(t){n("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return n("throw",t,a,l)}))}l(f.arg)}var r;o(this,"_invoke",{value:function(t,i){function s(){return new e((function(e,r){n(t,i,e,r)}))}return r=r?r.then(s,s):s()}})}function A(t,e,n){var i="suspendedStart";return function(r,s){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw s;return{value:void 0,done:!0}}for(n.method=r,n.arg=s;;){var o=n.delegate;if(o){var a=w(o,n);if(a){if(a===p)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function w(t,e){var n=e.method,i=t.iterator[n];if(void 0===i)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var r=d(i,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,p;var s=r.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function U(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function S(t){if(t){var e=t[l];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(s.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:F}}function F(){return{value:void 0,done:!0}}return v.prototype=m,o(E,"constructor",{value:m,configurable:!0}),o(m,"constructor",{value:v,configurable:!0}),v.displayName=u(m,h,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,h,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},b(x.prototype),u(x.prototype,f,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,i,r,s){void 0===s&&(s=Promise);var o=new x(c(t,n,i,r),s);return e.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},b(E),u(E,h,"Generator"),u(E,l,(function(){return this})),u(E,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var i in e)n.push(i);return n.reverse(),function t(){for(;n.length;){var i=n.pop();if(i in e)return t.value=i,t.done=!1,t}return t.done=!0,t}},e.values=S,U.prototype={constructor:U,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(N),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,i){return o.type="throw",o.arg=t,e.next=n,i&&(e.method="next",e.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i],o=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var a=s.call(r,"catchLoc"),l=s.call(r,"finallyLoc");if(a&&l){if(this.prev<r.catchLoc)return n(r.catchLoc,!0);if(this.prev<r.finallyLoc)return n(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return n(r.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return n(r.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var r=i;break}}r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=t,o.arg=e,r?(this.method="next",this.next=r.finallyLoc,p):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;N(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},425:function(t){function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},841:function(t,e,n){var i=n(609)();t.exports=i;try{regeneratorRuntime=i}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}},876:function(t,e,n){"use strict";var i=n(735),r=Uint8Array,s=Uint16Array,o=Int32Array,a=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),l=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),f=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),h=function(t,e){for(var n=new s(31),i=0;i<31;++i)n[i]=e+=1<<t[i-1];var r=new o(n[30]);for(i=1;i<30;++i)for(var a=n[i];a<n[i+1];++a)r[a]=a-n[i]<<5|i;return{b:n,r:r}},u=h(a,2),c=u.b,d=u.r;c[28]=258,d[258]=28;for(var p=h(l,0),g=p.b,v=p.r,m=new s(32768),y=0;y<32768;++y){var _=(43690&y)>>1|(21845&y)<<1;_=(61680&(_=(52428&_)>>2|(13107&_)<<2))>>4|(3855&_)<<4,m[y]=((65280&_)>>8|(255&_)<<8)>>1}var I=function(t,e,n){for(var i=t.length,r=0,o=new s(e);r<i;++r)t[r]&&++o[t[r]-1];var a,l=new s(e);for(r=1;r<e;++r)l[r]=l[r-1]+o[r-1]<<1;if(n){a=new s(1<<e);var f=15-e;for(r=0;r<i;++r)if(t[r])for(var h=r<<4|t[r],u=e-t[r],c=l[t[r]-1]++<<u,d=c|(1<<u)-1;c<=d;++c)a[m[c]>>f]=h}else for(a=new s(i),r=0;r<i;++r)t[r]&&(a[r]=m[l[t[r]-1]++]>>15-t[r]);return a},E=new r(288);for(y=0;y<144;++y)E[y]=8;for(y=144;y<256;++y)E[y]=9;for(y=256;y<280;++y)E[y]=7;for(y=280;y<288;++y)E[y]=8;var b=new r(32);for(y=0;y<32;++y)b[y]=5;var x=I(E,9,0),A=I(E,9,1),w=I(b,5,0),T=I(b,5,1),N=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},U=function(t,e,n){var i=e/8|0;return(t[i]|t[i+1]<<8)>>(7&e)&n},S=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},F=function(t){return(t+7)/8|0},M=function(t,e,n){(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length);var i=new r(n-e);return i.set(t.subarray(e,n)),i};e.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var C=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],O=function(t,e,n){var i=new Error(e||C[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,O),!n)throw i;return i},D=function(t,e,n,i){var s=t.length,o=i?i.length:0;if(!s||e.f&&!e.l)return n||new r(0);var h=!n||2!=e.i,u=e.i;n||(n=new r(3*s));var d=function(t){var e=n.length;if(t>e){var i=new r(Math.max(2*e,t));i.set(n),n=i}},p=e.f||0,v=e.p||0,m=e.b||0,y=e.l,_=e.d,E=e.m,b=e.n,x=8*s;do{if(!y){p=U(t,v,1);var w=U(t,v+1,3);if(v+=3,!w){var C=t[(Y=F(v)+4)-4]|t[Y-3]<<8,D=Y+C;if(D>s){u&&O(0);break}h&&d(m+C),n.set(t.subarray(Y,D),m),e.b=m+=C,e.p=v=8*D,e.f=p;continue}if(1==w)y=A,_=T,E=9,b=5;else if(2==w){var P=U(t,v,31)+257,z=U(t,v+10,15)+4,q=P+U(t,v+5,31)+1;v+=14;for(var L=new r(q),B=new r(19),R=0;R<z;++R)B[f[R]]=U(t,v+3*R,7);v+=3*z;var k=N(B),G=(1<<k)-1,j=I(B,k,1);for(R=0;R<q;){var Y,V=j[U(t,v,G)];if(v+=15&V,(Y=V>>4)<16)L[R++]=Y;else{var X=0,Z=0;for(16==Y?(Z=3+U(t,v,3),v+=2,X=L[R-1]):17==Y?(Z=3+U(t,v,7),v+=3):18==Y&&(Z=11+U(t,v,127),v+=7);Z--;)L[R++]=X}}var H=L.subarray(0,P),K=L.subarray(P);E=N(H),b=N(K),y=I(H,E,1),_=I(K,b,1)}else O(1);if(v>x){u&&O(0);break}}h&&d(m+131072);for(var Q=(1<<E)-1,W=(1<<b)-1,$=v;;$=v){var J=(X=y[S(t,v)&Q])>>4;if((v+=15&X)>x){u&&O(0);break}if(X||O(2),J<256)n[m++]=J;else{if(256==J){$=v,y=null;break}var tt=J-254;if(J>264){var et=a[R=J-257];tt=U(t,v,(1<<et)-1)+c[R],v+=et}var nt=_[S(t,v)&W],it=nt>>4;if(nt||O(3),v+=15&nt,K=g[it],it>3&&(et=l[it],K+=S(t,v)&(1<<et)-1,v+=et),v>x){u&&O(0);break}h&&d(m+131072);var rt=m+tt;if(m<K){var st=o-K,ot=Math.min(K,rt);for(st+m<0&&O(3);m<ot;++m)n[m]=i[st+m]}for(;m<rt;m+=4)n[m]=n[m-K],n[m+1]=n[m+1-K],n[m+2]=n[m+2-K],n[m+3]=n[m+3-K];m=rt}}e.l=y,e.p=$,e.b=m,e.f=p,y&&(p=1,e.m=E,e.d=_,e.n=b)}while(!p);return m==n.length?n:M(n,0,m)},P=function(t,e,n){n<<=7&e;var i=e/8|0;t[i]|=n,t[i+1]|=n>>8},z=function(t,e,n){n<<=7&e;var i=e/8|0;t[i]|=n,t[i+1]|=n>>8,t[i+2]|=n>>16},q=function(t,e){for(var n=[],i=0;i<t.length;++i)t[i]&&n.push({s:i,f:t[i]});var o=n.length,a=n.slice();if(!o)return{t:Y,l:0};if(1==o){var l=new r(n[0].s+1);return l[n[0].s]=1,{t:l,l:1}}n.sort((function(t,e){return t.f-e.f})),n.push({s:-1,f:25001});var f=n[0],h=n[1],u=0,c=1,d=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};c!=o-1;)f=n[n[u].f<n[d].f?u++:d++],h=n[u!=c&&n[u].f<n[d].f?u++:d++],n[c++]={s:-1,f:f.f+h.f,l:f,r:h};var p=a[0].s;for(i=1;i<o;++i)a[i].s>p&&(p=a[i].s);var g=new s(p+1),v=L(n[c-1],g,0);if(v>e){i=0;var m=0,y=v-e,_=1<<y;for(a.sort((function(t,e){return g[e.s]-g[t.s]||t.f-e.f}));i<o;++i){var I=a[i].s;if(!(g[I]>e))break;m+=_-(1<<v-g[I]),g[I]=e}for(m>>=y;m>0;){var E=a[i].s;g[E]<e?m-=1<<e-g[E]++-1:++i}for(;i>=0&&m;--i){var b=a[i].s;g[b]==e&&(--g[b],++m)}v=e}return{t:new r(g),l:v}},L=function(t,e,n){return-1==t.s?Math.max(L(t.l,e,n+1),L(t.r,e,n+1)):e[t.s]=n},B=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new s(++e),i=0,r=t[0],o=1,a=function(t){n[i++]=t},l=1;l<=e;++l)if(t[l]==r&&l!=e)++o;else{if(!r&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(r),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(r);o=1,r=t[l]}return{c:n.subarray(0,i),n:e}},R=function(t,e){for(var n=0,i=0;i<e.length;++i)n+=t[i]*e[i];return n},k=function(t,e,n){var i=n.length,r=F(e+2);t[r]=255&i,t[r+1]=i>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var s=0;s<i;++s)t[r+s+4]=n[s];return 8*(r+4+i)},G=function(t,e,n,i,r,o,h,u,c,d,p){P(e,p++,n),++r[256];for(var g=q(r,15),v=g.t,m=g.l,y=q(o,15),_=y.t,A=y.l,T=B(v),N=T.c,U=T.n,S=B(_),F=S.c,M=S.n,C=new s(19),O=0;O<N.length;++O)++C[31&N[O]];for(O=0;O<F.length;++O)++C[31&F[O]];for(var D=q(C,7),L=D.t,G=D.l,j=19;j>4&&!L[f[j-1]];--j);var Y,V,X,Z,H=d+5<<3,K=R(r,E)+R(o,b)+h,Q=R(r,v)+R(o,_)+h+14+3*j+R(C,L)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&H<=K&&H<=Q)return k(e,p,t.subarray(c,c+d));if(P(e,p,1+(Q<K)),p+=2,Q<K){Y=I(v,m,0),V=v,X=I(_,A,0),Z=_;var W=I(L,G,0);for(P(e,p,U-257),P(e,p+5,M-1),P(e,p+10,j-4),p+=14,O=0;O<j;++O)P(e,p+3*O,L[f[O]]);p+=3*j;for(var $=[N,F],J=0;J<2;++J){var tt=$[J];for(O=0;O<tt.length;++O){var et=31&tt[O];P(e,p,W[et]),p+=L[et],et>15&&(P(e,p,tt[O]>>5&127),p+=tt[O]>>12)}}}else Y=x,V=E,X=w,Z=b;for(O=0;O<u;++O){var nt=i[O];if(nt>255){z(e,p,Y[257+(et=nt>>18&31)]),p+=V[et+257],et>7&&(P(e,p,nt>>23&31),p+=a[et]);var it=31&nt;z(e,p,X[it]),p+=Z[it],it>3&&(z(e,p,nt>>5&8191),p+=l[it])}else z(e,p,Y[nt]),p+=V[nt]}return z(e,p,Y[256]),p+V[256]},j=new o([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Y=new r(0),V=function(t,e,n,i,f,h){var u=h.z||t.length,c=new r(i+u+5*(1+Math.ceil(u/7e3))+f),p=c.subarray(i,c.length-f),g=h.l,m=7&(h.r||0);if(e){m&&(p[0]=h.r>>3);for(var y=j[e-1],_=y>>13,I=8191&y,E=(1<<n)-1,b=h.p||new s(32768),x=h.h||new s(E+1),A=Math.ceil(n/3),w=2*A,T=function(e){return(t[e]^t[e+1]<<A^t[e+2]<<w)&E},N=new o(25e3),U=new s(288),S=new s(32),C=0,O=0,D=h.i||0,P=0,z=h.w||0,q=0;D+2<u;++D){var L=T(D),B=32767&D,R=x[L];if(b[B]=R,x[L]=B,z<=D){var Y=u-D;if((C>7e3||P>24576)&&(Y>423||!g)){m=G(t,p,0,N,U,S,O,P,q,D-q,m),P=C=O=0,q=D;for(var V=0;V<286;++V)U[V]=0;for(V=0;V<30;++V)S[V]=0}var X=2,Z=0,H=I,K=B-R&32767;if(Y>2&&L==T(D-K))for(var Q=Math.min(_,Y)-1,W=Math.min(32767,D),$=Math.min(258,Y);K<=W&&--H&&B!=R;){if(t[D+X]==t[D+X-K]){for(var J=0;J<$&&t[D+J]==t[D+J-K];++J);if(J>X){if(X=J,Z=K,J>Q)break;var tt=Math.min(K,J-2),et=0;for(V=0;V<tt;++V){var nt=D-K+V&32767,it=nt-b[nt]&32767;it>et&&(et=it,R=nt)}}}K+=(B=R)-(R=b[B])&32767}if(Z){N[P++]=268435456|d[X]<<18|v[Z];var rt=31&d[X],st=31&v[Z];O+=a[rt]+l[st],++U[257+rt],++S[st],z=D+X,++C}else N[P++]=t[D],++U[t[D]]}}for(D=Math.max(D,z);D<u;++D)N[P++]=t[D],++U[t[D]];m=G(t,p,g,N,U,S,O,P,q,D-q,m),g||(h.r=7&m|p[m/8|0]<<3,m-=7,h.h=x,h.p=b,h.i=D,h.w=z)}else{for(D=h.w||0;D<u+g;D+=65535){var ot=D+65535;ot>=u&&(p[m/8|0]=g,ot=u),m=k(p,m+1,t.subarray(D,ot))}h.i=u}return M(c,0,i+F(m)+f)},X=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var n=e,i=9;--i;)n=(1&n&&-306674912)^n>>>1;t[e]=n}return t}(),Z=function(){var t=-1;return{p:function(e){for(var n=t,i=0;i<e.length;++i)n=X[255&n^e[i]]^n>>>8;t=n},d:function(){return~t}}},H=function(){var t=1,e=0;return{p:function(n){for(var i=t,r=e,s=0|n.length,o=0;o!=s;){for(var a=Math.min(o+2655,s);o<a;++o)r+=i+=n[o];i=(65535&i)+15*(i>>16),r=(65535&r)+15*(r>>16)}t=i,e=r},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(e%=65521))<<8|e>>8}}},K=function(t,e,n,i,s){if(!s&&(s={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),a=new r(o.length+t.length);a.set(o),a.set(t,o.length),t=a,s.w=o.length}return V(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,i,s)},Q=function(t,e){var n={};for(var i in t)n[i]=t[i];for(var i in e)n[i]=e[i];return n},W=function(t,e,n){for(var i=t(),r=t.toString(),s=r.slice(r.indexOf("[")+1,r.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<i.length;++o){var a=i[o],l=s[o];if("function"==typeof a){e+=";"+l+"=";var f=a.toString();if(a.prototype)if(-1!=f.indexOf("[native code]")){var h=f.indexOf(" ",8)+1;e+=f.slice(h,f.indexOf("(",h))}else for(var u in e+=f,a.prototype)e+=";"+l+".prototype."+u+"="+a.prototype[u].toString();else e+=f}else n[l]=a}return e},$=[],J=function(t,e,n,r){if(!$[n]){for(var s="",o={},a=t.length-1,l=0;l<a;++l)s=W(t[l],s,o);$[n]={c:W(t[a],s,o),e:o}}var f=Q({},$[n].e);return i.default($[n].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",n,f,function(t){var e=[];for(var n in t)t[n].buffer&&e.push((t[n]=new t[n].constructor(t[n])).buffer);return e}(f),r)},tt=function(){return[r,s,o,a,l,f,c,g,A,T,m,C,I,N,U,S,F,M,O,D,St,ot,at]},et=function(){return[r,s,o,a,l,f,d,v,x,E,w,b,m,j,Y,I,P,z,q,L,B,R,k,G,F,M,V,K,wt,ot]},nt=function(){return[gt,yt,pt,Z,X]},it=function(){return[vt,mt]},rt=function(){return[_t,pt,H]},st=function(){return[It]},ot=function(t){return postMessage(t,[t.buffer])},at=function(t){return t&&{out:t.size&&new r(t.size),dictionary:t.dictionary}},lt=function(t,e,n,i,r,s){var o=J(n,i,r,(function(t,e){o.terminate(),s(t,e)}));return o.postMessage([t,e],e.consume?[t.buffer]:[]),function(){o.terminate()}},ft=function(t){return t.ondata=function(t,e){return postMessage([t,e],[t.buffer])},function(e){return t.push(e.data[0],e.data[1])}},ht=function(t,e,n,i,r,s){var o,a=J(t,i,r,(function(t,n){t?(a.terminate(),e.ondata.call(e,t)):Array.isArray(n)?(n[1]&&a.terminate(),e.ondata.call(e,t,n[0],n[1])):s(n)}));a.postMessage(n),e.push=function(t,n){e.ondata||O(5),o&&e.ondata(O(4,0,1),null,!!n),a.postMessage([t,o=n],[t.buffer])},e.terminate=function(){a.terminate()}},ut=function(t,e){return t[e]|t[e+1]<<8},ct=function(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0},dt=function(t,e){return ct(t,e)+4294967296*ct(t,e+4)},pt=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},gt=function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&pt(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var i=0;i<=n.length;++i)t[i+10]=n.charCodeAt(i)}},vt=function(t){31==t[0]&&139==t[1]&&8==t[2]||O(6,"invalid gzip data");var e=t[3],n=10;4&e&&(n+=2+(t[10]|t[11]<<8));for(var i=(e>>3&1)+(e>>4&1);i>0;i-=!t[n++]);return n+(2&e)},mt=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},yt=function(t){return 10+(t.filename?t.filename.length+1:0)},_t=function(t,e){var n=e.level,i=0==n?0:n<6?1:9==n?3:2;if(t[0]=120,t[1]=i<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var r=H();r.p(e.dictionary),pt(t,2,r.d())}},It=function(t,e){return(8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31)&&O(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&O(6,"invalid zlib data: "+(32&t[1]?"need":"unexpected")+" dictionary"),2+(t[1]>>3&4)};function Et(t,e){return"function"==typeof t&&(e=t,t={}),this.ondata=e,t}var bt=function(){function t(t,e){if("function"==typeof t&&(e=t,t={}),this.ondata=e,this.o=t||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new r(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return t.prototype.p=function(t,e){this.ondata(K(t,this.o,0,0,this.s),e)},t.prototype.push=function(t,e){this.ondata||O(5),this.s.l&&O(4);var n=t.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var i=new r(-32768&n);i.set(this.b.subarray(0,this.s.z)),this.b=i}var s=this.b.length-this.s.z;s&&(this.b.set(t.subarray(0,s),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(t.subarray(s),32768),this.s.z=t.length-s+32768,this.s.i=32766,this.s.w=32768}else this.b.set(t,this.s.z),this.s.z+=t.length;this.s.l=1&e,(this.s.z>this.s.w+8191||e)&&(this.p(this.b,e||!1),this.s.w=this.s.i,this.s.i-=2)},t}();e.Deflate=bt;var xt=function(){return function(t,e){ht([et,function(){return[ft,bt]}],this,Et.call(this,t,e),(function(t){var e=new bt(t.data);onmessage=ft(e)}),6)}}();function At(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&O(7),lt(t,e,[et],(function(t){return ot(wt(t.data[0],t.data[1]))}),0,n)}function wt(t,e){return K(t,e||{},0,0)}e.AsyncDeflate=xt,e.deflate=At,e.deflateSync=wt;var Tt=function(){function t(t,e){"function"==typeof t&&(e=t,t={}),this.ondata=e;var n=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new r(32768),this.p=new r(0),n&&this.o.set(n)}return t.prototype.e=function(t){if(this.ondata||O(5),this.d&&O(4),this.p.length){if(t.length){var e=new r(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length),this.p=e}}else this.p=t},t.prototype.c=function(t){this.s.i=+(this.d=t||!1);var e=this.s.b,n=D(this.p,this.s,this.o);this.ondata(M(n,e,this.s.b),this.d),this.o=M(n,this.s.b-32768),this.s.b=this.o.length,this.p=M(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,e){this.e(t),this.c(e)},t}();e.Inflate=Tt;var Nt=function(){return function(t,e){ht([tt,function(){return[ft,Tt]}],this,Et.call(this,t,e),(function(t){var e=new Tt(t.data);onmessage=ft(e)}),7)}}();function Ut(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&O(7),lt(t,e,[tt],(function(t){return ot(St(t.data[0],at(t.data[1])))}),1,n)}function St(t,e){return D(t,{i:2},e&&e.out,e&&e.dictionary)}e.AsyncInflate=Nt,e.inflate=Ut,e.inflateSync=St;var Ft=function(){function t(t,e){this.c=Z(),this.l=0,this.v=1,bt.call(this,t,e)}return t.prototype.push=function(t,e){this.c.p(t),this.l+=t.length,bt.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){var n=K(t,this.o,this.v&&yt(this.o),e&&8,this.s);this.v&&(gt(n,this.o),this.v=0),e&&(pt(n,n.length-8,this.c.d()),pt(n,n.length-4,this.l)),this.ondata(n,e)},t}();e.Gzip=Ft,e.Compress=Ft;var Mt=function(){return function(t,e){ht([et,nt,function(){return[ft,bt,Ft]}],this,Et.call(this,t,e),(function(t){var e=new Ft(t.data);onmessage=ft(e)}),8)}}();function Ct(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&O(7),lt(t,e,[et,nt,function(){return[Ot]}],(function(t){return ot(Ot(t.data[0],t.data[1]))}),2,n)}function Ot(t,e){e||(e={});var n=Z(),i=t.length;n.p(t);var r=K(t,e,yt(e),8),s=r.length;return gt(r,e),pt(r,s-8,n.d()),pt(r,s-4,i),r}e.AsyncGzip=Mt,e.AsyncCompress=Mt,e.gzip=Ct,e.compress=Ct,e.gzipSync=Ot,e.compressSync=Ot;var Dt=function(){function t(t,e){this.v=1,this.r=0,Tt.call(this,t,e)}return t.prototype.push=function(t,e){if(Tt.prototype.e.call(this,t),this.r+=t.length,this.v){var n=this.p.subarray(this.v-1),i=n.length>3?vt(n):4;if(i>n.length){if(!e)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(i),this.v=0}Tt.prototype.c.call(this,e),this.s.f&&!this.s.l&&(this.v=F(this.s.p)+9,this.s={i:0},this.o=new r(0),this.p.length&&this.push(new r(0),e))},t}();e.Gunzip=Dt;var Pt=function(){return function(t,e){var n=this;ht([tt,it,function(){return[ft,Tt,Dt]}],this,Et.call(this,t,e),(function(t){var e=new Dt(t.data);e.onmember=function(t){return postMessage(t)},onmessage=ft(e)}),9,(function(t){return n.onmember&&n.onmember(t)}))}}();function zt(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&O(7),lt(t,e,[tt,it,function(){return[qt]}],(function(t){return ot(qt(t.data[0],t.data[1]))}),3,n)}function qt(t,e){var n=vt(t);return n+8>t.length&&O(6,"invalid gzip data"),D(t.subarray(n,-8),{i:2},e&&e.out||new r(mt(t)),e&&e.dictionary)}e.AsyncGunzip=Pt,e.gunzip=zt,e.gunzipSync=qt;var Lt=function(){function t(t,e){this.c=H(),this.v=1,bt.call(this,t,e)}return t.prototype.push=function(t,e){this.c.p(t),bt.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){var n=K(t,this.o,this.v&&(this.o.dictionary?6:2),e&&4,this.s);this.v&&(_t(n,this.o),this.v=0),e&&pt(n,n.length-4,this.c.d()),this.ondata(n,e)},t}();e.Zlib=Lt;var Bt=function(){return function(t,e){ht([et,rt,function(){return[ft,bt,Lt]}],this,Et.call(this,t,e),(function(t){var e=new Lt(t.data);onmessage=ft(e)}),10)}}();function Rt(t,e){e||(e={});var n=H();n.p(t);var i=K(t,e,e.dictionary?6:2,4);return _t(i,e),pt(i,i.length-4,n.d()),i}e.AsyncZlib=Bt,e.zlib=function(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&O(7),lt(t,e,[et,rt,function(){return[Rt]}],(function(t){return ot(Rt(t.data[0],t.data[1]))}),4,n)},e.zlibSync=Rt;var kt=function(){function t(t,e){Tt.call(this,t,e),this.v=t&&t.dictionary?2:1}return t.prototype.push=function(t,e){if(Tt.prototype.e.call(this,t),this.v){if(this.p.length<6&&!e)return;this.p=this.p.subarray(It(this.p,this.v-1)),this.v=0}e&&(this.p.length<4&&O(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Tt.prototype.c.call(this,e)},t}();e.Unzlib=kt;var Gt=function(){return function(t,e){ht([tt,st,function(){return[ft,Tt,kt]}],this,Et.call(this,t,e),(function(t){var e=new kt(t.data);onmessage=ft(e)}),11)}}();function jt(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&O(7),lt(t,e,[tt,st,function(){return[Yt]}],(function(t){return ot(Yt(t.data[0],at(t.data[1])))}),5,n)}function Yt(t,e){return D(t.subarray(It(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}e.AsyncUnzlib=Gt,e.unzlib=jt,e.unzlibSync=Yt;var Vt=function(){function t(t,e){this.G=Dt,this.I=Tt,this.Z=kt,this.o=Et.call(this,t,e)||{}}return t.prototype.push=function(t,e){if(this.ondata||O(5),this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var n=new r(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var i=this,s=function(){i.ondata.apply(i,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(this.o,s):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o,s):new this.Z(this.o,s),this.s.push(this.p,e),this.p=null}}},t}();e.Decompress=Vt;var Xt=function(){function t(t,e){this.G=Pt,this.I=Nt,this.Z=Gt,Vt.call(this,t,e)}return t.prototype.push=function(t,e){Vt.prototype.push.call(this,t,e)},t}();e.AsyncDecompress=Xt,e.decompress=function(t,e,n){return n||(n=e,e={}),"function"!=typeof n&&O(7),31==t[0]&&139==t[1]&&8==t[2]?zt(t,e,n):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?Ut(t,e,n):jt(t,e,n)},e.decompressSync=function(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?qt(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?St(t,e):Yt(t,e)};var Zt=function(t,e,n,i){for(var s in t){var o=t[s],a=e+s,l=i;Array.isArray(o)&&(l=Q(i,o[1]),o=o[0]),o instanceof r?n[a]=[o,l]:(n[a+="/"]=[new r(0),l],Zt(o,a,n,i))}},Ht="undefined"!=typeof TextEncoder&&new TextEncoder,Kt="undefined"!=typeof TextDecoder&&new TextDecoder,Qt=0;try{Kt.decode(Y,{stream:!0}),Qt=1}catch(t){}var Wt=function(t){for(var e="",n=0;;){var i=t[n++],r=(i>127)+(i>223)+(i>239);if(n+r>t.length)return{s:e,r:M(t,n-1)};r?3==r?(i=((15&i)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,e+=String.fromCharCode(55296|i>>10,56320|1023&i)):e+=1&r?String.fromCharCode((31&i)<<6|63&t[n++]):String.fromCharCode((15&i)<<12|(63&t[n++])<<6|63&t[n++]):e+=String.fromCharCode(i)}},$t=function(){function t(t){this.ondata=t,Qt?this.t=new TextDecoder:this.p=Y}return t.prototype.push=function(t,e){if(this.ondata||O(5),e=!!e,this.t)return this.ondata(this.t.decode(t,{stream:!0}),e),void(e&&(this.t.decode().length&&O(8),this.t=null));this.p||O(4);var n=new r(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length);var i=Wt(n),s=i.s,o=i.r;e?(o.length&&O(8),this.p=null):this.p=o,this.ondata(s,e)},t}();e.DecodeUTF8=$t;var Jt=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,e){this.ondata||O(5),this.d&&O(4),this.ondata(te(t),this.d=e||!1)},t}();function te(t,e){if(e){for(var n=new r(t.length),i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}if(Ht)return Ht.encode(t);var s=t.length,o=new r(t.length+(t.length>>1)),a=0,l=function(t){o[a++]=t};for(i=0;i<s;++i){if(a+5>o.length){var f=new r(a+8+(s-i<<1));f.set(o),o=f}var h=t.charCodeAt(i);h<128||e?l(h):h<2048?(l(192|h>>6),l(128|63&h)):h>55295&&h<57344?(l(240|(h=65536+(1047552&h)|1023&t.charCodeAt(++i))>>18),l(128|h>>12&63),l(128|h>>6&63),l(128|63&h)):(l(224|h>>12),l(128|h>>6&63),l(128|63&h))}return M(o,0,a)}function ee(t,e){if(e){for(var n="",i=0;i<t.length;i+=16384)n+=String.fromCharCode.apply(null,t.subarray(i,i+16384));return n}if(Kt)return Kt.decode(t);var r=Wt(t),s=r.s;return(n=r.r).length&&O(8),s}e.EncodeUTF8=Jt,e.strToU8=te,e.strFromU8=ee;var ne=function(t){return 1==t?3:t<6?2:9==t?1:0},ie=function(t,e){return e+30+ut(t,e+26)+ut(t,e+28)},re=function(t,e,n){var i=ut(t,e+28),r=ee(t.subarray(e+46,e+46+i),!(2048&ut(t,e+8))),s=e+46+i,o=ct(t,e+20),a=n&&4294967295==o?se(t,s):[o,ct(t,e+24),ct(t,e+42)],l=a[0],f=a[1],h=a[2];return[ut(t,e+10),l,f,r,s+ut(t,e+30)+ut(t,e+32),h]},se=function(t,e){for(;1!=ut(t,e);e+=4+ut(t,e+2));return[dt(t,e+12),dt(t,e+4),dt(t,e+20)]},oe=function(t){var e=0;if(t)for(var n in t){var i=t[n].length;i>65535&&O(9),e+=i+4}return e},ae=function(t,e,n,i,r,s,o,a){var l=i.length,f=n.extra,h=a&&a.length,u=oe(f);pt(t,e,null!=o?33639248:67324752),e+=4,null!=o&&(t[e++]=20,t[e++]=n.os),t[e]=20,e+=2,t[e++]=n.flag<<1|(s<0&&8),t[e++]=r&&8,t[e++]=255&n.compression,t[e++]=n.compression>>8;var c=new Date(null==n.mtime?Date.now():n.mtime),d=c.getFullYear()-1980;if((d<0||d>119)&&O(10),pt(t,e,d<<25|c.getMonth()+1<<21|c.getDate()<<16|c.getHours()<<11|c.getMinutes()<<5|c.getSeconds()>>1),e+=4,-1!=s&&(pt(t,e,n.crc),pt(t,e+4,s<0?-s-2:s),pt(t,e+8,n.size)),pt(t,e+12,l),pt(t,e+14,u),e+=16,null!=o&&(pt(t,e,h),pt(t,e+6,n.attrs),pt(t,e+10,o),e+=14),t.set(i,e),e+=l,u)for(var p in f){var g=f[p],v=g.length;pt(t,e,+p),pt(t,e+2,v),t.set(g,e+4),e+=4+v}return h&&(t.set(a,e),e+=h),e},le=function(t,e,n,i,r){pt(t,e,101010256),pt(t,e+8,n),pt(t,e+10,n),pt(t,e+12,i),pt(t,e+16,r)},fe=function(){function t(t){this.filename=t,this.c=Z(),this.size=0,this.compression=0}return t.prototype.process=function(t,e){this.ondata(null,t,e)},t.prototype.push=function(t,e){this.ondata||O(5),this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},t}();e.ZipPassThrough=fe;var he=function(){function t(t,e){var n=this;e||(e={}),fe.call(this,t),this.d=new bt(e,(function(t,e){n.ondata(null,t,e)})),this.compression=8,this.flag=ne(e.level)}return t.prototype.process=function(t,e){try{this.d.push(t,e)}catch(t){this.ondata(t,null,e)}},t.prototype.push=function(t,e){fe.prototype.push.call(this,t,e)},t}();e.ZipDeflate=he;var ue=function(){function t(t,e){var n=this;e||(e={}),fe.call(this,t),this.d=new xt(e,(function(t,e,i){n.ondata(t,e,i)})),this.compression=8,this.flag=ne(e.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,e){this.d.push(t,e)},t.prototype.push=function(t,e){fe.prototype.push.call(this,t,e)},t}();e.AsyncZipDeflate=ue;var ce=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var e=this;if(this.ondata||O(5),2&this.d)this.ondata(O(4+8*(1&this.d),0,1),null,!1);else{var n=te(t.filename),i=n.length,s=t.comment,o=s&&te(s),a=i!=t.filename.length||o&&s.length!=o.length,l=i+oe(t.extra)+30;i>65535&&this.ondata(O(11,0,1),null,!1);var f=new r(l);ae(f,0,t,n,a,-1);var h=[f],u=function(){for(var t=0,n=h;t<n.length;t++){var i=n[t];e.ondata(null,i,!1)}h=[]},c=this.d;this.d=0;var d=this.u.length,p=Q(t,{f:n,u:a,o:o,t:function(){t.terminate&&t.terminate()},r:function(){if(u(),c){var t=e.u[d+1];t?t.r():e.d=1}c=1}}),g=0;t.ondata=function(n,i,s){if(n)e.ondata(n,i,s),e.terminate();else if(g+=i.length,h.push(i),s){var o=new r(16);pt(o,0,134695760),pt(o,4,t.crc),pt(o,8,g),pt(o,12,t.size),h.push(o),p.c=g,p.b=l+g+16,p.crc=t.crc,p.size=t.size,c&&p.r(),c=1}else c&&u()},this.u.push(p)}},t.prototype.end=function(){var t=this;2&this.d?this.ondata(O(4+8*(1&this.d),0,1),null,!0):(this.d?this.e():this.u.push({r:function(){1&t.d&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3)},t.prototype.e=function(){for(var t=0,e=0,n=0,i=0,s=this.u;i<s.length;i++)n+=46+(f=s[i]).f.length+oe(f.extra)+(f.o?f.o.length:0);for(var o=new r(n+22),a=0,l=this.u;a<l.length;a++){var f=l[a];ae(o,t,f,f.f,f.u,-f.c-2,e,f.o),t+=46+f.f.length+oe(f.extra)+(f.o?f.o.length:0),e+=f.b}le(o,t,this.u.length,n,e),this.ondata(null,o,!0),this.d=2},t.prototype.terminate=function(){for(var t=0,e=this.u;t<e.length;t++)e[t].t();this.d=2},t}();e.Zip=ce,e.zip=function(t,e,n){n||(n=e,e={}),"function"!=typeof n&&O(7);var i={};Zt(t,"",i,e);var s=Object.keys(i),o=s.length,a=0,l=0,f=o,h=new Array(o),u=[],c=function(){for(var t=0;t<u.length;++t)u[t]()},d=function(t,e){me((function(){n(t,e)}))};me((function(){d=n}));var p=function(){var t=new r(l+22),e=a,n=l-a;l=0;for(var i=0;i<f;++i){var s=h[i];try{var o=s.c.length;ae(t,l,s,s.f,s.u,o);var u=30+s.f.length+oe(s.extra),c=l+u;t.set(s.c,c),ae(t,a,s,s.f,s.u,o,l,s.m),a+=16+u+(s.m?s.m.length:0),l=c+o}catch(t){return d(t,null)}}le(t,a,h.length,n,e),d(null,t)};o||p();for(var g=function(t){var e=s[t],n=i[e],r=n[0],f=n[1],g=Z(),v=r.length;g.p(r);var m=te(e),y=m.length,_=f.comment,I=_&&te(_),E=I&&I.length,b=oe(f.extra),x=0==f.level?0:8,A=function(n,i){if(n)c(),d(n,null);else{var r=i.length;h[t]=Q(f,{size:v,crc:g.d(),c:i,f:m,m:I,u:y!=e.length||I&&_.length!=E,compression:x}),a+=30+y+b+r,l+=76+2*(y+b)+(E||0)+r,--o||p()}};if(y>65535&&A(O(11,0,1),null),x)if(v<16e4)try{A(null,wt(r,f))}catch(t){A(t,null)}else u.push(At(r,f,A));else A(null,r)},v=0;v<f;++v)g(v);return c},e.zipSync=function(t,e){e||(e={});var n={},i=[];Zt(t,"",n,e);var s=0,o=0;for(var a in n){var l=n[a],f=l[0],h=l[1],u=0==h.level?0:8,c=(A=te(a)).length,d=h.comment,p=d&&te(d),g=p&&p.length,v=oe(h.extra);c>65535&&O(11);var m=u?wt(f,h):f,y=m.length,_=Z();_.p(f),i.push(Q(h,{size:f.length,crc:_.d(),c:m,f:A,m:p,u:c!=a.length||p&&d.length!=g,o:s,compression:u})),s+=30+c+v+y,o+=76+2*(c+v)+(g||0)+y}for(var I=new r(o+22),E=s,b=o-s,x=0;x<i.length;++x){var A=i[x];ae(I,A.o,A,A.f,A.u,A.c.length);var w=30+A.f.length+oe(A.extra);I.set(A.c,A.o+w),ae(I,s,A,A.f,A.u,A.c.length,A.o,A.m),s+=16+w+(A.m?A.m.length:0)}return le(I,s,i.length,b,E),I};var de=function(){function t(){}return t.prototype.push=function(t,e){this.ondata(null,t,e)},t.compression=0,t}();e.UnzipPassThrough=de;var pe=function(){function t(){var t=this;this.i=new Tt((function(e,n){t.ondata(null,e,n)}))}return t.prototype.push=function(t,e){try{this.i.push(t,e)}catch(t){this.ondata(t,null,e)}},t.compression=8,t}();e.UnzipInflate=pe;var ge=function(){function t(t,e){var n=this;e<32e4?this.i=new Tt((function(t,e){n.ondata(null,t,e)})):(this.i=new Nt((function(t,e,i){n.ondata(t,e,i)})),this.terminate=this.i.terminate)}return t.prototype.push=function(t,e){this.i.terminate&&(t=M(t,0)),this.i.push(t,e)},t.compression=8,t}();e.AsyncUnzipInflate=ge;var ve=function(){function t(t){this.onfile=t,this.k=[],this.o={0:de},this.p=Y}return t.prototype.push=function(t,e){var n=this;if(this.onfile||O(5),this.p||O(4),this.c>0){var i=Math.min(this.c,t.length),s=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(s,!this.c):this.k[0].push(s),(t=t.subarray(i)).length)return this.push(t,e)}else{var o=0,a=0,l=void 0,f=void 0;this.p.length?t.length?((f=new r(this.p.length+t.length)).set(this.p),f.set(t,this.p.length)):f=this.p:f=t;for(var h=f.length,u=this.c,c=u&&this.d,d=function(){var t,e=ct(f,a);if(67324752==e){o=1,l=a,p.d=null,p.c=0;var i=ut(f,a+6),r=ut(f,a+8),s=2048&i,c=8&i,d=ut(f,a+26),g=ut(f,a+28);if(h>a+30+d+g){var v=[];p.k.unshift(v),o=2;var m,y=ct(f,a+18),_=ct(f,a+22),I=ee(f.subarray(a+30,a+=30+d),!s);4294967295==y?(t=c?[-2]:se(f,a),y=t[0],_=t[1]):c&&(y=-1),a+=g,p.c=y;var E={name:I,compression:r,start:function(){if(E.ondata||O(5),y){var t=n.o[r];t||E.ondata(O(14,"unknown compression type "+r,1),null,!1),(m=y<0?new t(I):new t(I,y,_)).ondata=function(t,e,n){E.ondata(t,e,n)};for(var e=0,i=v;e<i.length;e++){var s=i[e];m.push(s,!1)}n.k[0]==v&&n.c?n.d=m:m.push(Y,!0)}else E.ondata(null,Y,!0)},terminate:function(){m&&m.terminate&&m.terminate()}};y>=0&&(E.size=y,E.originalSize=_),p.onfile(E)}return"break"}if(u){if(134695760==e)return l=a+=12+(-2==u&&8),o=3,p.c=0,"break";if(33639248==e)return l=a-=4,o=3,p.c=0,"break"}},p=this;a<h-4&&"break"!==d();++a);if(this.p=Y,u<0){var g=o?f.subarray(0,l-12-(-2==u&&8)-(134695760==ct(f,l-16)&&4)):f.subarray(0,a);c?c.push(g,!!o):this.k[+(2==o)].push(g)}if(2&o)return this.push(f.subarray(a),e);this.p=f.subarray(a)}e&&(this.c&&O(13),this.p=null)},t.prototype.register=function(t){this.o[t.compression]=t},t}();e.Unzip=ve;var me="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(t){t()};e.unzip=function(t,e,n){n||(n=e,e={}),"function"!=typeof n&&O(7);var i=[],s=function(){for(var t=0;t<i.length;++t)i[t]()},o={},a=function(t,e){me((function(){n(t,e)}))};me((function(){a=n}));for(var l=t.length-22;101010256!=ct(t,l);--l)if(!l||t.length-l>65558)return a(O(13,0,1),null),s;var f=ut(t,l+8);if(f){var h=f,u=ct(t,l+16),c=4294967295==u||65535==h;if(c){var d=ct(t,l-12);(c=101075792==ct(t,d))&&(h=f=ct(t,d+32),u=ct(t,d+48))}for(var p=e&&e.filter,g=function(e){var n=re(t,u,c),l=n[0],h=n[1],d=n[2],g=n[3],v=n[4],m=n[5],y=ie(t,m);u=v;var _=function(t,e){t?(s(),a(t,null)):(e&&(o[g]=e),--f||a(null,o))};if(!p||p({name:g,size:h,originalSize:d,compression:l}))if(l)if(8==l){var I=t.subarray(y,y+h);if(h<32e4)try{_(null,St(I,{out:new r(d)}))}catch(t){_(t,null)}else i.push(Ut(I,{size:d},_))}else _(O(14,"unknown compression type "+l,1),null);else _(null,M(t,y,y+h));else _(null,null)},v=0;v<h;++v)g()}else a(null,{});return s},e.unzipSync=function(t,e){for(var n={},i=t.length-22;101010256!=ct(t,i);--i)(!i||t.length-i>65558)&&O(13);var s=ut(t,i+8);if(!s)return{};var o=ct(t,i+16),a=4294967295==o||65535==s;if(a){var l=ct(t,i-12);(a=101075792==ct(t,l))&&(s=ct(t,l+32),o=ct(t,l+48))}for(var f=e&&e.filter,h=0;h<s;++h){var u=re(t,o,a),c=u[0],d=u[1],p=u[2],g=u[3],v=u[4],m=u[5],y=ie(t,m);o=v,f&&!f({name:g,size:d,originalSize:p,compression:c})||(c?8==c?n[g]=St(t.subarray(y,y+d),{out:new r(p)}):O(14,"unknown compression type "+c):n[g]=M(t,y,y+d))}return n}},735:function(t,e){"use strict";var n={};e.default=function(t,e,i,r,s){var o=new Worker(n[e]||(n[e]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return o.onmessage=function(t){var e=t.data,n=e.$e$;if(n){var i=new Error(n[0]);i.code=n[1],i.stack=n[2],s(i,null)}else s(null,e)},o.postMessage(i,r),o}}},i={};function r(t){var e=i[t];if(void 0!==e)return e.exports;var s=i[t]={exports:{}};return n[t].call(s.exports,s,s.exports,r),s.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return function(){"use strict";r.r(s),r.d(s,{Enums:function(){return e},NiftiImageVolume:function(){return y},cornerstoneNiftiImageVolumeLoader:function(){return C},helpers:function(){return t}});var t={};r.r(t),r.d(t,{fetchAndAllocateNiftiVolume:function(){return F},makeVolumeMetadata:function(){return h},modalityScaleNifti:function(){return E}});var e={};function n(t,e,n,i,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}r.r(e),r.d(e,{Events:function(){return x}});var i=r(841),o=r.n(i),a=r(130),l=r(953),f=r(976);function h(t,e,n){var i=t.numBitsPerVoxel,r=t.littleEndian,s=t.pixDims,o=t.dims,a=f.vec3.create(),l=f.vec3.create();f.vec3.set(a,e[0],e[1],e[2]),f.vec3.set(l,e[3],e[4],e[5]);for(var h=1/0,u=-1/0,c=o[1],d=o[2],p=o[3],g=c*d,v=g*Math.floor(p/2),m=v;m<v+g;m++){var y=n[m];y>u&&(u=y),y<h&&(h=y)}var _=(u+h)/2,I=u-h;return{BitsAllocated:i,BitsStored:i,SamplesPerPixel:1,HighBit:r?i-1:1,PhotometricInterpretation:"MONOCHROME2",PixelRepresentation:1,ImageOrientationPatient:[a[0],a[1],a[2],l[0],l[1],l[2]],PixelSpacing:[s[1],s[2]],Columns:c,Rows:d,voiLut:[{windowCenter:_,windowWidth:I}],FrameOfReferenceUID:"1.2.3",Modality:"MR",VOILUTFunction:"LINEAR"}}function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}function c(t){var e=function(t,e){if("object"!==u(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,"string");if("object"!==u(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===u(e)?e:String(e)}function d(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,c(i.key),i)}}function p(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(t,e){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},g(t,e)}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}function m(t,e,n){return(e=c(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var y=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e)}(o,t);var e,n,i,r,s=(i=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=v(i);if(r){var n=v(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return p(t)}(this,t)});function o(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),m(p(n=s.call(this,t)),"loadStatus",void 0),m(p(n),"controller",void 0),m(p(n),"cancelLoading",(function(){var t=p(n).loadStatus;t&&t.loading&&(t.loading=!1,n.clearLoadCallbacks(),n.controller.abort())})),m(p(n),"load",(function(t){})),n.loadStatus=e.loadStatus,n.controller=e.controller,n}return e=o,(n=[{key:"clearLoadCallbacks",value:function(){this.loadStatus.callbacks=[]}},{key:"decache",value:function(){l.cache.removeVolumeLoadObject(this.volumeId)}}])&&d(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),o}(l.ImageVolume),_=function(t,e){var n,i;if(e instanceof Uint8Array||e instanceof ArrayBuffer||e instanceof SharedArrayBuffer)n=Uint8Array,i=1;else if(e instanceof Int16Array)n=Int16Array,i=2;else{if(!(e instanceof Float32Array))throw new Error("imageDataArray needs to be a Uint8Array, Int16Array or Float32Array.");n=Float32Array,i=4}var r=new n(e.byteLength),s=new n(e);r.set(s);for(var o=t[2],a=t[0]*t[1],l=r.buffer,f=0;f<o;f++)new n(l,a*f*i,a).reverse();return r};function I(t){var e=function(t){var e=[t[0][3],t[1][3],t[2][3]],n=[Math.sqrt(Math.pow(t[0][0],2)+Math.pow(t[1][0],2)+Math.pow(t[2][0],2)),Math.sqrt(Math.pow(t[0][1],2)+Math.pow(t[1][1],2)+Math.pow(t[2][1],2)),Math.sqrt(Math.pow(t[0][2],2)+Math.pow(t[1][2],2)+Math.pow(t[2][2],2))];return{origin:e,orientation:[t[0][0]/n[0],t[0][1]/n[1],t[0][2]/n[2],t[1][0]/n[0],t[1][1]/n[1],t[1][2]/n[2],t[2][0]/n[0],t[2][1]/n[1],t[2][2]/n[2]],spacing:n}}(t.affine),n=e.orientation,i=e.origin,r=e.spacing;return{origin:[-i[0],-i[1],i[2]],orientation:[-n[0],-n[3],n[6],-n[1],-n[4],n[7],-n[2],-n[5],n[8]],spacing:r}}function E(t,e){var n=t.length,i=e.scl_slope,r=e.scl_inter;if(i&&0!==i&&!Number.isNaN(i))for(var s=0;s<n;s++)t[s]=t[s]*i+r}var b=function(t){return t.NIFTI_VOLUME_LOADED="CORNERSTONE_NIFTI_VOLUME_LOADED",t.NIFTI_VOLUME_PROGRESS="CORNERSTONE_NIFTI_VOLUME_PROGRESS",t}(b||{}),x=b,A="nifti",w=l.utilities.createUint8SharedArray,T=l.utilities.createFloat32SharedArray,N=new Map;function U(t,e,n,i){return new Promise((function(r,s){var o=new XMLHttpRequest;o.open("GET",t,!0),o.responseType="arraybuffer";var a=function(t){i&&"function"==typeof i&&i(),n&&n.removeEventListener("abort",l),r(o.response)},l=function(){o.abort(),o.removeEventListener("load",a),s(new Error("Request aborted"))};o.addEventListener("load",a),e&&"function"==typeof e&&(o.onprogress=function(t){e(t.loaded,t.total)}),n&&n.aborted?(o.abort(),s(new Error("Request aborted"))):n&&n.addEventListener("abort",l),o.send()}))}var S=function(t,e){switch(t){case 2:return new Uint8Array(e);case 16:return new Float32Array(e);case 4:return new Int16Array(e);default:throw new Error("datatypeCode ".concat(t," is not yet supported"))}};function F(t){return M.apply(this,arguments)}function M(){var t;return t=o().mark((function t(e){var n,i,r,s,u,c,d,p,g,v,m,b,F,M,C,O,D,P,z,q,L,B,R,k,G,j,Y,V,X,Z,H,K,Q,W;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.substring(A.length+1),i=function(t,n){var i={volumeId:e,loaded:t,total:n};(0,l.triggerEvent)(l.eventTarget,x.NIFTI_VOLUME_PROGRESS,{data:i})},r=function(){var t={volumeId:e};(0,l.triggerEvent)(l.eventTarget,x.NIFTI_VOLUME_LOADED,{data:t})},s=new AbortController,u=s.signal,N.set(n,{controller:s,loading:!0}),t.next=8,U(n,i,u,r);case 8:if(c=t.sent,N.delete(n),d=null,p=null,a.isCompressed(c)&&(c=a.decompress(c)),a.isNIFTI(c)&&(d=a.readHeader(c),p=a.readImage(d,c)),g=S(d.datatypeCode,p),v=I(d),m=v.orientation,b=v.origin,F=v.spacing,_(d.dims.slice(1,4),g),E(g,d),M=h(d,m,g),C=f.vec3.create(),f.vec3.set(C,m[6],m[7],m[8]),O=M.BitsAllocated,D=M.PixelRepresentation,P=M.PhotometricInterpretation,z=M.ImageOrientationPatient,q=M.Columns,L=M.Rows,B=f.vec3.fromValues(z[0],z[1],z[2]),R=f.vec3.fromValues(z[3],z[4],z[5]),k=d.dims,G=k[3],j=[q,L,G],Y=new Float32Array([B[0],B[1],B[2],R[0],R[1],R[2],C[0],C[1],C[2]]),V=1===D,X=1,16!==O&&32!==O||(X=4),Z=X*j[0]*j[1]*j[2],H=1,"RGB"===P&&(H=3),K=Z*H,l.cache.isCacheable(K)){t.next=38;break}throw new Error(l.Enums.Events.CACHE_SIZE_EXCEEDED);case 38:l.cache.decacheIfNecessaryUntilBytesAvailable(K),t.t0=O,t.next=8===t.t0?42:16===t.t0||32===t.t0?48:50;break;case 42:if(!V){t.next=46;break}throw new Error("8 Bit signed images are not yet supported by this plugin.");case 46:Q=w(j[0]*j[1]*j[2]);case 47:return t.abrupt("break",50);case 48:return Q=T(j[0]*j[1]*j[2]),t.abrupt("break",50);case 50:return Q.set(g),W=new y({volumeId:e,metadata:M,dimensions:j,spacing:F,origin:b,direction:Y,scalarData:Q,sizeInBytes:K},{loadStatus:{loaded:!1,loading:!1,callbacks:[]},controller:s}),t.abrupt("return",W);case 53:case"end":return t.stop()}}),t)})),M=function(){var e=this,i=arguments;return new Promise((function(r,s){var o=t.apply(e,i);function a(t){n(o,r,s,a,l,"next",t)}function l(t){n(o,r,s,a,l,"throw",t)}a(void 0)}))},M.apply(this,arguments)}function C(t){return{promise:F(t),cancel:function(){}}}}(),s}()}));
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|