dwv 0.35.0 → 0.36.0-beta.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.
@@ -0,0 +1,2 @@
1
+ class t{#t;#e;#s;constructor(t,e,s){this.#t=t,this.#e=e,this.#s=s}getX(){return this.#t}getY(){return this.#e}getZ(){return this.#s}equals(t){return null!==t&&this.#t===t.getX()&&this.#e===t.getY()&&this.#s===t.getZ()}toString(){return"("+this.#t+", "+this.#e+", "+this.#s+")"}norm(){return Math.sqrt(this.#t*this.#t+this.#e*this.#e+this.#s*this.#s)}crossProduct(e){return new t(this.#e*e.getZ()-e.getY()*this.#s,this.#s*e.getX()-e.getZ()*this.#t,this.#t*e.getY()-e.getX()*this.#e)}dotProduct(t){return this.#t*t.getX()+this.#e*t.getY()+this.#s*t.getZ()}isCodirectional(t){return this.dotProduct(t)>0}}class e{#t;#e;#s;constructor(t,e,s){this.#t=t,this.#e=e,this.#s=s}getX(){return this.#t}getY(){return this.#e}getZ(){return this.#s}getValues(){return[this.#t,this.#e,this.#s]}equals(t){return null!==t&&this.#t===t.getX()&&this.#e===t.getY()&&this.#s===t.getZ()}isSimilar(t,e){return null!==t&&i(this.#t,t.getX(),e)&&i(this.#e,t.getY(),e)&&i(this.#s,t.getZ(),e)}toString(){return"("+this.#t+", "+this.#e+", "+this.#s+")"}getDistance(t){return Math.sqrt(this.#r(t))}#r(t){const e=this.#t-t.getX(),s=this.#e-t.getY(),r=this.#s-t.getZ();return e*e+s*s+r*r}getClosest(t){let e=0,s=this.#r(t[e]);for(let r=0;r<t.length;++r){const n=this.#r(t[r]);n<s&&(e=r,s=n)}return e}minus(e){return new t(this.#t-e.getX(),this.#e-e.getY(),this.#s-e.getZ())}}class s{#n;constructor(t){if(!t||void 0===t)throw new Error("Cannot create index with no values.");if(0===t.length)throw new Error("Cannot create index with empty values.");if(!t.every((function(t){return!isNaN(t)})))throw new Error("Cannot create index with non number values.");this.#n=t}get(t){return this.#n[t]}length(){return this.#n.length}toString(){return"("+this.#n.toString()+")"}getValues(){return this.#n.slice()}canCompare(t){return!!t&&this.length()===t.length()}equals(t){if(!this.canCompare(t))return!1;for(let e=0,s=this.length();e<s;++e)if(this.get(e)!==t.get(e))return!1;return!0}compare(t){if(!this.canCompare(t))return null;const e=[];for(let s=0,r=this.length();s<r;++s)this.get(s)!==t.get(s)&&e.push(s);return e}add(t){if(!this.canCompare(t))return null;const e=[];for(let s=0,r=this.length();s<r;++s)e.push(this.get(s)+t.get(s));return new s(e)}#i(t,e){const r=this.#n.slice();return t<r.length?r[t]+=e:console.warn("Cannot add to given dimension: ",t,r.length),new s(r)}next(t){return this.#i(t,1)}previous(t){return this.#i(t,-1)}getWithNew2D(t,e){const r=[t,e];for(let t=2,e=this.length();t<e;++t)r.push(this.get(t));return new s(r)}}const r={levels:{TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4},level:3,trace:function(t){this.level<=this.levels.TRACE&&console.trace(t)},debug:function(t){this.level<=this.levels.DEBUG&&console.debug(t)},info:function(t){this.level<=this.levels.INFO&&console.info(t)},warn:function(t){this.level<=this.levels.WARN&&console.warn(t)},error:function(t){this.level<=this.levels.ERROR&&console.error(t)}},n=1e4*Number.EPSILON;function i(t,e,s){return void 0===s&&(s=Number.EPSILON),Math.abs(t-e)<s}class h{#n;#h;constructor(t){this.#n=t}get(t,e){return this.#n[3*t+e]}getInverse(){return void 0===this.#h&&(this.#h=function(t){const e=t.get(0,0),s=t.get(0,1),n=t.get(0,2),i=t.get(1,0),a=t.get(1,1),l=t.get(1,2),u=t.get(2,0),o=t.get(2,1),g=t.get(2,2),c=a*g-l*o,v=l*u-i*g,f=i*o-a*u;let d=e*c+s*v+n*f;if(0!==d)return d=1/d,new h([d*c,d*(n*o-s*g),d*(s*l-n*a),d*v,d*(e*g-n*u),d*(n*i-e*l),d*f,d*(s*u-e*o),d*(e*a-s*i)]);r.warn("Cannot invert 3*3 matrix with zero determinant.")}(this)),this.#h}equals(t){for(let e=0;e<3;++e)for(let s=0;s<3;++s)if(this.get(e,s)!==t.get(e,s))return!1;return!0}isSimilar(t,e){for(let s=0;s<3;++s)for(let r=0;r<3;++r)if(!i(this.get(s,r),t.get(s,r),e))return!1;return!0}toString(){let t="[";for(let e=0;e<3;++e){0!==e&&(t+=", \n ");for(let s=0;s<3;++s)0!==s&&(t+=", "),t+=this.get(e,s)}return t+="]",t}multiply(t){const e=[];for(let s=0;s<3;++s)for(let r=0;r<3;++r){let n=0;for(let e=0;e<3;++e)n+=this.get(s,e)*t.get(e,r);e.push(n)}return new h(e)}getAbs(){const t=[];for(let e=0;e<3;++e)for(let s=0;s<3;++s)t.push(Math.abs(this.get(e,s)));return new h(t)}multiplyArray3D(t){if(3!==t.length)throw new Error("Cannot multiply 3x3 matrix with non 3D array: "+t.length);const e=t[0],s=t[1],r=t[2],n=new Array(3);return n[0]=this.#n[0]*e+this.#n[1]*s+this.#n[2]*r,n[1]=this.#n[3]*e+this.#n[4]*s+this.#n[5]*r,n[2]=this.#n[6]*e+this.#n[7]*s+this.#n[8]*r,n}multiplyTypedArray3D(t,e){const s=t[0],r=t[1],n=t[2];e[0]=this.#n[0]*s+this.#n[1]*r+this.#n[2]*n,e[1]=this.#n[3]*s+this.#n[4]*r+this.#n[5]*n,e[2]=this.#n[6]*s+this.#n[7]*r+this.#n[8]*n}multiplyVector3D(e){const s=this.multiplyArray3D([e.getX(),e.getY(),e.getZ()]);return new t(s[0],s[1],s[2])}multiplyPoint3D(t){const s=this.multiplyArray3D([t.getX(),t.getY(),t.getZ()]);return new e(s[0],s[1],s[2])}multiplyIndex3D(t){const e=this.multiplyArray3D(t.getValues());return new s(e)}getRowAbsMax(t){const e=[Math.abs(this.get(t,0)),Math.abs(this.get(t,1)),Math.abs(this.get(t,2))],s=Math.max.apply(null,e),r=e.indexOf(s);return{value:this.get(t,r),index:r}}getColAbsMax(t){const e=[Math.abs(this.get(0,t)),Math.abs(this.get(1,t)),Math.abs(this.get(2,t))],s=Math.max.apply(null,e),r=e.indexOf(s);return{value:this.get(r,t),index:r}}asOneAndZeros(){const t=[];for(let e=0;e<3;++e){const s=this.getRowAbsMax(e),r=s.value>0?1:-1;for(let e=0;e<3;++e)e===s.index?t.push(1*r):t.push(0)}return new h(t)}getThirdColMajorDirection(){return this.getColAbsMax(2).index}getValues(){return this.#n.slice()}}class a{#a(t,e,s,r){const n=Math.floor(t[0]),i=Math.floor(t[1]),h=Math.floor(t[2]),a=n<0?0:n,l=n+1>=s[0]?n:n+1,u=i<0?0:i,o=i+1>=s[1]?i:i+1,g=h<0?0:h,c=h+1>=s[2]?h:h+1,v=a*r[0],f=l*r[0],d=u*r[1],y=o*r[1],p=g*r[2],m=c*r[2],w=v+d+p,x=v+d+m,M=v+y+p,b=v+y+m,z=f+d+p,D=f+d+m,A=f+y+p,S=f+y+m,C=a>=0&&a<s[0],R=l>=0&&l<s[0],E=u>=0&&u<s[1],Z=o>=0&&o<s[1],X=g>=0&&g<s[2],Y=c>=0&&c<s[2],I=C&&E&&X?e[w]:0,N=C&&E&&Y?e[x]:0,O=C&&Z&&X?e[M]:0,q=C&&Z&&Y?e[b]:0,T=R&&E&&X?e[z]:0,V=R&&E&&Y?e[D]:0,B=R&&Z&&X?e[A]:0,P=R&&Z&&Y?e[S]:0,U=Math.abs(t[0]-n),L=Math.abs(t[1]-i),W=Math.abs(t[2]-h),F=1-U,G=1-L,j=1-W;return I*(F*G*j)+N*(F*G*W)+O*(F*L*j)+q*(F*L*W)+T*(U*G*j)+V*(U*G*W)+B*(U*L*j)+P*(U*L*W)}#l(t){const e=Math.round(t);return Math.abs(t-e)<n?e:t}run(t){const e=t.sourceSize,s=t.targetSize,r=t.sourceUnitVectors,n=t.targetUnitVectors,i=t.sourceSpacing,a=t.targetSpacing,l=t.sourceImageBuffer,u=t.interpolate,o=new h(t.sourceOrientation),g=new h(t.targetOrientation),c=o.getInverse(),v=g.multiply(c),f=[(s[0]-1)/2,(s[1]-1)/2,(s[2]-1)/2],d=[(e[0]-1)/2,(e[1]-1)/2,(e[2]-1)/2],y=new Array(3),p=new Array(3),m=new Array(3);let w,x,M;for(let h=0;h<s[0];h++){y[0]=(h-f[0])*a[0],w=n[0]*h;for(let h=0;h<s[1];h++){y[1]=(h-f[1])*a[1],x=w+n[1]*h;for(let h=0;h<s[2];h++)if(y[2]=(h-f[2])*a[2],v.multiplyTypedArray3D(y,p),m[0]=this.#l(p[0]/i[0]+d[0]),m[1]=this.#l(p[1]/i[1]+d[1]),m[2]=this.#l(p[2]/i[2]+d[2]),m[0]>=0&&m[0]<e[0]&&m[1]>=0&&m[1]<e[1]&&m[2]>=0&&m[2]<e[2])if(M=x+n[2]*h,u){const s=this.#a(m,l,e,r);t.targetImageBuffer[M]=s}else{const e=r[0]*Math.round(m[0])+r[1]*Math.round(m[1])+r[2]*Math.round(m[2]);t.targetImageBuffer[M]=t.sourceImageBuffer[e]}}}}}self.addEventListener("message",(function(t){(new a).run(t.data),self.postMessage(t.data)}),!1);
2
+ //# sourceMappingURL=resampling.worker.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets/workers/resampling.worker.min.js","mappings":"AAGO,MAAMA,EAOX,GAOA,GAOA,GAOAC,WAAAA,CAAYC,EAAGC,EAAGC,GAChBC,MAAK,EAAKH,EACVG,MAAK,EAAKF,EACVE,MAAK,EAAKD,CACZ,CAOAE,IAAAA,GACE,OAAOD,MAAK,CACd,CAOAE,IAAAA,GACE,OAAOF,MAAK,CACd,CAOAG,IAAAA,GACE,OAAOH,MAAK,CACd,CAQAI,MAAAA,CAAOC,GACL,OAAe,OAARA,GACLL,MAAK,IAAOK,EAAIJ,QAChBD,MAAK,IAAOK,EAAIH,QAChBF,MAAK,IAAOK,EAAIF,MACpB,CAOAG,QAAAA,GACE,MAAO,IAAMN,MAAK,EAChB,KAAOA,MAAK,EACZ,KAAOA,MAAK,EAAK,GACrB,CAOAO,IAAAA,GACE,OAAOC,KAAKC,KACTT,MAAK,EAAKA,MAAK,EACfA,M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jL,IAiBjC,GAhBAgM,EAAmB,IAAMhM,EAAI8L,EAAe,IAAMT,EAAc,GAEhEQ,EAAepF,qBACbuF,EAAoBC,GAGtBrE,EAAM,GAAK3H,MAAK,EACbgM,EAAc,GAAKb,EAAc,GAAMW,EAAe,IAEzDnE,EAAM,GAAK3H,MAAK,EACbgM,EAAc,GAAKb,EAAc,GAAMW,EAAe,IAEzDnE,EAAM,GAAK3H,MAAK,EACbgM,EAAc,GAAKb,EAAc,GAAMW,EAAe,IAIvDnE,EAAM,IAAM,GAAKA,EAAM,GAAKoD,EAAW,IACvCpD,EAAM,IAAM,GAAKA,EAAM,GAAKoD,EAAW,IACvCpD,EAAM,IAAM,GAAKA,EAAM,GAAKoD,EAAW,GAIvC,GAFAoB,EAAeD,EAAchB,EAAkB,GAAKnL,EAEhDuL,EAAa,CAEf,MAAMc,EAASpM,MAAK,EAClB2H,EACA0D,EACAN,EACAE,GAEFH,EAAcuB,kBAAkBF,GAAgBC,CAElD,KAAO,CAEL,MAAME,EACHrB,EAAkB,GAAKzK,KAAKoK,MAAMjD,EAAM,IACxCsD,EAAkB,GAAKzK,KAAKoK,MAAMjD,EAAM,IACxCsD,EAAkB,GAAKzK,KAAKoK,MAAMjD,EAAM,IAE3CmD,EAAcuB,kBAAkBF,GAC9BrB,EAAcO,kBAAkBiB,EACpC,CAGN,CACF,CACF,EC7LFC,KAAKC,iBAAiB,WAAW,SAAUC,IAE1B,IAAI/E,GACZmD,IAAI4B,EAAMC,MACjBH,KAAKI,YAAYF,EAAMC,KAEzB,IAAG","sources":["webpack://dwv/./src/math/vector.js","webpack://dwv/./src/math/point.js","webpack://dwv/./src/math/index.js","webpack://dwv/./src/utils/logger.js","webpack://dwv/./src/math/matrix.js","webpack://dwv/./src/image/resamplingFilter.js","webpack://dwv/./src/image/resampling.worker.js"],"sourcesContent":["/**\n * Immutable 3D vector.\n */\nexport class Vector3D {\n\n /**\n * X coordinate.\n *\n * @type {number}\n */\n #x;\n\n /**\n * Y coordinate.\n *\n * @type {number}\n */\n #y;\n\n /**\n * Z coordinate.\n *\n * @type {number}\n */\n #z;\n\n /**\n * @param {number} x The X component of the vector.\n * @param {number} y The Y component of the vector.\n * @param {number} z The Z component of the vector.\n */\n constructor(x, y, z) {\n this.#x = x;\n this.#y = y;\n this.#z = z;\n }\n\n /**\n * Get the X component of the vector.\n *\n * @returns {number} The X component of the vector.\n */\n getX() {\n return this.#x;\n }\n\n /**\n * Get the Y component of the vector.\n *\n * @returns {number} The Y component of the vector.\n */\n getY() {\n return this.#y;\n }\n\n /**\n * Get the Z component of the vector.\n *\n * @returns {number} The Z component of the vector.\n */\n getZ() {\n return this.#z;\n }\n\n /**\n * Check for Vector3D equality.\n *\n * @param {Vector3D} rhs The other vector to compare to.\n * @returns {boolean} True if both vectors are equal.\n */\n equals(rhs) {\n return rhs !== null &&\n this.#x === rhs.getX() &&\n this.#y === rhs.getY() &&\n this.#z === rhs.getZ();\n }\n\n /**\n * Get a string representation of the Vector3D.\n *\n * @returns {string} The vector as a string.\n */\n toString() {\n return '(' + this.#x +\n ', ' + this.#y +\n ', ' + this.#z + ')';\n }\n\n /**\n * Get the norm of the vector.\n *\n * @returns {number} The norm.\n */\n norm() {\n return Math.sqrt(\n (this.#x * this.#x) +\n (this.#y * this.#y) +\n (this.#z * this.#z)\n );\n }\n\n /**\n * Get the cross product with another Vector3D, ie the\n * vector that is perpendicular to both a and b.\n * If both vectors are parallel, the cross product is a zero vector.\n *\n * Ref: {@link https://en.wikipedia.org/wiki/Cross_product}.\n *\n * @param {Vector3D} vector3D The input vector.\n * @returns {Vector3D} The result vector.\n */\n crossProduct(vector3D) {\n return new Vector3D(\n (this.#y * vector3D.getZ()) - (vector3D.getY() * this.#z),\n (this.#z * vector3D.getX()) - (vector3D.getZ() * this.#x),\n (this.#x * vector3D.getY()) - (vector3D.getX() * this.#y));\n }\n\n /**\n * Get the dot product with another Vector3D.\n *\n * Ref: {@link https://en.wikipedia.org/wiki/Dot_product}.\n *\n * @param {Vector3D} vector3D The input vector.\n * @returns {number} The dot product.\n */\n dotProduct(vector3D) {\n return (this.#x * vector3D.getX()) +\n (this.#y * vector3D.getY()) +\n (this.#z * vector3D.getZ());\n }\n\n /**\n * Is this vector codirectional to an input one.\n *\n * @param {Vector3D} vector3D The vector to test.\n * @returns {boolean} True if codirectional, false is opposite.\n */\n isCodirectional(vector3D) {\n // a.dot(b) = ||a|| * ||b|| * cos(theta)\n // (https://en.wikipedia.org/wiki/Dot_product#Geometric_definition)\n // -> the sign of the dot product depends on the cosinus of\n // the angle between the vectors\n // -> >0 => vectors are codirectional\n // -> <0 => vectors are opposite\n return this.dotProduct(vector3D) > 0;\n }\n\n} // Vector3D class","import {isSimilar} from './matrix.js';\nimport {Vector3D} from './vector.js';\n\n/**\n * Immutable 2D point.\n */\nexport class Point2D {\n\n /**\n * X position.\n *\n * @type {number}\n */\n #x;\n\n /**\n * Y position.\n *\n * @type {number}\n */\n #y;\n\n /**\n * @param {number} x The X coordinate for the point.\n * @param {number} y The Y coordinate for the point.\n */\n constructor(x, y) {\n this.#x = x;\n this.#y = y;\n }\n\n /**\n * Get the X position of the point.\n *\n * @returns {number} The X position of the point.\n */\n getX() {\n return this.#x;\n }\n\n /**\n * Get the Y position of the point.\n *\n * @returns {number} The Y position of the point.\n */\n getY() {\n return this.#y;\n }\n\n /**\n * Get the values of this point.\n *\n * @returns {number[]} The array of values.\n */\n getValues() {\n return [this.#x, this.#y];\n }\n\n /**\n * Get the centroid of the point, ie itself.\n *\n * @returns {Point2D} The centroid point.\n */\n getCentroid() {\n return this;\n }\n\n /**\n * Check for Point2D equality.\n *\n * @param {Point2D} rhs The other point to compare to.\n * @returns {boolean} True if both points are equal.\n */\n equals(rhs) {\n return rhs !== null &&\n typeof rhs !== 'undefined' &&\n this.#x === rhs.getX() &&\n this.#y === rhs.getY();\n }\n\n /**\n * Get a string representation of the Point2D.\n *\n * @returns {string} The point as a string.\n */\n toString() {\n return '(' + this.#x + ', ' + this.#y + ')';\n }\n\n /**\n * Get the distance to another Point2D.\n *\n * @param {Point2D} point2D The input point.\n * @returns {number} Ths distance to the input point.\n */\n getDistance(point2D) {\n const dx = this.#x - point2D.getX();\n const dy = this.#y - point2D.getY();\n return Math.sqrt(dx * dx + dy * dy);\n }\n\n} // Point2D class\n\n/**\n * Immutable 3D point.\n */\nexport class Point3D {\n\n /**\n * X position.\n *\n * @type {number}\n */\n #x;\n\n /**\n * Y position.\n *\n * @type {number}\n */\n #y;\n\n /**\n * Z position.\n *\n * @type {number}\n */\n #z;\n\n /**\n * @param {number} x The X coordinate for the point.\n * @param {number} y The Y coordinate for the point.\n * @param {number} z The Z coordinate for the point.\n */\n constructor(x, y, z) {\n this.#x = x;\n this.#y = y;\n this.#z = z;\n }\n\n /**\n * Get the X position of the point.\n *\n * @returns {number} The X position of the point.\n */\n getX() {\n return this.#x;\n }\n\n /**\n * Get the Y position of the point.\n *\n * @returns {number} The Y position of the point.\n */\n getY() {\n return this.#y;\n }\n\n /**\n * Get the Z position of the point.\n *\n * @returns {number} The Z position of the point.\n */\n getZ() {\n return this.#z;\n }\n\n /**\n * Get the values of this point.\n *\n * @returns {number[]} The array of values.\n */\n getValues() {\n return [this.#x, this.#y, this.#z];\n }\n\n /**\n * Check for Point3D equality.\n *\n * @param {Point3D} rhs The other point to compare to.\n * @returns {boolean} True if both points are equal.\n */\n equals(rhs) {\n return rhs !== null &&\n this.#x === rhs.getX() &&\n this.#y === rhs.getY() &&\n this.#z === rhs.getZ();\n }\n\n /**\n * Check for Point3D similarity.\n *\n * @param {Point3D} rhs The other point to compare to.\n * @param {number} [tol] Optional number comparison tolerance,\n * defaults to Number.EPSILON.\n * @returns {boolean} True if both points are similar.\n */\n isSimilar(rhs, tol) {\n return rhs !== null &&\n isSimilar(this.#x, rhs.getX(), tol) &&\n isSimilar(this.#y, rhs.getY(), tol) &&\n isSimilar(this.#z, rhs.getZ(), tol);\n }\n\n /**\n * Get a string representation of the Point3D.\n *\n * @returns {string} The point as a string.\n */\n toString() {\n return '(' + this.#x +\n ', ' + this.#y +\n ', ' + this.#z + ')';\n }\n\n /**\n * Get the distance to another Point3D.\n *\n * @param {Point3D} point3D The input point.\n * @returns {number} Ths distance to the input point.\n */\n getDistance(point3D) {\n return Math.sqrt(this.#getSquaredDistance(point3D));\n }\n\n /**\n * Get the square of the distance between this and\n * an input point. Used for sorting.\n *\n * @param {Point3D} point3D The input point.\n * @returns {number} The square of the distance.\n */\n #getSquaredDistance(point3D) {\n const dx = this.#x - point3D.getX();\n const dy = this.#y - point3D.getY();\n const dz = this.#z - point3D.getZ();\n return dx * dx + dy * dy + dz * dz;\n }\n\n /**\n * Get the closest point to this in a Point3D list.\n *\n * @param {Point3D[]} pointList The list to check.\n * @returns {number} The index of the closest point in the input list.\n */\n getClosest(pointList) {\n let minIndex = 0;\n // the order between squared distances and distances is the same\n let minDist = this.#getSquaredDistance(pointList[minIndex]);\n for (let i = 0; i < pointList.length; ++i) {\n const dist = this.#getSquaredDistance(pointList[i]);\n if (dist < minDist) {\n minIndex = i;\n minDist = dist;\n }\n }\n return minIndex;\n }\n\n /**\n * Get the difference to another Point3D.\n *\n * @param {Point3D} point3D The input point.\n * @returns {Vector3D} The 3D vector from the input point to this one.\n */\n minus(point3D) {\n return new Vector3D(\n (this.#x - point3D.getX()),\n (this.#y - point3D.getY()),\n (this.#z - point3D.getZ()));\n }\n\n} // Point3D class\n\n/**\n * Get an array find callback for an equal input point.\n *\n * @param {Point3D} point The point to compare to.\n * @returns {Function} A function that compares, using `equals`,\n * its input point to the one given as input to this function.\n */\nexport function getEqualPoint3DFunction(point) {\n return function (element) {\n return element.equals(point);\n };\n}\n\n/**\n * Immutable point.\n * Warning: the input array is NOT cloned, modifying it will\n * modify the point values.\n */\nexport class Point {\n\n /**\n * Point values.\n *\n * @type {number[]}\n */\n #values;\n\n /**\n * @param {number[]} values The point values.\n */\n constructor(values) {\n if (!values || typeof values === 'undefined') {\n throw new Error('Cannot create point with no values.');\n }\n if (values.length === 0) {\n throw new Error('Cannot create point with empty values.');\n }\n const valueCheck = function (val) {\n return !isNaN(val);\n };\n if (!values.every(valueCheck)) {\n throw new Error('Cannot create point with non number values.');\n }\n this.#values = values;\n }\n\n /**\n * Get the point value at the given array index.\n *\n * @param {number} i The index to get.\n * @returns {number} The value.\n */\n get(i) {\n return this.#values[i];\n }\n\n /**\n * Get the length of the point.\n *\n * @returns {number} The length.\n */\n length() {\n return this.#values.length;\n }\n\n /**\n * Get a string representation of the point.\n *\n * @returns {string} The point as a string.\n */\n toString() {\n return '(' + this.#values.toString() + ')';\n }\n\n /**\n * Get the values of this point.\n *\n * @returns {number[]} The array of values.\n */\n getValues() {\n return this.#values.slice();\n }\n\n /**\n * Check if the input point can be compared to this one.\n *\n * @param {Point} rhs The point to compare to.\n * @returns {boolean} True if both points are comparable.\n */\n canCompare(rhs) {\n // check input\n if (!rhs) {\n return false;\n }\n // check length\n if (this.length() !== rhs.length()) {\n return false;\n }\n // seems ok!\n return true;\n }\n\n /**\n * Check for Point equality.\n *\n * @param {Point} rhs The point to compare to.\n * @returns {boolean} True if both points are equal.\n */\n equals(rhs) {\n // check if can compare\n if (!this.canCompare(rhs)) {\n return false;\n }\n // check values\n for (let i = 0, leni = this.length(); i < leni; ++i) {\n if (this.get(i) !== rhs.get(i)) {\n return false;\n }\n }\n // seems ok!\n return true;\n }\n\n /**\n * Compare points and return different dimensions.\n *\n * @param {Point} rhs The point to compare to.\n * @returns {number[]} The list of different dimensions.\n */\n compare(rhs) {\n // check if can compare\n if (!this.canCompare(rhs)) {\n return null;\n }\n // check values\n const diffDims = [];\n for (let i = 0, leni = this.length(); i < leni; ++i) {\n if (this.get(i) !== rhs.get(i)) {\n diffDims.push(i);\n }\n }\n return diffDims;\n }\n\n /**\n * Get the 3D part of this point.\n *\n * @returns {Point3D} The Point3D.\n */\n get3D() {\n return new Point3D(this.get(0), this.get(1), this.get(2));\n }\n\n /**\n * Add another point to this one.\n *\n * @param {Point} rhs The point to add.\n * @returns {Point} The point representing the sum of both points.\n */\n add(rhs) {\n // check if can compare\n if (!this.canCompare(rhs)) {\n return null;\n }\n const values = [];\n const values0 = this.getValues();\n const values1 = rhs.getValues();\n for (let i = 0; i < values0.length; ++i) {\n values.push(values0[i] + values1[i]);\n }\n return new Point(values);\n }\n\n /**\n * Merge this point with a Point3D to create a new point.\n *\n * @param {Point3D} rhs The Point3D to merge with.\n * @returns {Point} The merge result.\n */\n mergeWith3D(rhs) {\n const values = this.getValues();\n values[0] = rhs.getX();\n values[1] = rhs.getY();\n values[2] = rhs.getZ();\n return new Point(values);\n }\n\n} // Point class\n","/**\n * Immutable index.\n * Warning: the input array is NOT cloned, modifying it will\n * modify the index values.\n */\nexport class Index {\n\n /**\n * Index values.\n *\n * @type {number[]}\n */\n #values;\n\n /**\n * @param {number[]} values The index values.\n */\n constructor(values) {\n if (!values || typeof values === 'undefined') {\n throw new Error('Cannot create index with no values.');\n }\n if (values.length === 0) {\n throw new Error('Cannot create index with empty values.');\n }\n const valueCheck = function (val) {\n return !isNaN(val);\n };\n if (!values.every(valueCheck)) {\n throw new Error('Cannot create index with non number values.');\n }\n this.#values = values;\n }\n\n /**\n * Get the index value at the given array index.\n *\n * @param {number} i The index to get.\n * @returns {number|undefined} The value or undefined if not in range.\n */\n get(i) {\n return this.#values[i];\n }\n\n /**\n * Get the length of the index.\n *\n * @returns {number} The length.\n */\n length() {\n return this.#values.length;\n }\n\n /**\n * Get a string representation of the Index.\n *\n * @returns {string} The Index as a string.\n */\n toString() {\n return '(' + this.#values.toString() + ')';\n }\n\n /**\n * Get the values of this index.\n *\n * @returns {number[]} The array of values.\n */\n getValues() {\n return this.#values.slice();\n }\n\n /**\n * Check if the input index can be compared to this one.\n *\n * @param {Index} rhs The index to compare to.\n * @returns {boolean} True if both indices are comparable.\n */\n canCompare(rhs) {\n // check input\n if (!rhs) {\n return false;\n }\n // check length\n if (this.length() !== rhs.length()) {\n return false;\n }\n // seems ok!\n return true;\n }\n\n /**\n * Check for Index equality.\n *\n * @param {Index} rhs The index to compare to.\n * @returns {boolean} True if both indices are equal.\n */\n equals(rhs) {\n // check if can compare\n if (!this.canCompare(rhs)) {\n return false;\n }\n // check values\n for (let i = 0, leni = this.length(); i < leni; ++i) {\n if (this.get(i) !== rhs.get(i)) {\n return false;\n }\n }\n // seems ok!\n return true;\n }\n\n /**\n * Compare indices and return different dimensions.\n *\n * @param {Index} rhs The index to compare to.\n * @returns {number[]} The list of different dimensions.\n */\n compare(rhs) {\n // check if can compare\n if (!this.canCompare(rhs)) {\n return null;\n }\n // check values\n const diffDims = [];\n for (let i = 0, leni = this.length(); i < leni; ++i) {\n if (this.get(i) !== rhs.get(i)) {\n diffDims.push(i);\n }\n }\n return diffDims;\n }\n\n /**\n * Add another index to this one and return\n * the result as a new index.\n *\n * @param {Index} rhs The index to add.\n * @returns {Index} The index representing the sum of both indices.\n */\n add(rhs) {\n // check if can compare\n if (!this.canCompare(rhs)) {\n return null;\n }\n // add values\n const values = [];\n for (let i = 0, leni = this.length(); i < leni; ++i) {\n values.push(this.get(i) + rhs.get(i));\n }\n // seems ok!\n return new Index(values);\n }\n\n /**\n * Add the input value to this index at the given\n * dimension number and return the result\n * as a new index.\n *\n * @param {number} dim The dimension number.\n * @param {number} value The value to add.\n * @returns {Index} The result index.\n */\n #addToDim(dim, value) {\n const values = this.#values.slice();\n if (dim < values.length) {\n values[dim] += value;\n } else {\n console.warn('Cannot add to given dimension: ', dim, values.length);\n }\n return new Index(values);\n }\n\n /**\n * Increment this index by 1 at the given dimension\n * and return the result as a new index.\n *\n * @param {number} dim The dimension number.\n * @returns {Index} The result index.\n */\n next(dim) {\n return this.#addToDim(dim, 1);\n }\n\n /**\n * Decrement this index by 1 at the given dimension\n * and return the result as a new index.\n *\n * @param {number} dim The dimension number.\n * @returns {Index} The result index.\n */\n previous(dim) {\n return this.#addToDim(dim, -1);\n }\n\n /**\n * Get the current index with a new 2D base\n * and return the result as a new index.\n *\n * @param {number} i The new 0 index.\n * @param {number} j The new 1 index.\n * @returns {Index} The new index.\n */\n getWithNew2D(i, j) {\n const values = [i, j];\n for (let l = 2, lenl = this.length(); l < lenl; ++l) {\n values.push(this.get(l));\n }\n return new Index(values);\n }\n\n} // Index class\n\n/**\n * Get an index with values set to 0 and the input size.\n *\n * @param {number} size The size of the index.\n * @returns {Index} The zero index.\n */\nexport function getZeroIndex(size) {\n const values = new Array(size);\n values.fill(0);\n return new Index(values);\n}\n","export const logger = {\n /**\n * Available log levels.\n * Note: need to activate verbose level in\n * Chrome console to see DEBUG messages.\n */\n levels: {\n TRACE: 0,\n DEBUG: 1,\n INFO: 2,\n WARN: 3,\n ERROR: 4\n },\n\n /**\n * Logger level: default to WARN.\n */\n level: 3,\n\n /**\n * Log a trace message.\n *\n * @param {string} msg The message to log.\n */\n trace: function (msg) {\n if (this.level <= this.levels.TRACE) {\n console.trace(msg);\n }\n },\n\n /**\n * Log a debug message.\n * Careful: depends on console settings.\n *\n * @param {string} msg The message to log.\n */\n debug: function (msg) {\n if (this.level <= this.levels.DEBUG) {\n console.debug(msg);\n }\n },\n\n /**\n * Log an info message.\n *\n * @param {string} msg The message to log.\n */\n info: function (msg) {\n if (this.level <= this.levels.INFO) {\n console.info(msg);\n }\n },\n\n /**\n * Log a warn message.\n *\n * @param {string} msg The message to log.\n */\n warn: function (msg) {\n if (this.level <= this.levels.WARN) {\n console.warn(msg);\n }\n },\n\n /**\n * Log an error message.\n *\n * @param {string} msg The message to log.\n */\n error: function (msg) {\n if (this.level <= this.levels.ERROR) {\n console.error(msg);\n }\n }\n\n}; // logger\n","import {Vector3D} from './vector.js';\nimport {Point3D} from './point.js';\nimport {Index} from './index.js';\nimport {logger} from '../utils/logger.js';\n\n// Number.EPSILON is difference between 1 and the smallest\n// floating point number greater than 1\n// -> ~2e-16\n// BIG_EPSILON -> ~2e-12\nexport const BIG_EPSILON = Number.EPSILON * 1e4;\nexport const BIG_EPSILON_EXPONENT = 12;\n// 'real world', for example when comparing positions\nexport const REAL_WORLD_EPSILON = 1e-4;\nexport const REAL_WORLD_EXPONENT = 5;\n\n/**\n * Check if two numbers are similar.\n *\n * @param {number} a The first number.\n * @param {number} b The second number.\n * @param {number} [tol] Optional comparison tolerance,\n * defaults to Number.EPSILON.\n * @returns {boolean} True if similar.\n */\nexport function isSimilar(a, b, tol) {\n if (typeof tol === 'undefined') {\n tol = Number.EPSILON;\n }\n return Math.abs(a - b) < tol;\n}\n\n/**\n * Immutable 3x3 Matrix.\n */\nexport class Matrix33 {\n\n /**\n * Matrix values.\n *\n * @type {number[]}\n */\n #values;\n\n /**\n * Matrix inverse, calculated at first ask.\n *\n * @type {Matrix33}\n */\n #inverse;\n\n /**\n * @param {number[]} values Row-major ordered 9 values.\n */\n constructor(values) {\n this.#values = values;\n }\n\n /**\n * Get a value of the matrix.\n *\n * @param {number} row The row at wich to get the value.\n * @param {number} col The column at wich to get the value.\n * @returns {number|undefined} The value at the position.\n */\n get(row, col) {\n return this.#values[row * 3 + col];\n }\n\n /**\n * Get the inverse of this matrix.\n *\n * @returns {Matrix33|undefined} The inverse matrix or undefined\n * if the determinant is zero.\n */\n getInverse() {\n if (typeof this.#inverse === 'undefined') {\n this.#inverse = getMatrixInverse(this);\n }\n return this.#inverse;\n }\n\n /**\n * Check for Matrix33 equality.\n *\n * @param {Matrix33} rhs The other matrix to compare to.\n * @returns {boolean} True if both matrices are equal.\n */\n equals(rhs) {\n // TODO: add type check\n // check values\n for (let i = 0; i < 3; ++i) {\n for (let j = 0; j < 3; ++j) {\n if (this.get(i, j) !== rhs.get(i, j)) {\n return false;\n }\n }\n }\n return true;\n }\n\n /**\n * Check for Matrix33 similarity.\n *\n * @param {Matrix33} rhs The other matrix to compare to.\n * @param {number} [tol] Optional number comparison tolerance,\n * defaults to Number.EPSILON.\n * @returns {boolean} True if both matrices are similar.\n */\n isSimilar(rhs, tol) {\n // TODO: add type check\n // check values\n for (let i = 0; i < 3; ++i) {\n for (let j = 0; j < 3; ++j) {\n if (!isSimilar(this.get(i, j), rhs.get(i, j), tol)) {\n return false;\n }\n }\n }\n return true;\n }\n\n /**\n * Get a string representation of the Matrix33.\n *\n * @returns {string} The matrix as a string.\n */\n toString() {\n let str = '[';\n for (let i = 0; i < 3; ++i) {\n if (i !== 0) {\n str += ', \\n ';\n }\n for (let j = 0; j < 3; ++j) {\n if (j !== 0) {\n str += ', ';\n }\n str += this.get(i, j);\n }\n }\n str += ']';\n return str;\n }\n\n /**\n * Multiply this matrix by another.\n *\n * @param {Matrix33} rhs The matrix to multiply by.\n * @returns {Matrix33} The product matrix.\n */\n multiply(rhs) {\n const values = [];\n for (let i = 0; i < 3; ++i) {\n for (let j = 0; j < 3; ++j) {\n let tmp = 0;\n for (let k = 0; k < 3; ++k) {\n tmp += this.get(i, k) * rhs.get(k, j);\n }\n values.push(tmp);\n }\n }\n return new Matrix33(values);\n }\n\n /**\n * Get the absolute value of this matrix.\n *\n * @returns {Matrix33} The result matrix.\n */\n getAbs() {\n const values = [];\n for (let i = 0; i < 3; ++i) {\n for (let j = 0; j < 3; ++j) {\n values.push(Math.abs(this.get(i, j)));\n }\n }\n return new Matrix33(values);\n }\n\n /**\n * Multiply this matrix by a 3D array.\n *\n * @param {number[]} array3D The input 3D array.\n * @returns {number[]} The result 3D array.\n */\n multiplyArray3D(array3D) {\n if (array3D.length !== 3) {\n throw new Error('Cannot multiply 3x3 matrix with non 3D array: ' +\n array3D.length);\n }\n // (no loop for speedup)\n const a0 = array3D[0];\n const a1 = array3D[1];\n const a2 = array3D[2];\n const values = new Array(3);\n values[0] =\n this.#values[0] * a0 +\n this.#values[1] * a1 +\n this.#values[2] * a2;\n values[1] =\n this.#values[3] * a0 +\n this.#values[4] * a1 +\n this.#values[5] * a2;\n values[2] =\n this.#values[6] * a0 +\n this.#values[7] * a1 +\n this.#values[8] * a2;\n return values;\n }\n\n /**\n * Multiply this matrix by a 3D typed array.\n *\n * @typedef {(\n * Uint8Array | Int8Array |\n * Uint16Array | Int16Array |\n * Uint32Array | Int32Array\n * )} TypedArray\n *\n * @param {TypedArray} sourceArray The input 3D array.\n * @param {TypedArray} outArray The array to write to.\n */\n multiplyTypedArray3D(sourceArray, outArray) {\n // (no loop for speedup)\n const a0 = sourceArray[0];\n const a1 = sourceArray[1];\n const a2 = sourceArray[2];\n outArray[0] =\n this.#values[0] * a0 +\n this.#values[1] * a1 +\n this.#values[2] * a2;\n outArray[1] =\n this.#values[3] * a0 +\n this.#values[4] * a1 +\n this.#values[5] * a2;\n outArray[2] =\n this.#values[6] * a0 +\n this.#values[7] * a1 +\n this.#values[8] * a2;\n }\n\n /**\n * Multiply this matrix by a 3D vector.\n *\n * @param {Vector3D} vector3D The input 3D vector.\n * @returns {Vector3D} The result 3D vector.\n */\n multiplyVector3D(vector3D) {\n const array3D = this.multiplyArray3D(\n [vector3D.getX(), vector3D.getY(), vector3D.getZ()]\n );\n return new Vector3D(array3D[0], array3D[1], array3D[2]);\n }\n\n /**\n * Multiply this matrix by a 3D point.\n *\n * @param {Point3D} point3D The input 3D point.\n * @returns {Point3D} The result 3D point.\n */\n multiplyPoint3D(point3D) {\n const array3D = this.multiplyArray3D(\n [point3D.getX(), point3D.getY(), point3D.getZ()]\n );\n return new Point3D(array3D[0], array3D[1], array3D[2]);\n }\n\n /**\n * Multiply this matrix by a 3D index.\n *\n * @param {Index} index3D The input 3D index.\n * @returns {Index} The result 3D index.\n */\n multiplyIndex3D(index3D) {\n const array3D = this.multiplyArray3D(index3D.getValues());\n return new Index(array3D);\n }\n\n /**\n * Get the index of the maximum in absolute value of a row.\n *\n * @param {number} row The row to get the maximum from.\n * @returns {object} The {value,index} of the maximum.\n */\n getRowAbsMax(row) {\n const values = [\n Math.abs(this.get(row, 0)),\n Math.abs(this.get(row, 1)),\n Math.abs(this.get(row, 2))\n ];\n const absMax = Math.max.apply(null, values);\n const index = values.indexOf(absMax);\n return {\n value: this.get(row, index),\n index: index\n };\n }\n\n /**\n * Get the index of the maximum in absolute value of a column.\n *\n * @param {number} col The column to get the maximum from.\n * @returns {object} The {value,index} of the maximum.\n */\n getColAbsMax(col) {\n const values = [\n Math.abs(this.get(0, col)),\n Math.abs(this.get(1, col)),\n Math.abs(this.get(2, col))\n ];\n const absMax = Math.max.apply(null, values);\n const index = values.indexOf(absMax);\n return {\n value: this.get(index, col),\n index: index\n };\n }\n\n /**\n * Get this matrix with only zero and +/- ones instead of the maximum.\n *\n * @returns {Matrix33} The simplified matrix.\n */\n asOneAndZeros() {\n // TODO: This breaks at 45 degree angles\n const res = [];\n for (let j = 0; j < 3; ++j) {\n const max = this.getRowAbsMax(j);\n const sign = max.value > 0 ? 1 : -1;\n for (let i = 0; i < 3; ++i) {\n if (i === max.index) {\n res.push(1 * sign);\n } else {\n res.push(0);\n }\n }\n }\n return new Matrix33(res);\n }\n\n /**\n * Get the third column direction index of an orientation matrix.\n *\n * @returns {number} The index of the absolute maximum of the last column.\n */\n getThirdColMajorDirection() {\n return this.getColAbsMax(2).index;\n }\n\n /**\n * Get the values of the matrix as an array.\n *\n * @returns {number[]} The matrix.\n */\n getValues() {\n return this.#values.slice();\n }\n\n} // Matrix33\n\n/**\n * Get the inverse of an input 3*3 matrix.\n *\n * Ref:\n * - {@link https://en.wikipedia.org/wiki/Invertible_matrix#Inversion_of_3_%C3%97_3_matrices},\n * - {@link https://github.com/willnode/N-Matrix-Programmer}.\n *\n * @param {Matrix33} m The input matrix.\n * @returns {Matrix33|undefined} The inverse matrix or undefined\n * if the determinant is zero.\n */\nfunction getMatrixInverse(m) {\n const m00 = m.get(0, 0);\n const m01 = m.get(0, 1);\n const m02 = m.get(0, 2);\n const m10 = m.get(1, 0);\n const m11 = m.get(1, 1);\n const m12 = m.get(1, 2);\n const m20 = m.get(2, 0);\n const m21 = m.get(2, 1);\n const m22 = m.get(2, 2);\n\n const a1212 = m11 * m22 - m12 * m21;\n const a2012 = m12 * m20 - m10 * m22;\n const a0112 = m10 * m21 - m11 * m20;\n\n let det = m00 * a1212 + m01 * a2012 + m02 * a0112;\n if (det === 0) {\n logger.warn('Cannot invert 3*3 matrix with zero determinant.');\n return undefined;\n }\n det = 1 / det;\n\n const values = [\n det * a1212,\n det * (m02 * m21 - m01 * m22),\n det * (m01 * m12 - m02 * m11),\n det * a2012,\n det * (m00 * m22 - m02 * m20),\n det * (m02 * m10 - m00 * m12),\n det * a0112,\n det * (m01 * m20 - m00 * m21),\n det * (m00 * m11 - m01 * m10)\n ];\n\n return new Matrix33(values);\n}\n\n/**\n * Create a 3x3 identity matrix.\n *\n * @returns {Matrix33} The identity matrix.\n */\nexport function getIdentityMat33() {\n /* eslint-disable @stylistic/js/array-element-newline */\n return new Matrix33([\n 1, 0, 0,\n 0, 1, 0,\n 0, 0, 1\n ]);\n /* eslint-enable @stylistic/js/array-element-newline */\n}\n\n/**\n * Check if a matrix is a 3x3 identity matrix.\n *\n * @param {Matrix33} mat33 The matrix to test.\n * @returns {boolean} True if identity.\n */\nexport function isIdentityMat33(mat33) {\n return mat33.equals(getIdentityMat33());\n}\n","\nimport {Matrix33, BIG_EPSILON} from '../math/matrix.js';\n\nexport class ResamplingFilter {\n /**\n * Simple bilinear sampling function.\n *\n * @param {number[]} point The index space point to sample.\n * @param {TypedArray} buffer The buffer to sample.\n * @param {number[]} size The buffer size.\n * @param {number[]} unitVectors The buffer offset space unit vectors.\n * @returns {number} The sampled value.\n */\n #bilinearSample(point, buffer, size, unitVectors) {\n // base point\n const q0x = Math.floor(point[0]);\n const q0y = Math.floor(point[1]);\n const q0z = Math.floor(point[2]);\n\n // bounding points indices\n const x0 = q0x < 0 ? 0 : q0x;\n const x1 = q0x + 1 >= size[0] ? q0x : q0x + 1;\n const y0 = q0y < 0 ? 0 : q0y;\n const y1 = q0y + 1 >= size[1] ? q0y : q0y + 1;\n const z0 = q0z < 0 ? 0 : q0z;\n const z1 = q0z + 1 >= size[2] ? q0z : q0z + 1;\n\n // bounding points offsets\n const x0v = x0 * unitVectors[0];\n const x1v = x1 * unitVectors[0];\n const y0v = y0 * unitVectors[1];\n const y1v = y1 * unitVectors[1];\n const z0v = z0 * unitVectors[2];\n const z1v = z1 * unitVectors[2];\n const off000 = x0v + y0v + z0v;\n const off001 = x0v + y0v + z1v;\n const off010 = x0v + y1v + z0v;\n const off011 = x0v + y1v + z1v;\n const off100 = x1v + y0v + z0v;\n const off101 = x1v + y0v + z1v;\n const off110 = x1v + y1v + z0v;\n const off111 = x1v + y1v + z1v;\n\n // bounding points values\n const x0ok = x0 >= 0 && x0 < size[0];\n const x1ok = x1 >= 0 && x1 < size[0];\n const y0ok = y0 >= 0 && y0 < size[1];\n const y1ok = y1 >= 0 && y1 < size[1];\n const z0ok = z0 >= 0 && z0 < size[2];\n const z1ok = z1 >= 0 && z1 < size[2];\n const v000 = (x0ok && y0ok && z0ok) ? buffer[off000] : 0;\n const v001 = (x0ok && y0ok && z1ok) ? buffer[off001] : 0;\n const v010 = (x0ok && y1ok && z0ok) ? buffer[off010] : 0;\n const v011 = (x0ok && y1ok && z1ok) ? buffer[off011] : 0;\n const v100 = (x1ok && y0ok && z0ok) ? buffer[off100] : 0;\n const v101 = (x1ok && y0ok && z1ok) ? buffer[off101] : 0;\n const v110 = (x1ok && y1ok && z0ok) ? buffer[off110] : 0;\n const v111 = (x1ok && y1ok && z1ok) ? buffer[off111] : 0;\n\n // interpolation weights\n const wx0 = Math.abs(point[0] - q0x);\n const wy0 = Math.abs(point[1] - q0y);\n const wz0 = Math.abs(point[2] - q0z);\n const wx1 = 1 - wx0;\n const wy1 = 1 - wy0;\n const wz1 = 1 - wz0;\n // per point\n const w000 = wx1 * wy1 * wz1;\n const w001 = wx1 * wy1 * wz0;\n const w010 = wx1 * wy0 * wz1;\n const w011 = wx1 * wy0 * wz0;\n const w100 = wx0 * wy1 * wz1;\n const w101 = wx0 * wy1 * wz0;\n const w110 = wx0 * wy0 * wz1;\n const w111 = wx0 * wy0 * wz0;\n\n // weighted sum\n return (\n v000 * w000 +\n v001 * w001 +\n v010 * w010 +\n v011 * w011 +\n v100 * w100 +\n v101 * w101 +\n v110 * w110 +\n v111 * w111\n );\n }\n\n /**\n * Round if the value is close enough to an integer.\n *\n * @param {number} value The value to round.\n * @returns {number} The rounded value.\n */\n #snapRound(value) {\n const rounded = Math.round(value);\n return Math.abs(value - rounded) < BIG_EPSILON ? rounded : value;\n }\n\n /**\n * Calculate the resampling.\n *\n * @param {object} workerMessage The worker message.\n */\n run(workerMessage) {\n const sourceSize = workerMessage.sourceSize;\n const targetSize = workerMessage.targetSize;\n const sourceUnitVectors = workerMessage.sourceUnitVectors;\n const targetUnitVectors = workerMessage.targetUnitVectors;\n const sourceSpacing = workerMessage.sourceSpacing;\n const targetSpacing = workerMessage.targetSpacing;\n\n const sourceImageBuffer = workerMessage.sourceImageBuffer;\n\n const interpolate = workerMessage.interpolate;\n\n // Can't pass them in as matrixes, so we need to re-create them\n const sourceMatrix = new Matrix33(workerMessage.sourceOrientation);\n const targetMatrix = new Matrix33(workerMessage.targetOrientation);\n\n const invSourceMatrix = sourceMatrix.getInverse();\n const relativeMatrix = targetMatrix.multiply(invSourceMatrix);\n\n const halfTargetSize = [\n (targetSize[0] - 1) / 2.0,\n (targetSize[1] - 1) / 2.0,\n (targetSize[2] - 1) / 2.0\n ];\n\n const halfSourceSize = [\n (sourceSize[0] - 1) / 2.0,\n (sourceSize[1] - 1) / 2.0,\n (sourceSize[2] - 1) / 2.0\n ];\n\n const centeredIndexPoint = new Array(3);\n const rotIndexPoint = new Array(3);\n const point = new Array(3);\n\n let targetOffX, targetOffXY, targetOffset;\n for (let x = 0; x < targetSize[0]; x++) {\n centeredIndexPoint[0] = (x - halfTargetSize[0]) * targetSpacing[0];\n targetOffX = targetUnitVectors[0] * x;\n for (let y = 0; y < targetSize[1]; y++) {\n centeredIndexPoint[1] = (y - halfTargetSize[1]) * targetSpacing[1];\n targetOffXY = targetOffX + targetUnitVectors[1] * y;\n for (let z = 0; z < targetSize[2]; z++) {\n centeredIndexPoint[2] = (z - halfTargetSize[2]) * targetSpacing[2];\n\n relativeMatrix.multiplyTypedArray3D(\n centeredIndexPoint, rotIndexPoint\n );\n\n point[0] = this.#snapRound(\n (rotIndexPoint[0] / sourceSpacing[0]) + halfSourceSize[0]\n );\n point[1] = this.#snapRound(\n (rotIndexPoint[1] / sourceSpacing[1]) + halfSourceSize[1]\n );\n point[2] = this.#snapRound(\n (rotIndexPoint[2] / sourceSpacing[2]) + halfSourceSize[2]\n );\n\n if (\n point[0] >= 0 && point[0] < sourceSize[0] &&\n point[1] >= 0 && point[1] < sourceSize[1] &&\n point[2] >= 0 && point[2] < sourceSize[2]\n ) {\n targetOffset = targetOffXY + targetUnitVectors[2] * z;\n\n if (interpolate) {\n // Bilinear\n const sample = this.#bilinearSample(\n point,\n sourceImageBuffer,\n sourceSize,\n sourceUnitVectors\n );\n workerMessage.targetImageBuffer[targetOffset] = sample;\n\n } else {\n // Nearest Neighbor\n const inOffset =\n (sourceUnitVectors[0] * Math.round(point[0])) +\n (sourceUnitVectors[1] * Math.round(point[1])) +\n (sourceUnitVectors[2] * Math.round(point[2]));\n\n workerMessage.targetImageBuffer[targetOffset] =\n workerMessage.sourceImageBuffer[inOffset];\n }\n }\n }\n }\n }\n }\n}","/**\n * Resampling filter worker.\n */\n\nimport {ResamplingFilter} from './resamplingFilter.js';\n\nself.addEventListener('message', function (event) {\n\n const filter = new ResamplingFilter();\n filter.run(event.data);\n self.postMessage(event.data);\n\n}, false);"],"names":["Vector3D","constructor","x","y","z","this","getX","getY","getZ","equals","rhs","toString","norm","Math","sqrt","crossProduct","vector3D","dotProduct","isCodirectional","Point3D","getValues","isSimilar","tol","getDistance","point3D","dx","dy","dz","getClosest","pointList","minIndex","minDist","i","length","dist","minus","Index","values","Error","every","val","isNaN","get","slice","canCompare","leni","compare","diffDims","push","add","dim","value","console","warn","next","previous","getWithNew2D","j","l","lenl","logger","levels","TRACE","DEBUG","INFO","WARN","ERROR","level","trace","msg","debug","info","error","BIG_EPSILON","Number","EPSILON","a","b","abs","Matrix33","row","col","getInverse","m","m00","m01","m02","m10","m11","m12","m20","m21","m22","a1212","a2012","a0112","det","getMatrixInverse","str","multiply","tmp","k","getAbs","multiplyArray3D","array3D","a0","a1","a2","Array","multiplyTypedArray3D","sourceArray","outArray","multiplyVector3D","multiplyPoint3D","multiplyIndex3D","index3D","getRowAbsMax","absMax","max","apply","index","indexOf","getColAbsMax","asOneAndZeros","res","sign","getThirdColMajorDirection","ResamplingFilter","point","buffer","size","unitVectors","q0x","floor","q0y","q0z","x0","x1","y0","y1","z0","z1","x0v","x1v","y0v","y1v","z0v","z1v","off000","off001","off010","off011","off100","off101","off110","off111","x0ok","x1ok","y0ok","y1ok","z0ok","z1ok","v000","v001","v010","v011","v100","v101","v110","v111","wx0","wy0","wz0","wx1","wy1","wz1","rounded","round","run","workerMessage","sourceSize","targetSize","sourceUnitVectors","targetUnitVectors","sourceSpacing","targetSpacing","sourceImageBuffer","interpolate","sourceMatrix","sourceOrientation","targetMatrix","targetOrientation","invSourceMatrix","relativeMatrix","halfTargetSize","halfSourceSize","centeredIndexPoint","rotIndexPoint","targetOffX","targetOffXY","targetOffset","sample","targetImageBuffer","inOffset","self","addEventListener","event","data","postMessage"],"sourceRoot":""}
package/dist/dwv.d.ts CHANGED
@@ -240,14 +240,16 @@ export declare class AnnotationGroup {
240
240
  * Add a new annotation.
241
241
  *
242
242
  * @param {Annotation} annotation The annotation to add.
243
+ * @param {boolean} [propagate] Whether the event propagates
244
+ * outside of dwv or not, defaults to true.
243
245
  */
244
- add(annotation: Annotation): void;
246
+ add(annotation: Annotation, propagate?: boolean): void;
245
247
  /**
246
248
  * Update an existing annotation.
247
249
  *
248
250
  * @param {Annotation} annotation The annotation to update.
249
251
  * @param {string[]} [propKeys] Optional properties that got updated.
250
- * @param {boolean} [propagate] Whether the update event propagates
252
+ * @param {boolean} [propagate] Whether the event propagates
251
253
  * outside of dwv or not, defaults to true.
252
254
  */
253
255
  update(annotation: Annotation, propKeys?: string[], propagate?: boolean): void;
@@ -255,8 +257,10 @@ export declare class AnnotationGroup {
255
257
  * Remove an annotation.
256
258
  *
257
259
  * @param {string} uid The UID of the annotation to remove.
260
+ * @param {boolean} [propagate] Whether the event propagates
261
+ * outside of dwv or not, defaults to true.
258
262
  */
259
- remove(uid: string): void;
263
+ remove(uid: string, propagate?: boolean): void;
260
264
  /**
261
265
  * Set the associated view controller.
262
266
  *
@@ -396,12 +400,13 @@ export declare class AnnotationGroupFactory {
396
400
  * Main application class.
397
401
  *
398
402
  * @example
403
+ * import {App, AppOptions, ViewConfig} from '//esm.sh/dwv';
399
404
  * // create the dwv app
400
- * const app = new dwv.App();
405
+ * const app = new App();
401
406
  * // initialise
402
- * const viewConfig0 = new dwv.ViewConfig('layerGroup0');
407
+ * const viewConfig0 = new ViewConfig('layerGroup0');
403
408
  * const viewConfigs = {'*': [viewConfig0]};
404
- * const options = new dwv.AppOptions(viewConfigs);
409
+ * const options = new AppOptions(viewConfigs);
405
410
  * app.init(options);
406
411
  * // load dicom data
407
412
  * app.loadURLs([
@@ -592,12 +597,13 @@ export declare class App {
592
597
  *
593
598
  * @param {AppOptions} opt The application options.
594
599
  * @example
600
+ * import {App, AppOptions, ViewConfig} from '//esm.sh/dwv';
595
601
  * // create the dwv app
596
- * const app = new dwv.App();
602
+ * const app = new App();
597
603
  * // initialise
598
- * const viewConfig0 = new dwv.ViewConfig('layerGroup0');
604
+ * const viewConfig0 = new ViewConfig('layerGroup0');
599
605
  * const viewConfigs = {'*': [viewConfig0]};
600
- * const options = new dwv.AppOptions(viewConfigs);
606
+ * const options = new AppOptions(viewConfigs);
601
607
  * options.viewOnFirstLoadItem = false;
602
608
  * app.init(options);
603
609
  * // render button
@@ -829,6 +835,27 @@ export declare class App {
829
835
  * @param {number} ty The translation along Y.
830
836
  */
831
837
  translate(tx: number, ty: number): void;
838
+ /**
839
+ * Resample one image to match the orientation of another.
840
+ *
841
+ * @param {string} dataIdTarget The target image id to resample.
842
+ * @param {string} dataIdSource The source image id to copy the
843
+ * orientation from.
844
+ */
845
+ resampleMatch(dataIdTarget: string, dataIdSource: string): void;
846
+ /**
847
+ * Resample an image to match an arbitrary orientation.
848
+ *
849
+ * @param {string} dataIdTarget The target image id to resample.
850
+ * @param {Matrix33} orientation The orientation to resample to.
851
+ */
852
+ resample(dataIdTarget: string, orientation: Matrix33): void;
853
+ /**
854
+ * Revert an image back to its original orientation.
855
+ *
856
+ * @param {string} dataIdTarget The target image id to revert.
857
+ */
858
+ revertResample(dataIdTarget: string): void;
832
859
  /**
833
860
  * Set the active view layer (of the active layer group) opacity.
834
861
  *
@@ -1476,16 +1503,29 @@ export declare class DicomData {
1476
1503
  * @type {any|undefined}
1477
1504
  */
1478
1505
  buffer: any | undefined;
1506
+ /**
1507
+ * Set the image complete flag (for image data).
1508
+ *
1509
+ * @param {boolean} flag True if the image is complete.
1510
+ */
1511
+ setComplete(flag: boolean): void;
1512
+ /**
1513
+ * Get the image complete flag (for image data).
1514
+ *
1515
+ * @returns {boolean|undefined} True if the image is complete.
1516
+ */
1517
+ getComplete(): boolean | undefined;
1479
1518
  }
1480
1519
 
1481
1520
  /**
1482
1521
  * DicomParser class.
1483
1522
  *
1484
1523
  * @example
1524
+ * import {DicomParser} from '//esm.sh/dwv';
1485
1525
  * // XMLHttpRequest onload callback
1486
1526
  * const onload = function (event) {
1487
1527
  * // setup the dicom parser
1488
- * const dicomParser = new dwv.DicomParser();
1528
+ * const dicomParser = new DicomParser();
1489
1529
  * // parse the buffer
1490
1530
  * dicomParser.parse(event.target.response);
1491
1531
  * // get the dicom tags
@@ -1611,6 +1651,7 @@ export declare class DicomSRContent {
1611
1651
  * DICOM writer.
1612
1652
  *
1613
1653
  * @example
1654
+ * import {DicomParser, DicomWriter} from '//esm.sh/dwv';
1614
1655
  * // add link to html
1615
1656
  * const link = document.createElement("a");
1616
1657
  * link.appendChild(document.createTextNode("download"));
@@ -1618,10 +1659,10 @@ export declare class DicomSRContent {
1618
1659
  * div.appendChild(link);
1619
1660
  * // XMLHttpRequest onload callback
1620
1661
  * const onload = function (event) {
1621
- * const parser = new dwv.DicomParser();
1662
+ * const parser = new DicomParser();
1622
1663
  * parser.parse(event.target.response);
1623
1664
  * // create writer
1624
- * const writer = new dwv.DicomWriter();
1665
+ * const writer = new DicomWriter();
1625
1666
  * // get buffer using default rules
1626
1667
  * const dicomBuffer = writer.getBuffer(parser.getDicomElements());
1627
1668
  * // create blob
@@ -2275,6 +2316,11 @@ export declare class Geometry {
2275
2316
  * @returns {Size} The object size.
2276
2317
  */
2277
2318
  getSize(viewOrientation?: Matrix33): Size;
2319
+ /**
2320
+ * Calculate slice spacing from origins and replace current
2321
+ * if needed.
2322
+ */
2323
+ updateSliceSpacing(): void;
2278
2324
  /**
2279
2325
  * Get the object spacing.
2280
2326
  * Warning: the spacing comes as stored in DICOM, meaning that it could
@@ -2306,10 +2352,10 @@ export declare class Geometry {
2306
2352
  * magic...
2307
2353
  *
2308
2354
  * @param {Point3D} point The point to evaluate.
2309
- * @param {number} time Optional time index.
2355
+ * @param {number} [time] Optional time index.
2310
2356
  * @returns {number} The slice index.
2311
2357
  */
2312
- getSliceIndex(point: Point3D, time: number): number;
2358
+ getSliceIndex(point: Point3D, time?: number): number;
2313
2359
  /**
2314
2360
  * Append an origin to the geometry.
2315
2361
  *
@@ -2613,13 +2659,14 @@ export declare namespace i18n {
2613
2659
  * - planar configuration (default RGBRGB...).
2614
2660
  *
2615
2661
  * @example
2662
+ * import {DicomParser, createImage} from '//esm.sh/dwv';
2616
2663
  * // XMLHttpRequest onload callback
2617
2664
  * const onload = function (event) {
2618
2665
  * // parse the dicom buffer
2619
- * const dicomParser = new dwv.DicomParser();
2666
+ * const dicomParser = new DicomParser();
2620
2667
  * dicomParser.parse(event.target.response);
2621
2668
  * // create the image object
2622
- * const image = dwv.createImage(dicomParser.getDicomElements());
2669
+ * const image = createImage(dicomParser.getDicomElements());
2623
2670
  * // result div
2624
2671
  * const div = document.getElementById('dwv');
2625
2672
  * // display the image size
@@ -2650,6 +2697,18 @@ declare class Image_2 {
2650
2697
  * @param {string[]} [imageUids] An array of Uids indexed to slice number.
2651
2698
  */
2652
2699
  constructor(geometry: Geometry, buffer: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, imageUids?: string[]);
2700
+ /**
2701
+ * Set the image complete flag.
2702
+ *
2703
+ * @param {boolean} flag True if the data is complete.
2704
+ */
2705
+ setComplete(flag: boolean): void;
2706
+ /**
2707
+ * Get the image complete flag.
2708
+ *
2709
+ * @returns {boolean} True if the data is complete.
2710
+ */
2711
+ getComplete(): boolean;
2653
2712
  /**
2654
2713
  * Get the image UID at a given index.
2655
2714
  *
@@ -3039,6 +3098,25 @@ declare class Image_2 {
3039
3098
  * Recalculate labels.
3040
3099
  */
3041
3100
  recalculateLabels(): void;
3101
+ /**
3102
+ * Return if this image has been resampled.
3103
+ *
3104
+ * @returns {boolean} If the image has been resampled.
3105
+ */
3106
+ isResampled(): boolean;
3107
+ /**
3108
+ * Resample this image to a new orientation.
3109
+ *
3110
+ * @param {Matrix33} orientation The orientation to resample to.
3111
+ * @param {boolean|undefined} interpolated Default true, if true use bilinear
3112
+ * sampling, otherwise use nearest neighbor.
3113
+ * @param {Point|undefined} centerOfRotation World space center of rotation.
3114
+ */
3115
+ resample(orientation: Matrix33, interpolated?: boolean | undefined, centerOfRotation?: Point | undefined): void;
3116
+ /**
3117
+ * Revert a resampled image to its original state.
3118
+ */
3119
+ revert(): void;
3042
3120
  #private;
3043
3121
  }
3044
3122
  export { Image_2 as Image }
@@ -3431,6 +3509,14 @@ export declare class LayerGroup {
3431
3509
  * @returns {boolean} True if one view layer can be scrolled.
3432
3510
  */
3433
3511
  canScroll(): boolean;
3512
+ /**
3513
+ * Returns whether or not a layer group should have its zoom/pan/etc
3514
+ * synced to other views. Used for things like Secondary Capture where
3515
+ * there is no meaningful real-world scale.
3516
+ *
3517
+ * @returns {boolean} Whether to sync the zoom/pan.
3518
+ */
3519
+ shouldBind(): boolean;
3434
3520
  /**
3435
3521
  * Does one of the view layer have more than one slice in the
3436
3522
  * given dimension.
@@ -3856,6 +3942,19 @@ export declare class Matrix33 {
3856
3942
  * @returns {number[]} The result 3D array.
3857
3943
  */
3858
3944
  multiplyArray3D(array3D: number[]): number[];
3945
+ /**
3946
+ * Multiply this matrix by a 3D typed array.
3947
+ *
3948
+ * @typedef {(
3949
+ * Uint8Array | Int8Array |
3950
+ * Uint16Array | Int16Array |
3951
+ * Uint32Array | Int32Array
3952
+ * )} TypedArray
3953
+ *
3954
+ * @param {TypedArray} sourceArray The input 3D array.
3955
+ * @param {TypedArray} outArray The array to write to.
3956
+ */
3957
+ multiplyTypedArray3D(sourceArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, outArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array): void;
3859
3958
  /**
3860
3959
  * Multiply this matrix by a 3D vector.
3861
3960
  *
@@ -3903,6 +4002,12 @@ export declare class Matrix33 {
3903
4002
  * @returns {number} The index of the absolute maximum of the last column.
3904
4003
  */
3905
4004
  getThirdColMajorDirection(): number;
4005
+ /**
4006
+ * Get the values of the matrix as an array.
4007
+ *
4008
+ * @returns {number[]} The matrix.
4009
+ */
4010
+ getValues(): number[];
3906
4011
  #private;
3907
4012
  }
3908
4013
 
@@ -5214,6 +5319,7 @@ export declare class ToolConfig {
5214
5319
  * the default ones.
5215
5320
  *
5216
5321
  * @example
5322
+ * import {App, AppOptions, ViewConfig, toolList} from '//esm.sh/dwv';
5217
5323
  * // custom tool
5218
5324
  * class AlertTool {
5219
5325
  * mousedown() {alert('AlertTool mousedown');}
@@ -5221,13 +5327,13 @@ export declare class ToolConfig {
5221
5327
  * activate() {}
5222
5328
  * }
5223
5329
  * // pass it to dwv tool list
5224
- * dwv.toolList['Alert'] = AlertTool;
5330
+ * toolList['Alert'] = AlertTool;
5225
5331
  * // create the dwv app
5226
- * const app = new dwv.App();
5332
+ * const app = new App();
5227
5333
  * // initialise
5228
- * const viewConfig0 = new dwv.ViewConfig('layerGroup0');
5334
+ * const viewConfig0 = new ViewConfig('layerGroup0');
5229
5335
  * const viewConfigs = {'*': [viewConfig0]};
5230
- * const options = new dwv.AppOptions(viewConfigs);
5336
+ * const options = new AppOptions(viewConfigs);
5231
5337
  * options.tools = {Alert: {}};
5232
5338
  * app.init(options);
5233
5339
  * // activate tool
@@ -5250,6 +5356,8 @@ export declare const toolList: {
5250
5356
  * the default ones.
5251
5357
  *
5252
5358
  * @example
5359
+ * import {App, AppOptions, ViewConfig, toolOptions, ROI, Point2D}
5360
+ * from '//esm.sh/dwv';
5253
5361
  * // custom factory
5254
5362
  * class LoveFactory {
5255
5363
  * getName() {return 'love';}
@@ -5259,10 +5367,10 @@ export declare const toolList: {
5259
5367
  * setAnnotationMathShape(annotation, points) {
5260
5368
  * const px = points[0].getX();
5261
5369
  * const py = points[0].getY();
5262
- * annotation.mathShape = new dwv.ROI([
5263
- * new dwv.Point2D(px+15,py), new dwv.Point2D(px+10,py-10),
5264
- * new dwv.Point2D(px,py), new dwv.Point2D(px-10,py-10),
5265
- * new dwv.Point2D(px-15,py), new dwv.Point2D(px,py+20)
5370
+ * annotation.mathShape = new ROI([
5371
+ * new Point2D(px+15,py), new Point2D(px+10,py-10),
5372
+ * new Point2D(px,py), new Point2D(px-10,py-10),
5373
+ * new Point2D(px-15,py), new Point2D(px,py+20)
5266
5374
  * ]);
5267
5375
  * annotation.getFactory = function () {return new LoveFactory();}
5268
5376
  * }
@@ -5289,13 +5397,13 @@ export declare const toolList: {
5289
5397
  * }
5290
5398
  * }
5291
5399
  * // pass it to dwv option list
5292
- * dwv.toolOptions['draw'] = {LoveFactory};
5400
+ * toolOptions['draw'] = {LoveFactory};
5293
5401
  * // create the dwv app
5294
- * const app = new dwv.App();
5402
+ * const app = new App();
5295
5403
  * // initialise
5296
- * const viewConfig0 = new dwv.ViewConfig('layerGroup0');
5404
+ * const viewConfig0 = new ViewConfig('layerGroup0');
5297
5405
  * const viewConfigs = {'*': [viewConfig0]};
5298
- * const options = new dwv.AppOptions(viewConfigs);
5406
+ * const options = new AppOptions(viewConfigs);
5299
5407
  * options.tools = {Draw: {options: ['Love']}};
5300
5408
  * app.init(options);
5301
5409
  * // activate tool
@@ -5400,15 +5508,16 @@ export declare class Vector3D {
5400
5508
  * (either directly or with helper methods).
5401
5509
  *
5402
5510
  * @example
5511
+ * import {DicomParser, createImage, createView} from '//esm.sh/dwv';
5403
5512
  * // XMLHttpRequest onload callback
5404
5513
  * const onload = function (event) {
5405
5514
  * // parse the dicom buffer
5406
- * const dicomParser = new dwv.DicomParser();
5515
+ * const dicomParser = new DicomParser();
5407
5516
  * dicomParser.parse(event.target.response);
5408
5517
  * // create the image object
5409
- * const image = dwv.createImage(dicomParser.getDicomElements());
5518
+ * const image = createImage(dicomParser.getDicomElements());
5410
5519
  * // create the view
5411
- * const view = dwv.createView(dicomParser.getDicomElements(), image);
5520
+ * const view = createView(dicomParser.getDicomElements(), image);
5412
5521
  * // setup canvas
5413
5522
  * const canvas = document.createElement('canvas');
5414
5523
  * canvas.width = 256;
@@ -5420,7 +5529,7 @@ export declare class Vector3D {
5420
5529
  * ctx.putImageData(imageData, 0, 0);
5421
5530
  * // update html
5422
5531
  * const div = document.getElementById('dwv');
5423
- * div.appendChild(canvas);;
5532
+ * div.appendChild(canvas);
5424
5533
  * };
5425
5534
  * // DICOM file request
5426
5535
  * const request = new XMLHttpRequest();
@@ -5752,6 +5861,10 @@ export declare class ViewController {
5752
5861
  * @returns {PlaneHelper} The helper.
5753
5862
  */
5754
5863
  getPlaneHelper(): PlaneHelper;
5864
+ /**
5865
+ * Update the plane helper if there is a change in the image geometry.
5866
+ */
5867
+ updatePlaneHelper(): void;
5755
5868
  /**
5756
5869
  * Check is the associated image is a mask.
5757
5870
  *
@@ -5993,6 +6106,12 @@ export declare class ViewController {
5993
6106
  * @returns {Size} The size.
5994
6107
  */
5995
6108
  getImageSize(): Size;
6109
+ /**
6110
+ * Get the oriented image spacing.
6111
+ *
6112
+ * @returns {Spacing} The spacing.
6113
+ */
6114
+ getImageSpacing(): Spacing;
5996
6115
  /**
5997
6116
  * Is the data size larger than one in the given dimension?
5998
6117
  *
@@ -6229,6 +6348,13 @@ export declare class ViewLayer {
6229
6348
  * @function
6230
6349
  */
6231
6350
  onimagegeometrychange: (event: object) => void;
6351
+ /**
6352
+ * Handle an image resampled event.
6353
+ *
6354
+ * @param {object} event The event.
6355
+ * @function
6356
+ */
6357
+ onimageresampled: (event: object) => void;
6232
6358
  /**
6233
6359
  * Get the id of the layer.
6234
6360
  *