diff --git a/dwv.js b/dwv.js deleted file mode 100644 index 8a1ad2e..0000000 --- a/dwv.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! dwv 0.30.8 2022-01-04 12:43:27 */ - -!function(e,t){"function"==typeof define&&define.amd?define(["i18next","i18next-http-backend","i18next-browser-languagedetector","jszip","konva","magic-wand-tool"],t):"object"==typeof module&&module.exports?module.exports=t(require("i18next"),require("i18next-http-backend"),require("i18next-browser-languagedetector"),require("jszip"),require("konva/cmj"),require("magic-wand-tool")):e.dwv=t(e.i18next,e.i18nextHttpBackend,e.i18nextBrowserLanguageDetector,e.JSZip,e.Konva,e.MagicWand)}(this,function(i,r,o,c,y,p){function e(e){return void 0!==e&&void 0!==e.default}var s=void 0!==s?s:"undefined"!=typeof self?self:"undefined"!=typeof global?global:{};e(i)&&(i=i.default),e(r)&&(r=r.default),e(o)&&(o=o.default),e(y)&&(y=y.default);var A=A||{};A.App=function(){var r=this,S=null,m=null,h=null,f=null,p=null,y=null,e=new A.gui.Style,n=new A.utils.ListenerHandler;function D(e){n.fireEvent(e)}function v(e){e.type="loadstart",D(e)}function C(e){e.type="loadprogress",D(e)}function L(e){void 0===e.data&&A.logger.error("Missing loaditem event data."),void 0===e.loadtype&&A.logger.error("Missing loaditem event load type.");var t=e.isfirstitem,n=0;void 0!==e.timepoint&&(n=e.timepoint.id);var i=null;"image"===e.loadtype?(t&&0===n?m.addNew(e.data.image,e.data.info):m.update(e.loadid,e.data.image,e.data.info,n),i=e.data.info):"state"===e.loadtype&&((n=new A.io.State).apply(r,n.fromJSON(e.data)),i="state"),D({type:"loaditem",data:i,source:e.source,loadtype:e.loadtype}),"image"===e.loadtype&&t&&S.viewOnFirstLoadItem&&r.render(e.loadid)}function T(e){e.type="load",D(e)}function I(e){e.type="loadend",D(e)}function w(e){e.type="error",D(e)}function P(e){e.type="abort",D(e)}function a(e,t){var n=m.get(e);if(!n)throw new Error("Cannot initialise layers with data id: "+e);var i=p.getLayerGroupWithElementId(t);if(!i)throw new Error("Cannot initialise layers with group id: "+t);var r=n.image.getGeometry();p.unbindLayerGroups();var o=(new A.ViewFactory).create(new A.dicom.DicomElementsWrapper(n.meta),n.image),a=A.gui.getViewOrientation(r,i.getTargetOrientation());o.setOrientation(a);var s=1;0!==e&&(o.setColourMap(A.image.lut.rainbow),s=.5);t=i.addViewLayer();t.setView(o);n=r.getSize(a).get2D(),o=r.getSpacing(a).get2D();t.initialise(n,o,e),t.setOpacity(s);var l,a=null;0!==e&&(s=m.get(0).image.getGeometry().getOrigin(),l=r.getOrigin(),a=s.minus(l),t.setBaseOffset(a)),m.addEventListener("imagechange",t.onimagechange),p.bindLayerGroups(),h&&h.hasTool("Draw")&&((l=i.addDrawLayer()).initialise(n,o,e),l.setPlaneHelper(t.getViewController().getPlaneHelper()),t=[(t=t.getViewController()).getCurrentIndex().getValues(),t.getCurrentPosition().getValues()],i.updateLayersToPositionChange({value:t}),0!==e&&l.setBaseOffset(a));for(var u={x:0,y:0},c=0;cu.x&&(u.x=d);g=x.y*g.y;g>u.y&&(u.y=g)}i.fitToContainer(u)}this.getImage=function(e){return m.get(e).image},this.getLastImage=function(){return m.get(m.length()-1).image},this.setImage=function(e,t){m.setImage(e,t)},this.setLastImage=function(e){m.setImage(m.length()-1,e)},this.getMetaData=function(e){return m.get(e).meta},this.getNumberOfLoadedData=function(){return m.length()},this.canScroll=function(){return p.getActiveLayerGroup().getActiveViewLayer().getViewController().canScroll()},this.canWindowLevel=function(){return p.getActiveLayerGroup().getActiveViewLayer().getViewController().canWindowLevel()},this.getAddedScale=function(){return p.getActiveLayerGroup().getAddedScale()},this.getBaseScale=function(){return p.getActiveLayerGroup().getBaseScale()},this.getOffset=function(){return p.getActiveLayerGroup().getOffset()},this.getToolboxController=function(){return h},this.getActiveLayerGroup=function(){return p.getActiveLayerGroup()},this.getViewLayersByDataIndex=function(e){return p.getViewLayersByDataIndex(e)},this.getLayerGroupById=function(e){return p.getLayerGroup(e)},this.getNumberOfLayerGroups=function(){return p.getNumberOfLayerGroups()},this.getStyle=function(){return e},this.addToUndoStack=function(e){null!==y&&y.add(e)},this.init=function(e){if(void 0===(S=e).viewOnFirstLoadItem&&(S.viewOnFirstLoadItem=!0),(y=new A.tool.UndoStack).addEventListener("undoadd",D),y.addEventListener("undo",D),y.addEventListener("redo",D),S.tools&&0!==S.tools.length){for(var t={},n=Object.keys(S.tools),i=0;i=e.get(3))&&r.image.appendFrame(),r.image.appendSlice(t,i),0===i&&(i="",i=void 0!==n.x00020010?"InstanceNumber":"imageUid",r.meta=A.utils.mergeObjects(r.meta,a(n),i,"value"))},this.addEventListener=function(e,t){n.add(e,t)},this.removeEventListener=function(e,t){n.remove(e,t)}},(A=A||{}).draw=A.draw||{},A.ctrl=A.ctrl||{};y=y||{};A.draw.getDrawPositionGroupId=function(e){return"slice-"+e.get(2)+"_frame-"+(4===e.length()?e.get(3):0)},A.draw.getPositionFromGroupId=function(e){var t=e.indexOf("_");return-1===t&&A.logger.warn("Badly formed PositionGroupId: "+e),{sliceNumber:e.substring(6,t),frameNumber:e.substring(t+7)}},A.draw.isNodeNameShape=function(e){return"shape"===e.name()},A.draw.isNodeNameShapeExtra=function(e){return e.name().startsWith("shape-")},A.draw.isNodeNameLabel=function(e){return"label"===e.name()},A.draw.isPositionNode=function(e){return"position-group"===e.name()},A.draw.isNodeWithId=function(t){return function(e){return e.id()===t}},A.draw.canNodeChangeColour=function(e){return"anchor"!==e.name()&&"label"!==e.name()},A.draw.getHierarchyLog=function(e,t){void 0===t&&(t="");for(var n=e.getChildren(),i=t+"|__ "+e.name()+": "+e.id()+"\n",r=0;r2^"+t+")."))}return i},A.dicom.is32bitVLVR=function(e){return"OB"===e||"OW"===e||"OF"===e||"ox"===e||"UT"===e||"SQ"===e||"UN"===e},A.dicom.getDataElementPrefixByteSize=function(e,t){return!t&&A.dicom.is32bitVLVR(e)?12:8},A.dicom.DicomParser=function(){var t;this.dicomElements={},this.getDefaultCharacterSet=function(){return t},this.setDefaultCharacterSet=function(e){t=e}},A.dicom.DicomParser.prototype.getRawDicomElements=function(){return this.dicomElements},A.dicom.DicomParser.prototype.getDicomElements=function(){return new A.dicom.DicomElementsWrapper(this.dicomElements)},A.dicom.DicomParser.prototype.readTag=function(e,t){var n=e.readHex(t);t+=Uint16Array.BYTES_PER_ELEMENT;e=e.readHex(t);return t+=Uint16Array.BYTES_PER_ELEMENT,{group:n,element:e,name:new A.dicom.Tag(n,e).getKey(),endOffset:t}},A.dicom.DicomParser.prototype.readExplicitItemDataElement=function(e,t,n){var i={},r=this.readDataElement(e,t,n),o=t=r.endOffset;for(t-=(i[r.tag.name]=r).vl;tg){for(var x=d.length/g,S=[],m=0;m2^"+i+") for decompressed data.")),d.abort(),g.onerror({error:e,source:origin}),g.onloadend({source:origin})}}n.length!==m[t]&&A.logger.warn("Unsupported varying decompressed data size: "+n.length+" != "+m[t]),S[t].set(n,m[t]*e.itemNumber)}else S[t]=n;0===e.itemNumber&&h(t,origin)}(e),e.itemNumber+1===e.numberOfItems&&(g.onload(e),g.onloadend(e))},d.onerror=g.onerror,d.onabort=g.onabort);for(var u=0;un.getMax()?t:e})},A.image.filter.Sharpen=function(){this.getName=function(){return"Sharpen"};var t=null;this.setOriginalImage=function(e){t=e},this.getOriginalImage=function(){return t}},A.image.filter.Sharpen.prototype.update=function(){return this.getOriginalImage().convolute2D([0,-1,0,-1,5,-1,0,-1,0])},A.image.filter.Sobel=function(){this.getName=function(){return"Sobel"};var t=null;this.setOriginalImage=function(e){t=e},this.getOriginalImage=function(){return t}},A.image.filter.Sobel.prototype.update=function(){var e=this.getOriginalImage(),t=e.convolute2D([1,0,-1,2,0,-2,1,0,-1]),e=e.convolute2D([1,2,1,0,0,0,-1,-2,-1]);return t.compose(e,function(e,t){return Math.sqrt(e*e+t*t)})},(A=A||{}).image=A.image||{},A.image.Geometry=function(e,n,i,l){var u=[e=void 0===e?new A.math.Point3D(0,0,0):e];void 0===l&&(l=new A.math.getIdentityMat33);var r=!1;this.getOrigin=function(){return u[u.length-1]},this.getOrigins=function(){return u},this.getSize=function(e){var t=n;return e&&void 0!==e&&(e=A.math.getOrientedArray3D([n.get(0),n.get(1),n.get(2)],e),t=new A.image.Size(e)),t},this.getSliceGeometrySpacing=function(){if(1===u.length)return 1;for(var e,t=null,n=l.getInverse().asOneAndZeros(),i=[],r=0;r=L.numberOfFiles)throw new Error("Cannot append a frame at an index above the number of frames");y.set(e,i*t),this.appendFrame()},this.appendFrame=function(){p.appendFrame(),u.fireEvent({type:"appendframe"})},this.getDataRange=function(){return n=n||this.calculateDataRange()},this.getRescaledDataRange=function(){return i=i||this.calculateRescaledDataRange()},this.getHistogram=function(){var e;return l||(e=this.calculateHistogram(),n=e.dataRange,i=e.rescaledDataRange,l=e.histogram),l},this.addEventListener=function(e,t){u.add(e,t)},this.removeEventListener=function(e,t){u.remove(e,t)}},A.image.Image.prototype.getValue=function(e,t,n,i){i=new A.math.Index([e,t,n,i||0]);return this.getValueAtOffset(this.getGeometry().getSize().indexToOffset(i))},A.image.Image.prototype.getValueAtIndex=function(e){return this.getValueAtOffset(this.getGeometry().getSize().indexToOffset(e))},A.image.Image.prototype.getRescaledValue=function(e,t,n,i){var r=this.getValue(e,t,n,i=void 0===i?0:i);return r=!this.isIdentityRSI()?this.isConstantRSI()?this.getRescaleSlopeAndIntercept().apply(r):(i=new A.math.Index([e,t,n,i]),this.getRescaleSlopeAndIntercept(i).apply(r)):r},A.image.Image.prototype.getRescaledValueAtIndex=function(e){return this.getRescaledValueAtOffset(this.getGeometry().getSize().indexToOffset(e))},A.image.Image.prototype.getRescaledValueAtOffset=function(e){var t=this.getValueAtOffset(e);return t=!this.isIdentityRSI()?this.isConstantRSI()?this.getRescaleSlopeAndIntercept().apply(t):(e=this.getGeometry().getSize().offsetToIndex(e),this.getRescaleSlopeAndIntercept(e).apply(t)):t},A.image.Image.prototype.calculateDataRange=function(){var e,t=this.getValueAtOffset(0),n=t,i=this.getGeometry().getSize(),r=i.getTotalSize();3<=i.length()&&(r=i.getDimSize(3));for(var o=0;o>8}),g=g.map(t),i=i.map(t))):8===a[2]&&(A.logger.info("Scaling 16bits color lut since the lut descriptor is 8."),a=n.slice(0),n=new Uint8Array(a.buffer),a=g.slice(0),g=new Uint8Array(a.buffer),a=i.slice(0),i=new Uint8Array(a.buffer))),x.paletteLut={red:n,green:g,blue:i});e=e.getFromKey("x00082144");return e&&(x.RecommendedDisplayFrameRate=parseInt(e,10)),u.setMeta(x),u},(A=A||{}).image=A.image||{},A.image.simpleRange=function(t,e,n,i){void 0===i&&(i=1);var r=e;return{next:function(){if(r=2*A.image.lut.range_max/3?A.image.lut.range_max-1:0},A.image.lut.toMaxFirstThird=function(e){e*=3;return e>A.image.lut.range_max-1?A.image.lut.range_max-1:e},A.image.lut.toMaxSecondThird=function(e){var t=A.image.lut.range_max/3,n=0;return t<=e&&(n=3*(e-t))>A.image.lut.range_max-1?A.image.lut.range_max-1:n},A.image.lut.toMaxThirdThird=function(e){var t=A.image.lut.range_max/3,n=0;return 2*t<=e&&(n=3*(e-2*t))>A.image.lut.range_max-1?A.image.lut.range_max-1:n},A.image.lut.zero=function(e){return 0},A.image.lut.id=function(e){return e},A.image.lut.invId=function(e){return A.image.lut.range_max-1-e},A.image.lut.plain={red:A.image.lut.buildLut(A.image.lut.id),green:A.image.lut.buildLut(A.image.lut.id),blue:A.image.lut.buildLut(A.image.lut.id)},A.image.lut.invPlain={red:A.image.lut.buildLut(A.image.lut.invId),green:A.image.lut.buildLut(A.image.lut.invId),blue:A.image.lut.buildLut(A.image.lut.invId)},A.image.lut.rainbow={blue:[0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,255,247,239,231,223,215,207,199,191,183,175,167,159,151,143,135,127,119,111,103,95,87,79,71,63,55,47,39,31,23,15,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,200,208,216,224,232,240,248,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,251,249,247,245,243,241,239,237,235,233,231,229,227,225,223,221,219,217,215,213,211,209,207,205,203,201,199,197,195,193,192,189,186,183,180,177,174,171,168,165,162,159,156,153,150,147,144,141,138,135,132,129,126,123,120,117,114,111,108,105,102,99,96,93,90,87,84,81,78,75,72,69,66,63,60,57,54,51,48,45,42,39,36,33,30,27,24,21,18,15,12,9,6,3],red:[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,62,60,58,56,54,52,50,48,46,44,42,40,38,36,34,32,30,28,26,24,22,20,18,16,14,12,10,8,6,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]},A.image.lut.hot={red:A.image.lut.buildLut(A.image.lut.toMaxFirstThird),green:A.image.lut.buildLut(A.image.lut.toMaxSecondThird),blue:A.image.lut.buildLut(A.image.lut.toMaxThirdThird)},A.image.lut.hot_iron={red:[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,255],blue:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,255]},A.image.lut.pet={red:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,171,173,175,177,179,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,245,247,249,251,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,115,117,119,121,123,125,128,126,124,122,120,118,116,114,112,110,108,106,104,102,100,98,96,94,92,90,88,86,84,82,80,78,76,74,72,70,68,66,64,63,61,59,57,55,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,23,21,19,17,15,13,11,9,7,5,3,1,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,255],blue:[0,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,245,247,249,251,253,255,252,248,244,240,236,232,228,224,220,216,212,208,204,200,196,192,188,184,180,176,172,168,164,160,156,152,148,144,140,136,132,128,124,120,116,112,108,104,100,96,92,88,84,80,76,72,68,64,60,56,52,48,44,40,36,32,28,24,20,16,12,8,4,0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,85,89,93,97,101,105,109,113,117,121,125,129,133,137,141,145,149,153,157,161,165,170,174,178,182,186,190,194,198,202,206,210,214,218,222,226,230,234,238,242,246,250,255]},A.image.lut.hot_metal_blue={red:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,9,12,15,18,21,24,26,29,32,35,38,41,44,47,50,52,55,57,59,62,64,66,69,71,74,76,78,81,83,85,88,90,93,96,99,102,105,108,111,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,166,169,172,175,178,181,184,187,190,194,198,201,205,209,213,217,221,224,228,232,236,240,244,247,251,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,6,8,9,11,13,15,17,19,21,23,24,26,28,30,32,34,36,38,40,41,43,45,47,49,51,53,55,56,58,60,62,64,66,68,70,72,73,75,77,79,81,83,85,87,88,90,92,94,96,98,100,102,104,105,107,109,111,113,115,117,119,120,122,124,126,128,130,132,134,136,137,139,141,143,145,147,149,151,152,154,156,158,160,162,164,166,168,169,171,173,175,177,179,181,183,184,186,188,190,192,194,196,198,200,201,203,205,207,209,211,213,215,216,218,220,222,224,226,228,229,231,233,235,237,239,240,242,244,246,248,250,251,253,255],blue:[0,2,4,6,8,10,12,14,16,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,181,183,184,186,188,190,192,194,196,198,200,197,194,191,188,185,182,179,176,174,171,168,165,162,159,156,153,150,144,138,132,126,121,115,109,103,97,91,85,79,74,68,62,56,50,47,44,41,38,35,32,29,26,24,21,18,15,12,9,6,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,9,12,15,18,21,24,26,29,32,35,38,41,44,47,50,53,56,59,62,65,68,71,74,76,79,82,85,88,91,94,97,100,103,106,109,112,115,118,121,124,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,176,179,182,185,188,191,194,197,200,203,206,210,213,216,219,223,226,229,232,236,239,242,245,249,252,255]},A.image.lut.pet_20step={red:[0,0,0,0,0,0,0,0,0,0,0,0,0,96,96,96,96,96,96,96,96,96,96,96,96,96,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,96,96,96,96,96,96,96,96,96,96,96,96,96,112,112,112,112,112,112,112,112,112,112,112,112,112,128,128,128,128,128,128,128,128,128,128,128,128,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,64,64,64,64,64,64,64,64,64,64,64,64,224,224,224,224,224,224,224,224,224,224,224,224,224,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,192,192,192,192,192,192,192,192,192,192,192,192,192,176,176,176,176,176,176,176,176,176,176,176,176,176,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,96,96,96,96,96,96,96,96,96,96,96,96,96,112,112,112,112,112,112,112,112,112,112,112,112,112,128,128,128,128,128,128,128,128,128,128,128,128,96,96,96,96,96,96,96,96,96,96,96,96,96,144,144,144,144,144,144,144,144,144,144,144,144,144,192,192,192,192,192,192,192,192,192,192,192,192,192,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,208,208,208,208,208,208,208,208,208,208,208,208,208,176,176,176,176,176,176,176,176,176,176,176,176,176,144,144,144,144,144,144,144,144,144,144,144,144,96,96,96,96,96,96,96,96,96,96,96,96,96,48,48,48,48,48,48,48,48,48,48,48,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255],blue:[0,0,0,0,0,0,0,0,0,0,0,0,0,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,112,112,112,112,112,112,112,112,112,112,112,112,128,128,128,128,128,128,128,128,128,128,128,128,128,176,176,176,176,176,176,176,176,176,176,176,176,176,192,192,192,192,192,192,192,192,192,192,192,192,192,224,224,224,224,224,224,224,224,224,224,224,224,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,64,64,64,64,64,64,64,64,64,64,64,64,80,80,80,80,80,80,80,80,80,80,80,80,80,96,96,96,96,96,96,96,96,96,96,96,96,96,64,64,64,64,64,64,64,64,64,64,64,64,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255]},A.image.lut.test={red:A.image.lut.buildLut(A.image.lut.id),green:A.image.lut.buildLut(A.image.lut.zero),blue:A.image.lut.buildLut(A.image.lut.zero)},(A=A||{}).image=A.image||{},A.image.PlaneHelper=function(t,i){this.getOffset3DFromPlaneOffset=function(e){e=new A.math.Vector3D(e.x,e.y,0),e=this.getDeOrientedVector3D(e);return e=e,new A.math.Vector3D(e.getX()*t.get(0),e.getY()*t.get(1),e.getZ()*t.get(2))},this.getPlaneOffsetFromOffset3D=function(e){e=e,e=new A.math.Vector3D(e.x/t.get(0),e.y/t.get(1),e.z/t.get(2)),e=this.getOrientedVector3D(e);return{x:e.getX(),y:e.getY()}},this.getOrientedVector3D=function(e){var t=e;return t=void 0!==i?i.getInverse().getAbs().multiplyVector3D(e):t},this.getOrientedIndex=function(e){var t=e;return t=void 0!==i?i.getInverse().getAbs().multiplyIndex3D(e):t},this.getOrientedPoint=function(e){var t,n=e;return void 0!==i&&(t=i.getInverse().getAbs().multiplyPoint3D(e.get3D()),n=e.mergeWith3D(t)),n},this.getDeOrientedVector3D=function(e){var t=e;return t=void 0!==i?i.getAbs().multiplyVector3D(e):t},this.getOrientedXYZ=function(e){e=A.math.getOrientedArray3D([e.x,e.y,e.z],i);return{x:e[0],y:e[1],z:e[2]}},this.getDeOrientedXYZ=function(e){e=A.math.getDeOrientedArray3D([e.x,e.y,e.z],i);return{x:e[0],y:e[1],z:e[2]}},this.getScrollIndex=function(){return void 0!==i?i.getThirdColMajorDirection():2}},(A=A||{}).image=A.image||{},A.image.RescaleLut=function(t,e){var n=null,i=!1,r=Math.pow(2,e);this.getRSI=function(){return t},this.isReady=function(){return i},this.initialise=function(){if(!i){n=new Float32Array(r);for(var e=0;e=e+1&&1!==this.get(e)},A.image.Size.prototype.canScroll3D=function(e){var t=2;return void 0!==e&&(t=e.getThirdColMajorDirection()),this.moreThanOne(t)},A.image.Size.prototype.canScroll=function(e){for(var t=this.canScroll3D(e),n=3;nthis.length())return null;if(void 0===t)t=0;else if(t<0||ethis.get(n)-1)return!1;return!0},A.image.Size.prototype.indexToOffset=function(e,t){if(e.length()this.length()-1)throw new Error("Invalid start value for indexToOffset");for(var n=0,i=t;i>8,e.data[a+1]=i.green[o]>>8,e.data[a+2]=i.blue[o]>>8):(e.data[a]=i.red[o],e.data[a+1]=i.green[o],e.data[a+2]=i.blue[o]),e.data[a+3]=n(o),a+=4,s=t.next()},(A=A||{}).image=A.image||{},A.image.generateImageDataRgb=function(e,t,n){for(var i=0,r=t.next();!r.done;)e.data[i]=r.value[0],e.data[i+1]=r.value[1],e.data[i+2]=r.value[2],e.data[i+3]=n(r.value),i+=4,r=t.next()},(A=A||{}).image=A.image||{},A.image.generateImageDataYbrFull=function(e,t,n){for(var i,r=0,o=t.next();!o.done;)i=A.utils.ybrToRgb(o.value[0],o.value[1],o.value[2]),e.data[r]=i.r,e.data[r+1]=i.g,e.data[r+2]=i.b,e.data[r+3]=n(o.value),r+=4,o=t.next()},(A=A||{}).image=A.image||{},A.image.MinWindowWidth=1,A.image.validateWindowWidth=function(e){return e=this.length())throw new Error("Non valid dimension for toStringId.");for(var i="",r=0;ri.getEnd().getX()?0:-1,u=i.getBegin().getY()>i.getEnd().getY()?-1:0,c=new y.Label({x:i.getEnd().getX()+e*l.width(),y:i.getEnd().getY()+u*t.applyZoomScale(15).y,scale:t.applyZoomScale(1),visible:0!==c.length,name:"label"});c.add(l),c.add(new y.Tag({fill:t.getLineColour(),opacity:t.getTagOpacity()}));t=new y.Group;return t.name(this.getGroupName()),t.add(c),t.add(s),t.add(r),t.visible(!0),t},A.tool.draw.ArrowFactory.prototype.getAnchors=function(e,t){var n=e.points(),i=[];return i.push(A.tool.draw.getDefaultAnchor(n[0]+e.x(),n[1]+e.y(),"begin",t)),i.push(A.tool.draw.getDefaultAnchor(n[2]+e.x(),n[3]+e.y(),"end",t)),i},A.tool.draw.ArrowFactory.prototype.update=function(e,t,n){var i=e.getParent(),r=i.getChildren(function(e){return"shape"===e.name()})[0],o=i.getChildren(function(e){return"shape-triangle"===e.name()})[0],a=i.getChildren(function(e){return"label"===e.name()})[0],s=i.getChildren(function(e){return"begin"===e.id()})[0],l=i.getChildren(function(e){return"end"===e.id()})[0];switch(e.id()){case"begin":s.x(e.x()),s.y(e.y());break;case"end":l.x(e.x()),l.y(e.y())}var u=s.x()-r.x(),c=s.y()-r.y(),g=l.x()-r.x(),d=l.y()-r.y();r.points([u,c,g,d]);var x=new A.math.Point2D(s.x(),s.y()),i=new A.math.Point2D(l.x(),l.y()),i=new A.math.Line(x,i),c=new A.math.Point2D(u,c),d=new A.math.Point2D(g,d),S=A.math.getPerpendicularLine(i,c,10),m=A.math.getPerpendicularLine(i,d,10);r.hitFunc(function(e){e.beginPath(),e.moveTo(S.getBegin().getX(),S.getBegin().getY()),e.lineTo(S.getEnd().getX(),S.getEnd().getY()),e.lineTo(m.getEnd().getX(),m.getEnd().getY()),e.lineTo(m.getBegin().getX(),m.getBegin().getY()),e.closePath(),e.fillStrokeShape(this)});d=new A.math.Point2D(i.getBegin().getX(),i.getBegin().getY()-10),r=new A.math.Line(i.getBegin(),d),d=A.math.getAngle(i,r),r=d*Math.PI/180;o.x(i.getBegin().getX()+o.radius()*Math.sin(r)),o.y(i.getBegin().getY()+o.radius()*Math.cos(r)),o.rotation(-d);r=a.getText();r.setText(r.meta.textExpr);o=i.getBegin().getX()>i.getEnd().getX()?0:-1,d=i.getBegin().getY()>i.getEnd().getY()?-1:0,t={x:i.getEnd().getX()+o*r.width(),y:i.getEnd().getY()+d*t.applyZoomScale(15).y};a.position(t)},(A=A||{}).tool=A.tool||{},A.tool.draw=A.tool.draw||{};y=y||{};A.tool.draw.defaultCircleLabelText="{surface}",A.tool.draw.CircleFactory=function(){this.getGroupName=function(){return"circle-group"},this.getNPoints=function(){return 2},this.getTimeout=function(){return 0}},A.tool.draw.CircleFactory.prototype.isFactoryGroup=function(e){return this.getGroupName()===e.name()},A.tool.draw.CircleFactory.prototype.create=function(e,t,n){var i=Math.abs(e[0].getX()-e[1].getX()),r=Math.abs(e[0].getY()-e[1].getY()),o=Math.round(Math.sqrt(i*i+r*r)),i=new A.math.Circle(e[0],o),r=new y.Circle({x:i.getCenter().getX(),y:i.getCenter().getY(),radius:i.getRadius(),stroke:t.getLineColour(),strokeWidth:t.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape"}),e=new y.Text({fontSize:t.getFontSize(),fontFamily:t.getFontFamily(),fill:t.getLineColour(),padding:t.getTextPadding(),shadowColor:t.getShadowLineColour(),shadowOffset:t.getShadowOffset(),name:"text"}),o="",o=void 0!==A.tool.draw.circleLabelText?A.tool.draw.circleLabelText:A.tool.draw.defaultCircleLabelText,n=i.quantify(n,A.utils.getFlags(o));e.setText(A.utils.replaceFlags(o,n)),e.meta={textExpr:o,quantification:n};var a,o=new y.Label({x:i.getCenter().getX(),y:i.getCenter().getY(),scale:t.applyZoomScale(1),visible:0!==o.length,name:"label"});o.add(e),o.add(new y.Tag({fill:t.getLineColour(),opacity:t.getTagOpacity()})),A.tool.draw.debug&&(a=A.tool.draw.getShadowCircle(i));i=new y.Group;return i.name(this.getGroupName()),a&&i.add(a),i.add(o),i.add(r),i.visible(!0),i},A.tool.draw.CircleFactory.prototype.getAnchors=function(e,t){var n=e.x(),i=e.y(),r=e.radius(),e=[];return e.push(A.tool.draw.getDefaultAnchor(n-r,i,"left",t)),e.push(A.tool.draw.getDefaultAnchor(n+r,i,"right",t)),e.push(A.tool.draw.getDefaultAnchor(n,i-r,"bottom",t)),e.push(A.tool.draw.getDefaultAnchor(n,i+r,"top",t)),e},A.tool.draw.CircleFactory.prototype.update=function(e,t,n){var i,r=e.getParent(),o=r.getChildren(function(e){return"shape"===e.name()})[0],a=r.getChildren(function(e){return"label"===e.name()})[0],s=r.getChildren(function(e){return"left"===e.id()})[0],l=r.getChildren(function(e){return"right"===e.id()})[0],u=r.getChildren(function(e){return"bottom"===e.id()})[0],c=r.getChildren(function(e){return"top"===e.id()})[0];A.tool.draw.debug&&(i=r.getChildren(function(e){return"shadow"===e.name()})[0]);var g,d={x:o.x(),y:o.y()};switch(e.id()){case"left":g=d.x-e.x(),s.y(l.y()),l.x(d.x+g),u.y(d.y-g),c.y(d.y+g);break;case"right":g=e.x()-d.x,l.y(s.y()),s.x(d.x-g),u.y(d.y-g),c.y(d.y+g);break;case"bottom":g=d.y-e.y(),u.x(c.x()),s.x(d.x-g),l.x(d.x+g),c.y(d.y+g);break;case"top":g=e.y()-d.y,c.x(u.x()),s.x(d.x-g),l.x(d.x+g),u.y(d.y-g);break;default:A.logger.error("Unhandled anchor id: "+e.id())}o.radius(Math.abs(g));o=new A.math.Point2D(r.x()+d.x,r.y()+d.y),o=new A.math.Circle(o,g);i&&(i.destroy(),r.add(A.tool.draw.getShadowCircle(o,r))),a.position({x:d.x,y:d.y}),A.tool.draw.updateCircleQuantification(r,n)},A.tool.draw.CircleFactory.prototype.updateQuantification=function(e,t){A.tool.draw.updateCircleQuantification(e,t)},A.tool.draw.updateCircleQuantification=function(e,t){var n=e.getChildren(function(e){return"shape"===e.name()})[0],i=e.getChildren(function(e){return"label"===e.name()})[0],e=new A.math.Point2D(e.x()+n.x(),e.y()+n.y()),n=new A.math.Circle(e,n.radius()),i=i.getText(),t=n.quantify(t,A.utils.getFlags(i.meta.textExpr));i.setText(A.utils.replaceFlags(i.meta.textExpr,t)),i.meta.quantification=t},A.tool.draw.getShadowCircle=function(e,t){var n=0,i=0;void 0!==t&&(n=t.x(),i=t.y());var r=new y.Group;r.name("shadow");for(var o=e.getRound(),a=0;an.x&&(e.x(n.x),i=!0),e.y()n.y&&(e.y(n.y),i=!0),i},A.tool.validateGroupPosition=function(e,t){var n=t.getChildren(A.draw.isNodeNameShape)[0],i=A.tool.getAnchorMin(t);if(void 0===i)return null;var r={x:-i.x,y:-i.y},n={x:e.x-(i.x+Math.abs(n.width())),y:e.y-(i.y+Math.abs(n.height()))};return A.tool.boundNodePosition(t,r,n)},A.tool.validateAnchorPosition=function(e,t){var n=t.getParent(),i={x:-n.x(),y:-n.y()},n={x:e.x-n.x(),y:e.y-n.y()};return A.tool.boundNodePosition(t,i,n)},(A=A||{}).tool=A.tool||{};y=y||{};A.tool.GetShapeDisplayName=function(e){var t="shape";return e instanceof y.Line?t=4===e.points().length?"line":6===e.points().length?"protractor":"roi":e instanceof y.Rect?t="rectangle":e instanceof y.Ellipse&&(t="ellipse"),t},A.tool.DrawGroupCommand=function(e,t,n,i){var r=void 0!==i&&i,o=e.getParent();this.getName=function(){return"Draw-"+t},this.execute=function(){o.add(e),n.draw(),r||this.onExecute({type:"drawcreate",id:e.id()})},this.undo=function(){e.remove(),n.draw(),this.onUndo({type:"drawdelete",id:e.id()})}},A.tool.DrawGroupCommand.prototype.onExecute=function(e){},A.tool.DrawGroupCommand.prototype.onUndo=function(e){},A.tool.MoveGroupCommand=function(t,e,n,i){this.getName=function(){return"Move-"+e},this.execute=function(){t.move(n),i.draw(),this.onExecute({type:"drawmove",id:t.id()})},this.undo=function(){var e={x:-n.x,y:-n.y};t.move(e),i.draw(),this.onUndo({type:"drawmove",id:t.id()})}},A.tool.MoveGroupCommand.prototype.onExecute=function(e){},A.tool.MoveGroupCommand.prototype.onUndo=function(e){},A.tool.ChangeGroupCommand=function(e,t,n,i,r,o,a){this.getName=function(){return"Change-"+e},this.execute=function(){t(i,a,o),r.draw(),this.onExecute({type:"drawchange"})},this.undo=function(){t(n,a,o),r.draw(),this.onUndo({type:"drawchange"})}},A.tool.ChangeGroupCommand.prototype.onExecute=function(e){},A.tool.ChangeGroupCommand.prototype.onUndo=function(e){},A.tool.DeleteGroupCommand=function(e,t,n){var i=e.getParent();this.getName=function(){return"Delete-"+t},this.execute=function(){e.remove(),n.draw(),this.onExecute({type:"drawdelete",id:e.id()})},this.undo=function(){i.add(e),n.draw(),this.onUndo({type:"drawcreate",id:e.id()})}},A.tool.DeleteGroupCommand.prototype.onExecute=function(e){},A.tool.DeleteGroupCommand.prototype.onUndo=function(e){},(A=A||{}).tool=A.tool||{},A.tool.draw=A.tool.draw||{};y=y||{};A.tool.draw.getDefaultAnchor=function(e,t,n,i){return new y.Ellipse({x:e,y:t,stroke:"#999",fill:"rgba(100,100,100,0.7",strokeWidth:i.getStrokeWidth(),strokeScaleEnabled:!1,radius:i.applyZoomScale(3),name:"anchor",id:n,dragOnTop:!1,draggable:!0,visible:!1})},A.tool.ShapeEditor=function(o){var a=null,s=null,l=null,u=null,e=!1,c=null;function n(e){l&&l.getParent()&&l.getParent().find(".anchor").forEach(e)}function t(t){n(function(e){e.visible(t)})}function g(){n(function(e){e.remove()})}function d(){if(l&&l.getLayer())for(var e=l.getParent(),t=s.getAnchors(l,o.getStyle()),n=0;ni.getEnd().getX()?0:-1,o=i.getBegin().getY()>i.getEnd().getY()?-1:0,e=new y.Label({x:i.getEnd().getX()+n*c.width(),y:i.getEnd().getY()+o*t.applyZoomScale(15).y,scale:t.applyZoomScale(1),visible:0!==e.length,name:"label"});e.add(c),e.add(new y.Tag({fill:t.getLineColour(),opacity:t.getTagOpacity()}));t=new y.Group;return t.name(this.getGroupName()),t.add(e),t.add(s),t.add(u),t.add(r),t.visible(!0),t},A.tool.draw.RulerFactory.prototype.getAnchors=function(e,t){var n=e.points(),i=[];return i.push(A.tool.draw.getDefaultAnchor(n[0]+e.x(),n[1]+e.y(),"begin",t)),i.push(A.tool.draw.getDefaultAnchor(n[2]+e.x(),n[3]+e.y(),"end",t)),i},A.tool.draw.RulerFactory.prototype.update=function(e,t,n){var i=e.getParent(),r=i.getChildren(function(e){return"shape"===e.name()})[0],o=i.getChildren(function(e){return"shape-tick0"===e.name()})[0],a=i.getChildren(function(e){return"shape-tick1"===e.name()})[0],s=i.getChildren(function(e){return"label"===e.name()})[0],l=i.getChildren(function(e){return"begin"===e.id()})[0],u=i.getChildren(function(e){return"end"===e.id()})[0];switch(e.id()){case"begin":l.x(e.x()),l.y(e.y());break;case"end":u.x(e.x()),u.y(e.y())}var c=l.x()-r.x(),g=l.y()-r.y(),d=u.x()-r.x(),x=u.y()-r.y();r.points([c,g,d,x]);var S=new A.math.Point2D(l.x(),l.y()),i=new A.math.Point2D(u.x(),u.y()),i=new A.math.Line(S,i),g=new A.math.Point2D(c,g),x=new A.math.Point2D(d,x),m=A.math.getPerpendicularLine(i,g,t.scale(10));o.points([m.getBegin().getX(),m.getBegin().getY(),m.getEnd().getX(),m.getEnd().getY()]);var h=A.math.getPerpendicularLine(i,x,t.scale(10));a.points([h.getBegin().getX(),h.getBegin().getY(),h.getEnd().getX(),h.getEnd().getY()]),r.hitFunc(function(e){e.beginPath(),e.moveTo(m.getBegin().getX(),m.getBegin().getY()),e.lineTo(m.getEnd().getX(),m.getEnd().getY()),e.lineTo(h.getEnd().getX(),h.getEnd().getY()),e.lineTo(h.getBegin().getX(),h.getBegin().getY()),e.closePath(),e.fillStrokeShape(this)});a=s.getText(),r=i.quantify(n,A.utils.getFlags(a.meta.textExpr));a.setText(A.utils.replaceFlags(a.meta.textExpr,r)),a.meta.quantification=r;n=i.getBegin().getX()>i.getEnd().getX()?0:-1,r=i.getBegin().getY()>i.getEnd().getY()?-1:0,t={x:i.getEnd().getX()+n*a.width(),y:i.getEnd().getY()+r*t.applyZoomScale(15).y};s.position(t)},(A=A||{}).tool=A.tool||{},A.tool.Scroll=function(a){var s=this;this.started=!1;var t=null;this.mousedown=function(e){var t=A.gui.getLayerDetailsFromEvent(e),n=a.getLayerGroupById(t.groupId).getActiveViewLayer(),t=n.getViewController();t.isPlaying()&&t.stop(),s.started=!0,s.x0=e._x,s.y0=e._y;e=n.displayToPlanePos(e._x,e._y);t.setCurrentPosition2D(e.x,e.y)},this.mousemove=function(e){var t,n,i,r,o;s.started&&(r=A.gui.getLayerDetailsFromEvent(e),t=a.getLayerGroupById(r.groupId).getActiveViewLayer().getViewController(),o=e._y-s.y0,(n=15>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],r=0;r - - - + + + + + + + + + + + Document
-
+ - - + \ No newline at end of file diff --git a/index.js b/index.js index 41e9202..9cf67f6 100644 --- a/index.js +++ b/index.js @@ -1,55 +1,28 @@ -var filterList = ['Threshold', 'Sharpen', 'Sobel']; -var shapeList = [ - 'Arrow', - 'Ruler', - 'Protractor', - 'Rectangle', - 'Roi', - 'Ellipse', - 'Circle', - 'FreeHand' -]; +var app = new dwv.App(); -var toolList = { +var tools = { Scroll: {}, - Opacity: {}, - WindowLevel: {}, - ZoomAndPan: {}, Draw: { - options: shapeList, - type: 'factory', - events: ['drawcreate', 'drawchange', 'drawmove', 'drawdelete'] - }, - Livewire: { - events: ['drawcreate', 'drawchange', 'drawmove', 'drawdelete'] - }, - Filter: { - options: filterList, - type: 'instance', - events: ['filterrun', 'filterundo'] - }, - Floodfill: { - events: ['drawcreate', 'drawchange', 'drawmove', 'drawdelete'] + options: ['Circle', 'Roi'], + type: 'factory' } }; -// initialise the application -var options = { +app.init({ dataViewConfigs: {'*': [{divId: 'layerGroup0'}]}, - tools: toolList -}; - -// main application -var app = new dwv.App(); -app.init(options); -// activate tool once done loading + tools: tools +}); app.addEventListener('load', function () { app.setTool('Scroll'); - app.setTool('Draw'); - app.setDrawShape(toolList.Draw.options[0]); - + //var layer = new dwv.gui.DrawLayer('layerGroup0') +// factory = new dwv.tool.draw.CircleFactory(); +// var point1 = new dwv.math.Point2D(10, 10) +// var point2 = new dwv.math.Point2D(10, 100) +// var draw = factory.create([point1, point2], app.getToolboxController().getSelectedTool().style, app.getActiveLayerGroup().getActiveViewLayer().getViewController()) +// app.getActiveLayerGroup().getActiveDrawLayer().getKonvaLayer().add(draw) +// console.log(app.getActiveLayerGroup().getActiveDrawLayer().getKonvaLayer().getChildren()[0]) }); @@ -60,14 +33,26 @@ function receiveMessage(event) if (data.type == "setDicom"){ app.loadURLs([data.data]) } else if(data.type == "setTool"){ - app.setTool('Draw'); - app.setDrawShape("Circle"); + if (data.data == "null"){ + app.setTool('Scroll'); + } else{ + app.setTool('Draw'); + app.setDrawShape(data.data); + } + } } window.addEventListener("message", receiveMessage, false); -// + +app.addEventListener("drawchange", function (){ + console.log("DRAWWWWWW") +}) + + + + var range = document.getElementById('sliceRange'); range.min = 0; app.addEventListener('loadend', function () { diff --git a/radiologic.zip b/radiologic.zip new file mode 100644 index 0000000..253232b Binary files /dev/null and b/radiologic.zip differ