@dcm/nifti-image-loader
Version:
Neuroimaging Informatics Technology Initiative (NIfTI) Image Loader for the Cornerstone library.
8 lines • 200 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cornerstoneNIFTIImageLoader",[],e):"object"==typeof exports?exports.cornerstoneNIFTIImageLoader=e():t.cornerstoneNIFTIImageLoader=e()}(self,(function(){return(()=>{var t={4291:t=>{t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}},4325:t=>{t.exports=function(t){if(Array.isArray(t))return t}},123:(t,e,i)=>{var n=i(4291);t.exports=function(t){if(Array.isArray(t))return n(t)}},4988:t=>{t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},9590:t=>{function e(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}},6506:t=>{t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}},1682:t=>{t.exports=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var i=[],n=!0,r=!1,a=void 0;try{for(var s,o=t[Symbol.iterator]();!(n=(s=o.next()).done)&&(i.push(s.value),!e||i.length!==e);n=!0);}catch(t){r=!0,a=t}finally{try{n||null==o.return||o.return()}finally{if(r)throw a}}return i}}},1420:t=>{t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},7331:t=>{t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},3408:(t,e,i)=>{var n=i(4325),r=i(1682),a=i(2510),s=i(1420);t.exports=function(t,e){return n(t)||r(t,e)||a(t,e)||s()}},9571:(t,e,i)=>{var n=i(123),r=i(6506),a=i(2510),s=i(7331);t.exports=function(t){return n(t)||r(t)||a(t)||s()}},2510:(t,e,i)=>{var n=i(4291);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(t,e):void 0}}},6947:(t,e,i)=>{"use strict";t.exports=i(8618).STATUS_CODES},5670:(t,e)=>{function i(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===i(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===i(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===i(t)},e.isError=function(t){return"[object Error]"===i(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=Buffer.isBuffer},7531:t=>{"use strict";var e,i="object"==typeof Reflect?Reflect:null,n=i&&"function"==typeof i.apply?i.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)};e=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var r=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(t,e){return new Promise((function(i,n){function r(){void 0!==a&&t.removeListener("error",a),i([].slice.call(arguments))}var a;"error"!==e&&(a=function(i){t.removeListener(e,r),n(i)},t.once("error",a)),t.once(e,r)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var s=10;function o(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function l(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function h(t,e,i,n){var r,a,s,h;if(o(i),void 0===(a=t._events)?(a=t._events=Object.create(null),t._eventsCount=0):(void 0!==a.newListener&&(t.emit("newListener",e,i.listener?i.listener:i),a=t._events),s=a[e]),void 0===s)s=a[e]=i,++t._eventsCount;else if("function"==typeof s?s=a[e]=n?[i,s]:[s,i]:n?s.unshift(i):s.push(i),(r=l(t))>0&&s.length>r&&!s.warned){s.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=t,d.type=e,d.count=s.length,h=d,console&&console.warn&&console.warn(h)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(t,e,i){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},r=d.bind(n);return r.listener=i,n.wrapFn=r,r}function f(t,e,i){var n=t._events;if(void 0===n)return[];var r=n[e];return void 0===r?[]:"function"==typeof r?i?[r.listener||r]:[r]:i?function(t){for(var e=new Array(t.length),i=0;i<e.length;++i)e[i]=t[i].listener||t[i];return e}(r):_(r,r.length)}function c(t){var e=this._events;if(void 0!==e){var i=e[t];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function _(t,e){for(var i=new Array(e),n=0;n<e;++n)i[n]=t[n];return i}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(t){if("number"!=typeof t||t<0||r(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");s=t}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||r(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e.push(arguments[i]);var r="error"===t,a=this._events;if(void 0!==a)r=r&&void 0===a.error;else if(!r)return!1;if(r){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var l=a[t];if(void 0===l)return!1;if("function"==typeof l)n(l,this,e);else{var h=l.length,d=_(l,h);for(i=0;i<h;++i)n(d[i],this,e)}return!0},a.prototype.addListener=function(t,e){return h(this,t,e,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(t,e){return h(this,t,e,!0)},a.prototype.once=function(t,e){return o(e),this.on(t,u(this,t,e)),this},a.prototype.prependOnceListener=function(t,e){return o(e),this.prependListener(t,u(this,t,e)),this},a.prototype.removeListener=function(t,e){var i,n,r,a,s;if(o(e),void 0===(n=this._events))return this;if(void 0===(i=n[t]))return this;if(i===e||i.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,i.listener||e));else if("function"!=typeof i){for(r=-1,a=i.length-1;a>=0;a--)if(i[a]===e||i[a].listener===e){s=i[a].listener,r=a;break}if(r<0)return this;0===r?i.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(i,r),1===i.length&&(n[t]=i[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(t){var e,i,n;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[t]),this;if(0===arguments.length){var r,a=Object.keys(i);for(n=0;n<a.length;++n)"removeListener"!==(r=a[n])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=i[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},a.prototype.listeners=function(t){return f(this,t,!0)},a.prototype.rawListeners=function(t){return f(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):c.call(t,e)},a.prototype.listenerCount=c,a.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},8587:(t,e,i)=>{try{var n=i(1758);if("function"!=typeof n.inherits)throw"";t.exports=n.inherits}catch(e){t.exports=i(2111)}},2111:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t}}},8738:t=>{"use strict";t.exports=function(t){for(var e=new Array(t),i=0;i<t;++i)e[i]=i;return e}},8998:t=>{function e(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
t.exports=function(t){return null!=t&&(e(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&e(t.slice(0,0))}(t)||!!t._isBuffer)}},9930:t=>{var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},3373:(t,e,i)=>{var n=i(8738),r=i(8998),a="undefined"!=typeof Float64Array;function s(t,e){return t[0]-e[0]}function o(){var t,e=this.stride,i=new Array(e.length);for(t=0;t<i.length;++t)i[t]=[Math.abs(e[t]),t];i.sort(s);var n=new Array(i.length);for(t=0;t<n.length;++t)n[t]=i[t][1];return n}function l(t,e){var i=["View",e,"d",t].join("");e<0&&(i="View_Nil"+t);var r="generic"===t;if(-1===e){var a="function "+i+"(a){this.data=a;};var proto="+i+".prototype;proto.dtype='"+t+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+i+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+i+"(a){return new "+i+"(a);}";return new Function(a)()}if(0===e){a="function "+i+"(a,d) {this.data = a;this.offset = d};var proto="+i+".prototype;proto.dtype='"+t+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+i+"_copy() {return new "+i+"(this.data,this.offset)};proto.pick=function "+i+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+i+"_get(){return "+(r?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+i+"_set(v){return "+(r?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+i+"(a,b,c,d){return new "+i+"(a,d)}";return new Function("TrivialArray",a)(h[t][0])}a=["'use strict'"];var s=n(e),l=s.map((function(t){return"i"+t})),d="this.offset+"+s.map((function(t){return"this.stride["+t+"]*i"+t})).join("+"),u=s.map((function(t){return"b"+t})).join(","),f=s.map((function(t){return"c"+t})).join(",");a.push("function "+i+"(a,"+u+","+f+",d){this.data=a","this.shape=["+u+"]","this.stride=["+f+"]","this.offset=d|0}","var proto="+i+".prototype","proto.dtype='"+t+"'","proto.dimension="+e),a.push("Object.defineProperty(proto,'size',{get:function "+i+"_size(){return "+s.map((function(t){return"this.shape["+t+"]"})).join("*"),"}})"),1===e?a.push("proto.order=[0]"):(a.push("Object.defineProperty(proto,'order',{get:"),e<4?(a.push("function "+i+"_order(){"),2===e?a.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&a.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):a.push("ORDER})")),a.push("proto.set=function "+i+"_set("+l.join(",")+",v){"),r?a.push("return this.data.set("+d+",v)}"):a.push("return this.data["+d+"]=v}"),a.push("proto.get=function "+i+"_get("+l.join(",")+"){"),r?a.push("return this.data.get("+d+")}"):a.push("return this.data["+d+"]}"),a.push("proto.index=function "+i+"_index(",l.join(),"){return "+d+"}"),a.push("proto.hi=function "+i+"_hi("+l.join(",")+"){return new "+i+"(this.data,"+s.map((function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")})).join(",")+","+s.map((function(t){return"this.stride["+t+"]"})).join(",")+",this.offset)}");var c=s.map((function(t){return"a"+t+"=this.shape["+t+"]"})),_=s.map((function(t){return"c"+t+"=this.stride["+t+"]"}));a.push("proto.lo=function "+i+"_lo("+l.join(",")+"){var b=this.offset,d=0,"+c.join(",")+","+_.join(","));for(var p=0;p<e;++p)a.push("if(typeof i"+p+"==='number'&&i"+p+">=0){d=i"+p+"|0;b+=c"+p+"*d;a"+p+"-=d}");a.push("return new "+i+"(this.data,"+s.map((function(t){return"a"+t})).join(",")+","+s.map((function(t){return"c"+t})).join(",")+",b)}"),a.push("proto.step=function "+i+"_step("+l.join(",")+"){var "+s.map((function(t){return"a"+t+"=this.shape["+t+"]"})).join(",")+","+s.map((function(t){return"b"+t+"=this.stride["+t+"]"})).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(p=0;p<e;++p)a.push("if(typeof i"+p+"==='number'){d=i"+p+"|0;if(d<0){c+=b"+p+"*(a"+p+"-1);a"+p+"=ceil(-a"+p+"/d)}else{a"+p+"=ceil(a"+p+"/d)}b"+p+"*=d}");a.push("return new "+i+"(this.data,"+s.map((function(t){return"a"+t})).join(",")+","+s.map((function(t){return"b"+t})).join(",")+",c)}");var m=new Array(e),g=new Array(e);for(p=0;p<e;++p)m[p]="a[i"+p+"]",g[p]="b[i"+p+"]";a.push("proto.transpose=function "+i+"_transpose("+l+"){"+l.map((function(t,e){return t+"=("+t+"===undefined?"+e+":"+t+"|0)"})).join(";"),"var a=this.shape,b=this.stride;return new "+i+"(this.data,"+m.join(",")+","+g.join(",")+",this.offset)}"),a.push("proto.pick=function "+i+"_pick("+l+"){var a=[],b=[],c=this.offset");for(p=0;p<e;++p)a.push("if(typeof i"+p+"==='number'&&i"+p+">=0){c=(c+this.stride["+p+"]*i"+p+")|0}else{a.push(this.shape["+p+"]);b.push(this.stride["+p+"])}");return a.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),a.push("return function construct_"+i+"(data,shape,stride,offset){return new "+i+"(data,"+s.map((function(t){return"shape["+t+"]"})).join(",")+","+s.map((function(t){return"stride["+t+"]"})).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",a.join("\n"))(h[t],o)}var h={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};t.exports=function(t,e,i,n){if(void 0===t)return(0,h.array[0])([]);"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===i){i=new Array(s);for(var o=s-1,d=1;o>=0;--o)i[o]=d,d*=e[o]}if(void 0===n){n=0;for(o=0;o<s;++o)i[o]<0&&(n-=(e[o]-1)*i[o])}for(var u=function(t){if(r(t))return"buffer";if(a)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(t)?"array":"generic"}(t),f=h[u];f.length<=s+1;)f.push(l(u,f.length-1));return(0,f[s+1])(t,e,i,n)}},163:(t,e,i)=>{"use strict";var n=n||{};n.NIFTI1=n.NIFTI1||i(6714),n.NIFTI2=n.NIFTI2||i(8829),n.Utils=n.Utils||i(4731);var r=r||i(2744);n.isNIFTI1=function(t){var e,i,r,a;return!(t.byteLength<n.NIFTI1.STANDARD_HEADER_SIZE)&&((e=new DataView(t))&&(i=e.getUint8(n.NIFTI1.MAGIC_NUMBER_LOCATION)),r=e.getUint8(n.NIFTI1.MAGIC_NUMBER_LOCATION+1),a=e.getUint8(n.NIFTI1.MAGIC_NUMBER_LOCATION+2),!(i!==n.NIFTI1.MAGIC_NUMBER[0]||r!==n.NIFTI1.MAGIC_NUMBER[1]||a!==n.NIFTI1.MAGIC_NUMBER[2]))},n.isNIFTI2=function(t){var e,i,r,a;return!(t.byteLength<n.NIFTI1.STANDARD_HEADER_SIZE)&&(i=(e=new DataView(t)).getUint8(n.NIFTI2.MAGIC_NUMBER_LOCATION),r=e.getUint8(n.NIFTI2.MAGIC_NUMBER_LOCATION+1),a=e.getUint8(n.NIFTI2.MAGIC_NUMBER_LOCATION+2),!(i!==n.NIFTI2.MAGIC_NUMBER[0]||r!==n.NIFTI2.MAGIC_NUMBER[1]||a!==n.NIFTI2.MAGIC_NUMBER[2]))},n.isNIFTI=function(t){return n.isNIFTI1(t)||n.isNIFTI2(t)},n.isCompressed=function(t){var e,i,r;if(t){if(i=(e=new DataView(t)).getUint8(0),r=e.getUint8(1),i===n.Utils.GUNZIP_MAGIC_COOKIE1)return!0;if(r===n.Utils.GUNZIP_MAGIC_COOKIE2)return!0}return!1},n.decompress=function(t){return r.inflate(t).buffer},n.readHeader=function(t){var e=null;return n.isCompressed(t)&&(t=n.decompress(t)),n.isNIFTI1(t)?e=new n.NIFTI1:n.isNIFTI2(t)&&(e=new n.NIFTI2),e?e.readHeader(t):console.error("That file does not appear to be NIFTI!"),e},n.hasExtension=function(t){return 0!=t.extensionFlag[0]},n.readImage=function(t,e){var i=t.vox_offset,n=1,r=1;t.dims[4]&&(n=t.dims[4]),t.dims[5]&&(r=t.dims[5]);var a=t.dims[1]*t.dims[2]*t.dims[3]*n*r*(t.numBitsPerVoxel/8);return e.slice(i,i+a)},n.readExtension=function(t,e){var i=t.getExtensionLocation(),n=t.extensionSize;return e.slice(i,i+n)},n.readExtensionData=function(t,e){var i=t.getExtensionLocation(),n=t.extensionSize;return e.slice(i+8,i+n-8)};t.exports&&(t.exports=n)},6714:(t,e,i)=>{"use strict";var n=n||{};n.Utils=n.Utils||i(4731),n.NIFTI1=n.NIFTI1||function(){this.littleEndian=!1,this.dim_info=0,this.dims=[],this.intent_p1=0,this.intent_p2=0,this.intent_p3=0,this.intent_code=0,this.datatypeCode=0,this.numBitsPerVoxel=0,this.slice_start=0,this.slice_end=0,this.slice_code=0,this.pixDims=[],this.vox_offset=0,this.scl_slope=1,this.scl_inter=0,this.xyzt_units=0,this.cal_max=0,this.cal_min=0,this.slice_duration=0,this.toffset=0,this.description="",this.aux_file="",this.intent_name="",this.qform_code=0,this.sform_code=0,this.quatern_b=0,this.quatern_c=0,this.quatern_d=0,this.qoffset_x=0,this.qoffset_y=0,this.qoffset_z=0,this.affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],this.magic=0,this.isHDR=!1,this.extensionFlag=[0,0,0,0],this.extensionSize=0,this.extensionCode=0},n.NIFTI1.TYPE_NONE=0,n.NIFTI1.TYPE_BINARY=1,n.NIFTI1.TYPE_UINT8=2,n.NIFTI1.TYPE_INT16=4,n.NIFTI1.TYPE_INT32=8,n.NIFTI1.TYPE_FLOAT32=16,n.NIFTI1.TYPE_COMPLEX64=32,n.NIFTI1.TYPE_FLOAT64=64,n.NIFTI1.TYPE_RGB24=128,n.NIFTI1.TYPE_INT8=256,n.NIFTI1.TYPE_UINT16=512,n.NIFTI1.TYPE_UINT32=768,n.NIFTI1.TYPE_INT64=1024,n.NIFTI1.TYPE_UINT64=1280,n.NIFTI1.TYPE_FLOAT128=1536,n.NIFTI1.TYPE_COMPLEX128=1792,n.NIFTI1.TYPE_COMPLEX256=2048,n.NIFTI1.XFORM_UNKNOWN=0,n.NIFTI1.XFORM_SCANNER_ANAT=1,n.NIFTI1.XFORM_ALIGNED_ANAT=2,n.NIFTI1.XFORM_TALAIRACH=3,n.NIFTI1.XFORM_MNI_152=4,n.NIFTI1.SPATIAL_UNITS_MASK=7,n.NIFTI1.TEMPORAL_UNITS_MASK=56,n.NIFTI1.UNITS_UNKNOWN=0,n.NIFTI1.UNITS_METER=1,n.NIFTI1.UNITS_MM=2,n.NIFTI1.UNITS_MICRON=3,n.NIFTI1.UNITS_SEC=8,n.NIFTI1.UNITS_MSEC=16,n.NIFTI1.UNITS_USEC=24,n.NIFTI1.UNITS_HZ=32,n.NIFTI1.UNITS_PPM=40,n.NIFTI1.UNITS_RADS=48,n.NIFTI1.MAGIC_COOKIE=348,n.NIFTI1.STANDARD_HEADER_SIZE=348,n.NIFTI1.MAGIC_NUMBER_LOCATION=344,n.NIFTI1.MAGIC_NUMBER=[110,43,49],n.NIFTI1.MAGIC_NUMBER2=[110,105,49],n.NIFTI1.EXTENSION_HEADER_SIZE=8,n.NIFTI1.prototype.readHeader=function(t){var e,i,r,a,s=new DataView(t),o=n.Utils.getIntAt(s,0,this.littleEndian);if(o!==n.NIFTI1.MAGIC_COOKIE&&(this.littleEndian=!0,o=n.Utils.getIntAt(s,0,this.littleEndian)),o!==n.NIFTI1.MAGIC_COOKIE)throw new Error("This does not appear to be a NIFTI file!");for(this.dim_info=n.Utils.getByteAt(s,39),e=0;e<8;e+=1)a=40+2*e,this.dims[e]=n.Utils.getShortAt(s,a,this.littleEndian);for(this.intent_p1=n.Utils.getFloatAt(s,56,this.littleEndian),this.intent_p2=n.Utils.getFloatAt(s,60,this.littleEndian),this.intent_p3=n.Utils.getFloatAt(s,64,this.littleEndian),this.intent_code=n.Utils.getShortAt(s,68,this.littleEndian),this.datatypeCode=n.Utils.getShortAt(s,70,this.littleEndian),this.numBitsPerVoxel=n.Utils.getShortAt(s,72,this.littleEndian),this.slice_start=n.Utils.getShortAt(s,74,this.littleEndian),e=0;e<8;e+=1)a=76+4*e,this.pixDims[e]=n.Utils.getFloatAt(s,a,this.littleEndian);for(this.vox_offset=n.Utils.getFloatAt(s,108,this.littleEndian),this.scl_slope=n.Utils.getFloatAt(s,112,this.littleEndian),this.scl_inter=n.Utils.getFloatAt(s,116,this.littleEndian),this.slice_end=n.Utils.getShortAt(s,120,this.littleEndian),this.slice_code=n.Utils.getByteAt(s,122),this.xyzt_units=n.Utils.getByteAt(s,123),this.cal_max=n.Utils.getFloatAt(s,124,this.littleEndian),this.cal_min=n.Utils.getFloatAt(s,128,this.littleEndian),this.slice_duration=n.Utils.getFloatAt(s,132,this.littleEndian),this.toffset=n.Utils.getFloatAt(s,136,this.littleEndian),this.description=n.Utils.getStringAt(s,148,228),this.aux_file=n.Utils.getStringAt(s,228,252),this.qform_code=n.Utils.getShortAt(s,252,this.littleEndian),this.sform_code=n.Utils.getShortAt(s,254,this.littleEndian),this.quatern_b=n.Utils.getFloatAt(s,256,this.littleEndian),this.quatern_c=n.Utils.getFloatAt(s,260,this.littleEndian),this.quatern_d=n.Utils.getFloatAt(s,264,this.littleEndian),this.qoffset_x=n.Utils.getFloatAt(s,268,this.littleEndian),this.qoffset_y=n.Utils.getFloatAt(s,272,this.littleEndian),this.qoffset_z=n.Utils.getFloatAt(s,276,this.littleEndian),i=0;i<3;i+=1)for(r=0;r<4;r+=1)a=280+4*(4*i+r),this.affine[i][r]=n.Utils.getFloatAt(s,a,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=n.Utils.getStringAt(s,328,344),this.magic=n.Utils.getStringAt(s,344,348),this.isHDR=this.magic===n.NIFTI1.MAGIC_NUMBER2,s.byteLength>n.NIFTI1.MAGIC_COOKIE&&(this.extensionFlag[0]=n.Utils.getByteAt(s,348),this.extensionFlag[1]=n.Utils.getByteAt(s,349),this.extensionFlag[2]=n.Utils.getByteAt(s,350),this.extensionFlag[3]=n.Utils.getByteAt(s,351),this.extensionFlag[0]&&(this.extensionSize=this.getExtensionSize(s),this.extensionCode=this.getExtensionCode(s)))},n.NIFTI1.prototype.toFormattedString=function(){var t=n.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(n.NIFTI1.SPATIAL_UNITS_MASK&this.xyzt_units)+", "+this.getUnitsCodeString(n.NIFTI1.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},n.NIFTI1.prototype.getDatatypeCodeString=function(t){return t===n.NIFTI1.TYPE_UINT8?"1-Byte Unsigned Integer":t===n.NIFTI1.TYPE_INT16?"2-Byte Signed Integer":t===n.NIFTI1.TYPE_INT32?"4-Byte Signed Integer":t===n.NIFTI1.TYPE_FLOAT32?"4-Byte Float":t===n.NIFTI1.TYPE_FLOAT64?"8-Byte Float":t===n.NIFTI1.TYPE_RGB24?"RGB":t===n.NIFTI1.TYPE_INT8?"1-Byte Signed Integer":t===n.NIFTI1.TYPE_UINT16?"2-Byte Unsigned Integer":t===n.NIFTI1.TYPE_UINT32?"4-Byte Unsigned Integer":t===n.NIFTI1.TYPE_INT64?"8-Byte Signed Integer":t===n.NIFTI1.TYPE_UINT64?"8-Byte Unsigned Integer":"Unknown"},n.NIFTI1.prototype.getTransformCodeString=function(t){return t===n.NIFTI1.XFORM_SCANNER_ANAT?"Scanner":t===n.NIFTI1.XFORM_ALIGNED_ANAT?"Aligned":t===n.NIFTI1.XFORM_TALAIRACH?"Talairach":t===n.NIFTI1.XFORM_MNI_152?"MNI":"Unknown"},n.NIFTI1.prototype.getUnitsCodeString=function(t){return t===n.NIFTI1.UNITS_METER?"Meters":t===n.NIFTI1.UNITS_MM?"Millimeters":t===n.NIFTI1.UNITS_MICRON?"Microns":t===n.NIFTI1.UNITS_SEC?"Seconds":t===n.NIFTI1.UNITS_MSEC?"Milliseconds":t===n.NIFTI1.UNITS_USEC?"Microseconds":t===n.NIFTI1.UNITS_HZ?"Hz":t===n.NIFTI1.UNITS_PPM?"PPM":t===n.NIFTI1.UNITS_RADS?"Rads":"Unknown"},n.NIFTI1.prototype.getQformMat=function(){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])},n.NIFTI1.prototype.convertNiftiQFormToNiftiSForm=function(t,e,i,n,r,a,s,o,l,h){var d,u,f,c,_=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],p=t,m=e,g=i;return _[3][0]=_[3][1]=_[3][2]=0,_[3][3]=1,(d=1-(p*p+m*m+g*g))<1e-7?(p*=d=1/Math.sqrt(p*p+m*m+g*g),m*=d,g*=d,d=0):d=Math.sqrt(d),u=s>0?s:1,f=o>0?o:1,c=l>0?l:1,h<0&&(c=-c),_[0][0]=(d*d+p*p-m*m-g*g)*u,_[0][1]=2*(p*m-d*g)*f,_[0][2]=2*(p*g+d*m)*c,_[1][0]=2*(p*m+d*g)*u,_[1][1]=(d*d+m*m-p*p-g*g)*f,_[1][2]=2*(m*g-d*p)*c,_[2][0]=2*(p*g-d*m)*u,_[2][1]=2*(m*g+d*p)*f,_[2][2]=(d*d+g*g-m*m-p*p)*c,_[0][3]=n,_[1][3]=r,_[2][3]=a,_},n.NIFTI1.prototype.convertNiftiSFormToNEMA=function(t){var e,i,n,r,a,s,o,l,h,d,u,f,c,_,p,m,g,b,w,v,y,I,x,T,k,E,A,S,N,F,U,D,R;if(_=0,E=[[0,0,0],[0,0,0],[0,0,0]],A=[[0,0,0],[0,0,0],[0,0,0]],e=t[0][0],i=t[0][1],n=t[0][2],r=t[1][0],a=t[1][1],s=t[1][2],o=t[2][0],l=t[2][1],h=t[2][2],0===(d=Math.sqrt(e*e+r*r+o*o)))return null;if(e/=d,r/=d,o/=d,0===(d=Math.sqrt(i*i+a*a+l*l)))return null;if(d=e*(i/=d)+r*(a/=d)+o*(l/=d),Math.abs(d)>1e-4){if(i-=d*e,a-=d*r,l-=d*o,0===(d=Math.sqrt(i*i+a*a+l*l)))return null;i/=d,a/=d,l/=d}if(0===(d=Math.sqrt(n*n+s*s+h*h))?(n=r*l-o*a,s=o*i-l*e,h=e*a-r*i):(n/=d,s/=d,h/=d),d=e*n+r*s+o*h,Math.abs(d)>1e-4){if(n-=d*e,s-=d*r,h-=d*o,0===(d=Math.sqrt(n*n+s*s+h*h)))return null;n/=d,s/=d,h/=d}if(d=i*n+a*s+l*h,Math.abs(d)>1e-4){if(n-=d*i,s-=d*a,h-=d*l,0===(d=Math.sqrt(n*n+s*s+h*h)))return null;n/=d,s/=d,h/=d}if(E[0][0]=e,E[0][1]=i,E[0][2]=n,E[1][0]=r,E[1][1]=a,E[1][2]=s,E[2][0]=o,E[2][1]=l,E[2][2]=h,0===(u=this.nifti_mat33_determ(E)))return null;for(k=-666,b=y=I=x=1,w=2,v=3,f=1;f<=3;f+=1)for(c=1;c<=3;c+=1)if(f!==c)for(_=1;_<=3;_+=1)if(f!==_&&c!==_)for(A[0][0]=A[0][1]=A[0][2]=A[1][0]=A[1][1]=A[1][2]=A[2][0]=A[2][1]=A[2][2]=0,p=-1;p<=1;p+=2)for(m=-1;m<=1;m+=2)for(g=-1;g<=1;g+=2)A[0][f-1]=p,A[1][c-1]=m,A[2][_-1]=g,this.nifti_mat33_determ(A)*u>0&&(d=(T=this.nifti_mat33_mul(A,E))[0][0]+T[1][1]+T[2][2])>k&&(k=d,b=f,w=c,v=_,y=p,I=m,x=g);switch(S=N=F=U=D=R=0,b*y){case 1:S="X",U="+";break;case-1:S="X",U="-";break;case 2:S="Y",U="+";break;case-2:S="Y",U="-";break;case 3:S="Z",U="+";break;case-3:S="Z",U="-"}switch(w*I){case 1:N="X",D="+";break;case-1:N="X",D="-";break;case 2:N="Y",D="+";break;case-2:N="Y",D="-";break;case 3:N="Z",D="+";break;case-3:N="Z",D="-"}switch(v*x){case 1:F="X",R="+";break;case-1:F="X",R="-";break;case 2:F="Y",R="+";break;case-2:F="Y",R="-";break;case 3:F="Z",R="+";break;case-3:F="Z",R="-"}return S+N+F+U+D+R},n.NIFTI1.prototype.nifti_mat33_mul=function(t,e){var i,n,r=[[0,0,0],[0,0,0],[0,0,0]];for(i=0;i<3;i+=1)for(n=0;n<3;n+=1)r[i][n]=t[i][0]*e[0][n]+t[i][1]*e[1][n]+t[i][2]*e[2][n];return r},n.NIFTI1.prototype.nifti_mat33_determ=function(t){var e,i,n,r,a,s,o,l,h;return e=t[0][0],i=t[0][1],n=t[0][2],r=t[1][0],a=t[1][1],s=t[1][2],o=t[2][0],l=t[2][1],e*a*(h=t[2][2])-e*l*s-r*i*h+r*l*n+o*i*s-o*a*n},n.NIFTI1.prototype.getExtensionLocation=function(){return n.NIFTI1.MAGIC_COOKIE+4},n.NIFTI1.prototype.getExtensionSize=function(t){return n.Utils.getIntAt(t,this.getExtensionLocation(),this.littleEndian)},n.NIFTI1.prototype.getExtensionCode=function(t){return n.Utils.getIntAt(t,this.getExtensionLocation()+4,this.littleEndian)};t.exports&&(t.exports=n.NIFTI1)},8829:(t,e,i)=>{"use strict";var n=n||{};n.Utils=n.Utils||i(4731),n.NIFTI1=n.NIFTI1||i(6714),n.NIFTI2=n.NIFTI2||function(){this.littleEndian=!1,this.dim_info=0,this.dims=[],this.intent_p1=0,this.intent_p2=0,this.intent_p3=0,this.intent_code=0,this.datatypeCode=0,this.numBitsPerVoxel=0,this.slice_start=0,this.slice_end=0,this.slice_code=0,this.pixDims=[],this.vox_offset=0,this.scl_slope=1,this.scl_inter=0,this.xyzt_units=0,this.cal_max=0,this.cal_min=0,this.slice_duration=0,this.toffset=0,this.description="",this.aux_file="",this.intent_name="",this.qform_code=0,this.sform_code=0,this.quatern_b=0,this.quatern_c=0,this.quatern_d=0,this.qoffset_x=0,this.qoffset_y=0,this.qoffset_z=0,this.affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],this.magic=0,this.extensionFlag=[0,0,0,0]},n.NIFTI2.MAGIC_COOKIE=540,n.NIFTI2.MAGIC_NUMBER_LOCATION=4,n.NIFTI2.MAGIC_NUMBER=[110,43,50,0,13,10,26,10],n.NIFTI2.prototype.readHeader=function(t){var e,i,r,a,s=new DataView(t),o=n.Utils.getIntAt(s,0,this.littleEndian);if(o!==n.NIFTI2.MAGIC_COOKIE&&(this.littleEndian=!0,o=n.Utils.getIntAt(s,0,this.littleEndian)),o!==n.NIFTI2.MAGIC_COOKIE)throw new Error("This does not appear to be a NIFTI file!");for(this.datatypeCode=n.Utils.getShortAt(s,12,this.littleEndian),this.numBitsPerVoxel=n.Utils.getShortAt(s,14,this.littleEndian),e=0;e<8;e+=1)a=16+8*e,this.dims[e]=n.Utils.getLongAt(s,a,this.littleEndian);for(this.intent_p1=n.Utils.getDoubleAt(s,80,this.littleEndian),this.intent_p2=n.Utils.getDoubleAt(s,88,this.littleEndian),this.intent_p3=n.Utils.getDoubleAt(s,96,this.littleEndian),e=0;e<8;e+=1)a=104+8*e,this.pixDims[e]=n.Utils.getDoubleAt(s,a,this.littleEndian);for(this.vox_offset=n.Utils.getLongAt(s,168,this.littleEndian),this.scl_slope=n.Utils.getDoubleAt(s,176,this.littleEndian),this.scl_inter=n.Utils.getDoubleAt(s,184,this.littleEndian),this.cal_max=n.Utils.getDoubleAt(s,192,this.littleEndian),this.cal_min=n.Utils.getDoubleAt(s,200,this.littleEndian),this.slice_duration=n.Utils.getDoubleAt(s,208,this.littleEndian),this.toffset=n.Utils.getDoubleAt(s,216,this.littleEndian),this.slice_start=n.Utils.getLongAt(s,224,this.littleEndian),this.slice_end=n.Utils.getLongAt(s,232,this.littleEndian),this.description=n.Utils.getStringAt(s,240,320),this.aux_file=n.Utils.getStringAt(s,320,344),this.qform_code=n.Utils.getIntAt(s,344,this.littleEndian),this.sform_code=n.Utils.getIntAt(s,348,this.littleEndian),this.quatern_b=n.Utils.getDoubleAt(s,352,this.littleEndian),this.quatern_c=n.Utils.getDoubleAt(s,360,this.littleEndian),this.quatern_d=n.Utils.getDoubleAt(s,368,this.littleEndian),this.qoffset_x=n.Utils.getDoubleAt(s,376,this.littleEndian),this.qoffset_y=n.Utils.getDoubleAt(s,384,this.littleEndian),this.qoffset_z=n.Utils.getDoubleAt(s,392,this.littleEndian),i=0;i<3;i+=1)for(r=0;r<4;r+=1)a=400+8*(4*i+r),this.affine[i][r]=n.Utils.getDoubleAt(s,a,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=n.Utils.getIntAt(s,496,this.littleEndian),this.xyzt_units=n.Utils.getIntAt(s,500,this.littleEndian),this.intent_code=n.Utils.getIntAt(s,504,this.littleEndian),this.intent_name=n.Utils.getStringAt(s,508,524),this.dim_info=n.Utils.getByteAt(s,524),s.byteLength>n.NIFTI2.MAGIC_COOKIE&&(this.extensionFlag[0]=n.Utils.getByteAt(s,540),this.extensionFlag[1]=n.Utils.getByteAt(s,541),this.extensionFlag[2]=n.Utils.getByteAt(s,542),this.extensionFlag[3]=n.Utils.getByteAt(s,543),this.extensionFlag[0]&&(this.extensionSize=this.getExtensionSize(s),this.extensionCode=this.getExtensionCode(s)))},n.NIFTI2.prototype.toFormattedString=function(){var t=n.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(n.NIFTI1.SPATIAL_UNITS_MASK&this.xyzt_units)+", "+this.getUnitsCodeString(n.NIFTI1.TEMPORAL_UNITS_MASK&this.xyzt_units)+")\n",e+="Intent Code = "+this.intent_code+"\n",e+='Intent Name: "'+this.intent_name+'"\n',e+="Dim Info = "+this.dim_info+"\n"},n.NIFTI2.prototype.getExtensionLocation=function(){return n.NIFTI2.MAGIC_COOKIE+4},n.NIFTI2.prototype.getExtensionSize=n.NIFTI1.prototype.getExtensionSize,n.NIFTI2.prototype.getExtensionCode=n.NIFTI1.prototype.getExtensionCode,n.NIFTI2.prototype.getDatatypeCodeString=n.NIFTI1.prototype.getDatatypeCodeString,n.NIFTI2.prototype.getTransformCodeString=n.NIFTI1.prototype.getTransformCodeString,n.NIFTI2.prototype.getUnitsCodeString=n.NIFTI1.prototype.getUnitsCodeString,n.NIFTI2.prototype.getQformMat=n.NIFTI1.prototype.getQformMat,n.NIFTI2.prototype.convertNiftiQFormToNiftiSForm=n.NIFTI1.prototype.convertNiftiQFormToNiftiSForm,n.NIFTI2.prototype.convertNiftiSFormToNEMA=n.NIFTI1.prototype.convertNiftiSFormToNEMA,n.NIFTI2.prototype.nifti_mat33_mul=n.NIFTI1.prototype.nifti_mat33_mul,n.NIFTI2.prototype.nifti_mat33_determ=n.NIFTI1.prototype.nifti_mat33_determ;t.exports&&(t.exports=n.NIFTI2)},4731:t=>{"use strict";var e=e||{};e.Utils=e.Utils||{},e.Utils.crcTable=null,e.Utils.GUNZIP_MAGIC_COOKIE1=31,e.Utils.GUNZIP_MAGIC_COOKIE2=139,e.Utils.getStringAt=function(t,e,i){var n,r,a="";for(n=e;n<i;n+=1)0!==(r=t.getUint8(n))&&(a+=String.fromCharCode(r));return a},e.Utils.getByteAt=function(t,e){return t.getInt8(e)},e.Utils.getShortAt=function(t,e,i){return t.getInt16(e,i)},e.Utils.getIntAt=function(t,e,i){return t.getInt32(e,i)},e.Utils.getFloatAt=function(t,e,i){return t.getFloat32(e,i)},e.Utils.getDoubleAt=function(t,e,i){return t.getFloat64(e,i)},e.Utils.getLongAt=function(t,i,n){var r,a=[],s=0;for(r=0;r<8;r+=1)a[r]=e.Utils.getByteAt(t,i+r,n);for(r=a.length-1;r>=0;r--)s=256*s+a[r];return s},e.Utils.toArrayBuffer=function(t){var e,i,n;for(e=new ArrayBuffer(t.length),i=new Uint8Array(e),n=0;n<t.length;n+=1)i[n]=t[n];return e},e.Utils.isString=function(t){return"string"==typeof t||t instanceof String},e.Utils.formatNumber=function(t,i){var n=0;return n=e.Utils.isString(t)?Number(t):t,n=i?n.toPrecision(5):n.toPrecision(7),parseFloat(n)},e.Utils.makeCRCTable=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e},e.Utils.crc32=function(t){for(var i=e.Utils.crcTable||(e.Utils.crcTable=e.Utils.makeCRCTable()),n=-1,r=0;r<t.byteLength;r++)n=n>>>8^i[255&(n^t.getUint8(r))];return(-1^n)>>>0};t.exports&&(t.exports=e.Utils)},2744:(t,e,i)=>{"use strict";const{Deflate:n,deflate:r,deflateRaw:a,gzip:s}=i(4395),{Inflate:o,inflate:l,inflateRaw:h,ungzip:d}=i(578),u=i(2684);t.exports.Deflate=n,t.exports.deflate=r,t.exports.deflateRaw=a,t.exports.gzip=s,t.exports.Inflate=o,t.exports.inflate=l,t.exports.inflateRaw=h,t.exports.ungzip=d,t.exports.constants=u},4395:(t,e,i)=>{"use strict";const n=i(7651),r=i(9187),a=i(8592),s=i(5604),o=i(249),l=Object.prototype.toString,{Z_NO_FLUSH:h,Z_SYNC_FLUSH:d,Z_FULL_FLUSH:u,Z_FINISH:f,Z_OK:c,Z_STREAM_END:_,Z_DEFAULT_COMPRESSION:p,Z_DEFAULT_STRATEGY:m,Z_DEFLATED:g}=i(2684);function b(t){this.options=r.assign({level:p,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:m},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;let i=n.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==c)throw new Error(s[i]);if(e.header&&n.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?a.string2buf(e.dictionary):"[object ArrayBuffer]"===l.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=n.deflateSetDictionary(this.strm,t),i!==c)throw new Error(s[i]);this._dict_set=!0}}function w(t,e){const i=new b(e);if(i.push(t,!0),i.err)throw i.msg||s[i.err];return i.result}b.prototype.push=function(t,e){const i=this.strm,r=this.options.chunkSize;let s,o;if(this.ended)return!1;for(o=e===~~e?e:!0===e?f:h,"string"==typeof t?i.input=a.string2buf(t):"[object ArrayBuffer]"===l.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),(o===d||o===u)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=n.deflate(i,o),s===_)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=n.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===c;if(0!==i.avail_out){if(o>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},b.prototype.onData=function(t){this.chunks.push(t)},b.prototype.onEnd=function(t){t===c&&(this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},t.exports.Deflate=b,t.exports.deflate=w,t.exports.deflateRaw=function(t,e){return(e=e||{}).raw=!0,w(t,e)},t.exports.gzip=function(t,e){return(e=e||{}).gzip=!0,w(t,e)},t.exports.constants=i(2684)},578:(t,e,i)=>{"use strict";const n=i(7823),r=i(9187),a=i(8592),s=i(5604),o=i(249),l=i(9968),h=Object.prototype.toString,{Z_NO_FLUSH:d,Z_FINISH:u,Z_OK:f,Z_STREAM_END:c,Z_NEED_DICT:_,Z_STREAM_ERROR:p,Z_DATA_ERROR:m,Z_MEM_ERROR:g}=i(2684);function b(t){this.options=r.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;let i=n.inflateInit2(this.strm,e.windowBits);if(i!==f)throw new Error(s[i]);if(this.header=new l,n.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=a.string2buf(e.dictionary):"[object ArrayBuffer]"===h.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=n.inflateSetDictionary(this.strm,e.dictionary),i!==f)))throw new Error(s[i])}function w(t,e){const i=new b(e);if(i.push(t),i.err)throw i.msg||s[i.err];return i.result}b.prototype.push=function(t,e){const i=this.strm,r=this.options.chunkSize,s=this.options.dictionary;let o,l,b;if(this.ended)return!1;for(l=e===~~e?e:!0===e?u:d,"[object ArrayBuffer]"===h.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(r),i.next_out=0,i.avail_out=r),o=n.inflate(i,l),o===_&&s&&(o=n.inflateSetDictionary(i,s),o===f?o=n.inflate(i,l):o===m&&(o=_));i.avail_in>0&&o===c&&i.state.wrap>0&&0!==t[i.next_in];)n.inflateReset(i),o=n.inflate(i,l);switch(o){case p:case m:case _:case g:return this.onEnd(o),this.ended=!0,!1}if(b=i.avail_out,i.next_out&&(0===i.avail_out||o===c))if("string"===this.options.to){let t=a.utf8border(i.output,i.next_out),e=i.next_out-t,n=a.buf2string(i.output,t);i.next_out=e,i.avail_out=r-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(n)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(o!==f||0!==b){if(o===c)return o=n.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},b.prototype.onData=function(t){this.chunks.push(t)},b.prototype.onEnd=function(t){t===f&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},t.exports.Inflate=b,t.exports.inflate=w,t.exports.inflateRaw=function(t,e){return(e=e||{}).raw=!0,w(t,e)},t.exports.ungzip=w,t.exports.constants=i(2684)},9187:t=>{"use strict";const e=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);t.exports.assign=function(t){const i=Array.prototype.slice.call(arguments,1);for(;i.length;){const n=i.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const i in n)e(n,i)&&(t[i]=n[i])}}return t},t.exports.flattenChunks=t=>{let e=0;for(let i=0,n=t.length;i<n;i++)e+=t[i].length;const i=new Uint8Array(e);for(let e=0,n=0,r=t.length;e<r;e++){let r=t[e];i.set(r,n),n+=r.length}return i}},8592:t=>{"use strict";let e=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){e=!1}const i=new Uint8Array(256);for(let t=0;t<256;t++)i[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;i[254]=i[254]=1,t.exports.string2buf=t=>{let e,i,n,r,a,s=t.length,o=0;for(r=0;r<s;r++)i=t.charCodeAt(r),55296==(64512&i)&&r+1<s&&(n=t.charCodeAt(r+1),56320==(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),r++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(e=new Uint8Array(o),a=0,r=0;a<o;r++)i=t.charCodeAt(r),55296==(64512&i)&&r+1<s&&(n=t.charCodeAt(r+1),56320==(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),r++)),i<128?e[a++]=i:i<2048?(e[a++]=192|i>>>6,e[a++]=128|63&i):i<65536?(e[a++]=224|i>>>12,e[a++]=128|i>>>6&63,e[a++]=128|63&i):(e[a++]=240|i>>>18,e[a++]=128|i>>>12&63,e[a++]=128|i>>>6&63,e[a++]=128|63&i);return e};t.exports.buf2string=(t,n)=>{let r,a;const s=n||t.length,o=new Array(2*s);for(a=0,r=0;r<s;){let e=t[r++];if(e<128){o[a++]=e;continue}let n=i[e];if(n>4)o[a++]=65533,r+=n-1;else{for(e&=2===n?31:3===n?15:7;n>1&&r<s;)e=e<<6|63&t[r++],n--;n>1?o[a++]=65533:e<65536?o[a++]=e:(e-=65536,o[a++]=55296|e>>10&1023,o[a++]=56320|1023&e)}}return((t,i)=>{if(i<65534&&t.subarray&&e)return String.fromCharCode.apply(null,t.length===i?t:t.subarray(0,i));let n="";for(let e=0;e<i;e++)n+=String.fromCharCode(t[e]);return n})(o,a)},t.exports.utf8border=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let n=e-1;for(;n>=0&&128==(192&t[n]);)n--;return n<0||0===n?e:n+i[t[n]]>e?n:e}},3693:t=>{"use strict";t.exports=(t,e,i,n)=>{let r=65535&t|0,a=t>>>16&65535|0,s=0;for(;0!==i;){s=i>2e3?2e3:i,i-=s;do{r=r+e[n++]|0,a=a+r|0}while(--s);r%=65521,a%=65521}return r|a<<16|0}},2684:t=>{"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},8464:t=>{"use strict";const e=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());t.exports=(t,i,n,r)=>{const a=e,s=r+n;t^=-1;for(let e=r;e<s;e++)t=t>>>8^a[255&(t^i[e])];return-1^t}},7651:(t,e,i)=>{"use strict";const{_tr_init:n,_tr_stored_block:r,_tr_flush_block:a,_tr_tally:s,_tr_align:o}=i(8676),l=i(3693),h=i(8464),d=i(5604),{Z_NO_FLUSH:u,Z_PARTIAL_FLUSH:f,Z_FULL_FLUSH:c,Z_FINISH:_,Z_BLOCK:p,Z_OK:m,Z_STREAM_END:g,Z_STREAM_ERROR:b,Z_DATA_ERROR:w,Z_BUF_ERROR:v,Z_DEFAULT_COMPRESSION:y,Z_FILTERED:I,Z_HUFFMAN_ONLY:x,Z_RLE:T,Z_FIXED:k,Z_DEFAULT_STRATEGY:E,Z_UNKNOWN:A,Z_DEFLATED:S}=i(2684),N=258,F=262,U=103,D=113,R=666,P=(t,e)=>(t.msg=d[e],e),C=t=>(t<<1)-(t>4?9:0),O=t=>{let e=t.length;for(;--e>=0;)t[e]=0};let M=(t,e,i)=>(e<<t.hash_shift^i)&t.hash_mask;const z=t=>{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},L=(t,e)=>{a(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,z(t.strm)},B=(t,e)=>{t.pending_buf[t.pending++]=e},j=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Z=(t,e,i,n)=>{let r=t.avail_in;return r>n&&(r=n),0===r?0:(t.avail_in-=r,e.set(t.input.subarray(t.next_in,t.next_in+r),i),1===t.state.wrap?t.adler=l(t.adler,e,r,i):2===t.state.wrap&&(t.adler=h(t.adler,e,r,i)),t.next_in+=r,t.total_in+=r,r)},q=(t,e)=>{let i,n,r=t.max_chain_length,a=t.strstart,s=t.prev_length,o=t.nice_match;const l=t.strstart>t.w_size-F?t.strstart-(t.w_size-F):0,h=t.window,d=t.w_mask,u=t.prev,f=t.strstart+N;let c=h[a+s-1],_=h[a+s];t.prev_length>=t.good_match&&(r>>=2),o>t.lookahead&&(o=t.lookahead);do{if(i=e,h[i+s]===_&&h[i+s-1]===c&&h[i]===h[a]&&h[++i]===h[a+1]){a+=2,i++;do{}while(h[++a]===h[++i]&&h[++a]===h[++i]&&h[++a]===h[++i]&&h[++a]===h[++i]&&h[++a]===h[++i]&&h[++a]===h[++i]&&h[++a]===h[++i]&&h[++a]===h[++i]&&a<f);if(n=N-(f-a),a=f-N,n>s){if(t.match_start=e,s=n,n>=o)break;c=h[a+s-1],_=h[a+s]}}}while((e=u[e&d])>l&&0!=--r);return s<=t.lookahead?s:t.lookahead},H=t=>{const e=t.w_size;let i,n,r,a,s;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-F)){t.window.set(t.window.subarray(e,e+e),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,n=t.hash_size,i=n;do{r=t.head[--i],t.head[i]=r>=e?r-e:0}while(--n);n=e,i=n;do{r=t.prev[--i],t.prev[i]=r>=e?r-e:0}while(--n);a+=e}if(0===t.strm.avail_in)break;if(n=Z(t.strm,t.window,t.strstart+t.lookahead,a),t.lookahead+=n,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=M(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=M(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<F&&0!==t.strm.avail_in)},Y=(t,e)=>{let i,n;for(;;){if(t.lookahead<F){if(H(t),t.lookahead<F&&e===u)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(t.ins_h=M(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-F&&(t.match_length=q(t,i)),t.match_length>=3)if(n=s(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=M(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=M(t,t.ins_h,t.window[t.strstart+1]);else n=s(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(L(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===_?(L(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(L(t,!1),0===t.strm.avail_out)?1:2},G=(t,e)=>{let i,n,r;for(;;){if(t.lookahead<F){if(H(t),t.lookahead<F&&e===u)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(t.ins_h=M(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length<t.max_lazy_match&&t.strstart-i<=t.w_size-F&&(t.match_length=q(t,i),t.match_le