copper3d 2.0.6 → 2.0.8

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.
@@ -48375,7 +48375,7 @@ class commonScene {
48375
48375
  (xhr) => { },
48376
48376
  // called when loading has errors
48377
48377
  (error) => {
48378
- console.log("An error happened");
48378
+ console.log("An error happened: ", error);
48379
48379
  });
48380
48380
  }
48381
48381
  }
@@ -68966,7 +68966,7 @@ function setupGui(configs) {
68966
68966
  .add(configs.mainPreSlices.volume, "windowHigh", configs.mainPreSlices.volume.min, configs.mainPreSlices.volume.max, 1)
68967
68967
  .name("ImageContrast")
68968
68968
  .onChange((value) => {
68969
- updateGuiImageContrastOnChange(value);
68969
+ updateGuiImageWindowHighOnChange(value);
68970
68970
  })
68971
68971
  .onFinishChange(() => {
68972
68972
  updateGuiImageContrastOnFinished();
@@ -69060,8 +69060,7 @@ function setupGui(configs) {
69060
69060
  .add(configs.mainPreSlices.volume, "windowLow", configs.mainPreSlices.volume.min, configs.mainPreSlices.volume.max, 1)
69061
69061
  .name("WindowLow")
69062
69062
  .onChange((value) => {
69063
- configs.gui_states.readyToUpdate = false;
69064
- configs.updateSlicesContrast(value, "windowLow");
69063
+ updateGuiImageWindowLowOnChange(value);
69065
69064
  })
69066
69065
  .onFinishChange(() => {
69067
69066
  repraintAllContrastSlices(configs.protectedData.displaySlices);
@@ -69119,7 +69118,11 @@ function setupGui(configs) {
69119
69118
  configs.clearStoreImages();
69120
69119
  }
69121
69120
  };
69122
- const updateGuiImageContrastOnChange = (value) => {
69121
+ const updateGuiImageWindowLowOnChange = (value) => {
69122
+ configs.gui_states.readyToUpdate = false;
69123
+ configs.updateSlicesContrast(value, "windowLow");
69124
+ };
69125
+ const updateGuiImageWindowHighOnChange = (value) => {
69123
69126
  configs.gui_states.readyToUpdate = false;
69124
69127
  configs.updateSlicesContrast(value, "windowHigh");
69125
69128
  };
@@ -69167,11 +69170,20 @@ function setupGui(configs) {
69167
69170
  },
69168
69171
  windowHigh: {
69169
69172
  name: "ImageContrast",
69170
- value: configs.mainPreSlices.volume,
69171
- min: configs.mainPreSlices.volume.min,
69172
- max: configs.mainPreSlices.volume.max,
69173
+ value: null,
69174
+ min: 0,
69175
+ max: 0,
69173
69176
  step: 1,
69174
- onChange: updateGuiImageContrastOnChange,
69177
+ onChange: updateGuiImageWindowHighOnChange,
69178
+ onFinished: updateGuiImageContrastOnFinished,
69179
+ },
69180
+ windowLow: {
69181
+ name: "WindowLow",
69182
+ value: null,
69183
+ min: 0,
69184
+ max: 0,
69185
+ step: 1,
69186
+ onChange: updateGuiImageWindowLowOnChange,
69175
69187
  onFinished: updateGuiImageContrastOnFinished,
69176
69188
  },
69177
69189
  advance: {
@@ -69375,7 +69387,21 @@ class DragOperator {
69375
69387
  }
69376
69388
  });
69377
69389
  this.container.addEventListener("keyup", (ev) => {
69390
+ if (ev.key === 'Control' || ev.key === 'Meta') {
69391
+ /**
69392
+ * if ctrl pressed remove the drag mode
69393
+ */
69394
+ if (this.protectedData.Is_Ctrl_Pressed) {
69395
+ this.removeDragMode();
69396
+ }
69397
+ else {
69398
+ this.configDragMode();
69399
+ }
69400
+ }
69378
69401
  if (ev.key === "Shift" && !this.gui_states.sphere) {
69402
+ if (this.protectedData.Is_Ctrl_Pressed) {
69403
+ return;
69404
+ }
69379
69405
  this.configDragMode();
69380
69406
  }
69381
69407
  });
@@ -69651,6 +69677,7 @@ class CommToolsData {
69651
69677
  currentShowingSlice: undefined,
69652
69678
  mainPreSlices: undefined,
69653
69679
  Is_Shift_Pressed: false,
69680
+ Is_Ctrl_Pressed: false,
69654
69681
  Is_Draw: false,
69655
69682
  axis: "z",
69656
69683
  maskData: {
@@ -69801,6 +69828,18 @@ class DrawToolCore extends CommToolsData {
69801
69828
  handleZoomWheel: (e) => { },
69802
69829
  handleSphereWheel: (e) => { },
69803
69830
  };
69831
+ this.contrastEventPrameters = {
69832
+ move_x: 0,
69833
+ move_y: 0,
69834
+ x: 0,
69835
+ y: 0,
69836
+ w: 0,
69837
+ h: 0,
69838
+ handleOnContrastMouseDown: (ev) => { },
69839
+ handleOnContrastMouseMove: (ev) => { },
69840
+ handleOnContrastMouseUp: (ev) => { },
69841
+ handleOnContrastMouseLeave: (ev) => { },
69842
+ };
69804
69843
  this.eraserUrls = [];
69805
69844
  this.pencilUrls = [];
69806
69845
  this.undoArray = [];
@@ -69814,13 +69853,31 @@ class DrawToolCore extends CommToolsData {
69814
69853
  this.protectedData.ctxes.drawingCtx.strokeStyle = this.gui_states.color;
69815
69854
  this.protectedData.ctxes.drawingCtx.stroke();
69816
69855
  };
69856
+ this.configContrastDragMode = () => {
69857
+ this.container.style.cursor = "pointer";
69858
+ this.container.addEventListener("pointerdown", this.contrastEventPrameters.handleOnContrastMouseDown, true);
69859
+ this.container.addEventListener("pointerup", this.contrastEventPrameters.handleOnContrastMouseUp, true);
69860
+ };
69861
+ this.removeContrastDragMode = () => {
69862
+ this.container.style.cursor = "";
69863
+ this.container.removeEventListener("pointerdown", this.contrastEventPrameters.handleOnContrastMouseDown, true);
69864
+ this.container.removeEventListener("pointermove", this.contrastEventPrameters.handleOnContrastMouseMove, true);
69865
+ this.container.removeEventListener("pointerup", this.contrastEventPrameters.handleOnContrastMouseUp, true);
69866
+ this.container.removeEventListener("pointerleave", this.contrastEventPrameters.handleOnContrastMouseLeave, true);
69867
+ this.setIsDrawFalse(1000);
69868
+ };
69817
69869
  this.container = container;
69818
69870
  this.mainAreaContainer = mainAreaContainer;
69819
69871
  this.initDrawToolCore();
69820
69872
  }
69821
69873
  initDrawToolCore() {
69874
+ let undoFlag = false;
69822
69875
  this.container.addEventListener("keydown", (ev) => {
69823
69876
  if (ev.key === "Shift" && !this.gui_states.sphere) {
69877
+ if (this.protectedData.Is_Ctrl_Pressed) {
69878
+ this.protectedData.Is_Shift_Pressed = false;
69879
+ return;
69880
+ }
69824
69881
  this.protectedData.Is_Shift_Pressed = true;
69825
69882
  this.nrrd_states.enableCursorChoose = false;
69826
69883
  }
@@ -69829,8 +69886,29 @@ class DrawToolCore extends CommToolsData {
69829
69886
  this.nrrd_states.enableCursorChoose =
69830
69887
  !this.nrrd_states.enableCursorChoose;
69831
69888
  }
69889
+ if ((ev.ctrlKey || ev.metaKey) && ev.code === "KeyZ") {
69890
+ undoFlag = true;
69891
+ this.undoLastPainting();
69892
+ }
69832
69893
  });
69833
69894
  this.container.addEventListener("keyup", (ev) => {
69895
+ if (ev.key === 'Control' || ev.key === 'Meta') {
69896
+ if (undoFlag) {
69897
+ this.gui_states.readyToUpdate = true;
69898
+ undoFlag = false;
69899
+ return;
69900
+ }
69901
+ // Ctrl key pressed on either Windows or macOS
69902
+ this.protectedData.Is_Shift_Pressed = false;
69903
+ this.protectedData.Is_Ctrl_Pressed = !this.protectedData.Is_Ctrl_Pressed;
69904
+ if (this.protectedData.Is_Ctrl_Pressed) {
69905
+ this.configContrastDragMode();
69906
+ }
69907
+ else {
69908
+ this.removeContrastDragMode();
69909
+ this.gui_states.readyToUpdate = true;
69910
+ }
69911
+ }
69834
69912
  if (ev.key === "Shift") {
69835
69913
  this.protectedData.Is_Shift_Pressed = false;
69836
69914
  }
@@ -70192,6 +70270,7 @@ class DrawToolCore extends CommToolsData {
70192
70270
  }
70193
70271
  else {
70194
70272
  if (this.protectedData.Is_Shift_Pressed) {
70273
+ console.log("draw");
70195
70274
  if (!this.gui_states.segmentation &&
70196
70275
  !this.gui_states.Eraser &&
70197
70276
  this.nrrd_states.Mouse_Over) {
@@ -70219,11 +70298,6 @@ class DrawToolCore extends CommToolsData {
70219
70298
  this.redrawDisplayCanvas();
70220
70299
  }
70221
70300
  };
70222
- document.addEventListener("keydown", (e) => {
70223
- if ((e.ctrlKey || e.metaKey) && e.code === "KeyZ") {
70224
- this.undoLastPainting();
70225
- }
70226
- });
70227
70301
  }
70228
70302
  drawLinesOnLayer(ctx, x, y) {
70229
70303
  ctx.beginPath();
@@ -70933,6 +71007,46 @@ class DrawToolCore extends CommToolsData {
70933
71007
  return sharedPlaceImages;
70934
71008
  }
70935
71009
  /******************************** Utils gui related functions ***************************************/
71010
+ /**
71011
+ * Set up root container events fns for drag function
71012
+ * @param callback
71013
+ */
71014
+ setupConrastEvents(callback) {
71015
+ this.contrastEventPrameters.w = this.container.offsetWidth;
71016
+ this.contrastEventPrameters.h = this.container.offsetHeight;
71017
+ this.contrastEventPrameters.handleOnContrastMouseDown = (ev) => {
71018
+ if (ev.button === 0) {
71019
+ this.contrastEventPrameters.x = ev.offsetX / this.contrastEventPrameters.x;
71020
+ this.contrastEventPrameters.y = ev.offsetY / this.contrastEventPrameters.h;
71021
+ this.container.addEventListener("pointermove", this.contrastEventPrameters.handleOnContrastMouseMove);
71022
+ }
71023
+ };
71024
+ this.contrastEventPrameters.handleOnContrastMouseUp = (ev) => {
71025
+ this.container.removeEventListener("pointermove", this.contrastEventPrameters.handleOnContrastMouseMove);
71026
+ };
71027
+ this.contrastEventPrameters.handleOnContrastMouseMove = throttle((ev) => {
71028
+ if (this.contrastEventPrameters.y - ev.offsetY / this.contrastEventPrameters.h >= 0) {
71029
+ this.contrastEventPrameters.move_y = -Math.ceil((this.contrastEventPrameters.y - ev.offsetY / this.contrastEventPrameters.h) * 10);
71030
+ }
71031
+ else {
71032
+ this.contrastEventPrameters.move_y = -Math.floor((this.contrastEventPrameters.y - ev.offsetY / this.contrastEventPrameters.h) * 10);
71033
+ }
71034
+ if (this.contrastEventPrameters.move_y !== 0 && Math.abs(this.contrastEventPrameters.move_y) === 1) {
71035
+ callback(this.contrastEventPrameters.move_y, "vertical");
71036
+ }
71037
+ if (this.contrastEventPrameters.x - ev.offsetX / this.contrastEventPrameters.w >= 0) {
71038
+ this.contrastEventPrameters.move_x = -Math.ceil((this.contrastEventPrameters.x - ev.offsetX / this.contrastEventPrameters.w) * 10);
71039
+ }
71040
+ else {
71041
+ this.contrastEventPrameters.move_x = -Math.floor((this.contrastEventPrameters.x - ev.offsetX / this.contrastEventPrameters.w) * 10);
71042
+ }
71043
+ if (this.contrastEventPrameters.move_x !== 0 && Math.abs(this.contrastEventPrameters.move_x) === 1) {
71044
+ callback(this.contrastEventPrameters.move_x, "horizental");
71045
+ }
71046
+ this.contrastEventPrameters.x = ev.offsetX / this.contrastEventPrameters.w;
71047
+ this.contrastEventPrameters.y = ev.offsetY / this.contrastEventPrameters.h;
71048
+ }, 100);
71049
+ }
70936
71050
  updateSlicesContrast(value, flag) {
70937
71051
  switch (flag) {
70938
71052
  case "lowerThreshold":
@@ -71013,6 +71127,13 @@ class NrrdTools extends DrawToolCore {
71013
71127
  setDisplaySliceIndexPanel(panel) {
71014
71128
  this.dragOperator.setShowDragNumberDiv(panel);
71015
71129
  }
71130
+ /**
71131
+ * Enable the drag function for contrast images window center and window high.
71132
+ * @param callback
71133
+ */
71134
+ enableContrastDragEvents(callback) {
71135
+ this.setupConrastEvents(callback);
71136
+ }
71016
71137
  /**
71017
71138
  * Set up GUI for drawing panel
71018
71139
  * @param gui GUI
@@ -71067,6 +71188,12 @@ class NrrdTools extends DrawToolCore {
71067
71188
  this.guiParameterSettings = setupGui(guiOptions);
71068
71189
  }
71069
71190
  getGuiSettings() {
71191
+ if (!!this.guiParameterSettings) {
71192
+ // update image volume
71193
+ this.guiParameterSettings.windowHigh.value = this.guiParameterSettings.windowLow.value = this.protectedData.mainPreSlices.volume;
71194
+ this.guiParameterSettings.windowHigh.max = this.guiParameterSettings.windowLow.max = this.protectedData.mainPreSlices.volume.max;
71195
+ this.guiParameterSettings.windowHigh.min = this.guiParameterSettings.windowLow.min = this.protectedData.mainPreSlices.volume.min;
71196
+ }
71070
71197
  return {
71071
71198
  guiState: this.gui_states,
71072
71199
  guiSetting: this.guiParameterSettings,
@@ -72054,7 +72181,7 @@ function evaluateElement(element, weights) {
72054
72181
  }
72055
72182
 
72056
72183
  // import * as kiwrious from "copper3d_plugin_heart_k";
72057
- const REVISION = "v2.0.6";
72058
- console.log("%cCopper3D Visualisation %cBeta:v2.0.6", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
72184
+ const REVISION = "v2.0.7";
72185
+ console.log("%cCopper3D Visualisation %cBeta:v2.0.7", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
72059
72186
 
72060
72187
  export { CameraViewPoint, Copper3dTrackballControls, MeshNodeTool, NrrdTools, REVISION, addBoxHelper, addLabelToScene, configKiwriousHeart, convert3DPostoScreenPos, convertScreenPosto3DPos, copperMScene, copperMSceneRenderer, copperRenderer, copperRendererOnDemond, copperScene, copperSceneOnDemond, createTexture2D_NRRD, fullScreenListenner, kiwrious, loading, removeGuiFolderChilden, setHDRFilePath, throttle };
@@ -48383,7 +48383,7 @@
48383
48383
  (xhr) => { },
48384
48384
  // called when loading has errors
48385
48385
  (error) => {
48386
- console.log("An error happened");
48386
+ console.log("An error happened: ", error);
48387
48387
  });
48388
48388
  }
48389
48389
  }
@@ -68974,7 +68974,7 @@
68974
68974
  .add(configs.mainPreSlices.volume, "windowHigh", configs.mainPreSlices.volume.min, configs.mainPreSlices.volume.max, 1)
68975
68975
  .name("ImageContrast")
68976
68976
  .onChange((value) => {
68977
- updateGuiImageContrastOnChange(value);
68977
+ updateGuiImageWindowHighOnChange(value);
68978
68978
  })
68979
68979
  .onFinishChange(() => {
68980
68980
  updateGuiImageContrastOnFinished();
@@ -69068,8 +69068,7 @@
69068
69068
  .add(configs.mainPreSlices.volume, "windowLow", configs.mainPreSlices.volume.min, configs.mainPreSlices.volume.max, 1)
69069
69069
  .name("WindowLow")
69070
69070
  .onChange((value) => {
69071
- configs.gui_states.readyToUpdate = false;
69072
- configs.updateSlicesContrast(value, "windowLow");
69071
+ updateGuiImageWindowLowOnChange(value);
69073
69072
  })
69074
69073
  .onFinishChange(() => {
69075
69074
  repraintAllContrastSlices(configs.protectedData.displaySlices);
@@ -69127,7 +69126,11 @@
69127
69126
  configs.clearStoreImages();
69128
69127
  }
69129
69128
  };
69130
- const updateGuiImageContrastOnChange = (value) => {
69129
+ const updateGuiImageWindowLowOnChange = (value) => {
69130
+ configs.gui_states.readyToUpdate = false;
69131
+ configs.updateSlicesContrast(value, "windowLow");
69132
+ };
69133
+ const updateGuiImageWindowHighOnChange = (value) => {
69131
69134
  configs.gui_states.readyToUpdate = false;
69132
69135
  configs.updateSlicesContrast(value, "windowHigh");
69133
69136
  };
@@ -69175,11 +69178,20 @@
69175
69178
  },
69176
69179
  windowHigh: {
69177
69180
  name: "ImageContrast",
69178
- value: configs.mainPreSlices.volume,
69179
- min: configs.mainPreSlices.volume.min,
69180
- max: configs.mainPreSlices.volume.max,
69181
+ value: null,
69182
+ min: 0,
69183
+ max: 0,
69181
69184
  step: 1,
69182
- onChange: updateGuiImageContrastOnChange,
69185
+ onChange: updateGuiImageWindowHighOnChange,
69186
+ onFinished: updateGuiImageContrastOnFinished,
69187
+ },
69188
+ windowLow: {
69189
+ name: "WindowLow",
69190
+ value: null,
69191
+ min: 0,
69192
+ max: 0,
69193
+ step: 1,
69194
+ onChange: updateGuiImageWindowLowOnChange,
69183
69195
  onFinished: updateGuiImageContrastOnFinished,
69184
69196
  },
69185
69197
  advance: {
@@ -69383,7 +69395,21 @@
69383
69395
  }
69384
69396
  });
69385
69397
  this.container.addEventListener("keyup", (ev) => {
69398
+ if (ev.key === 'Control' || ev.key === 'Meta') {
69399
+ /**
69400
+ * if ctrl pressed remove the drag mode
69401
+ */
69402
+ if (this.protectedData.Is_Ctrl_Pressed) {
69403
+ this.removeDragMode();
69404
+ }
69405
+ else {
69406
+ this.configDragMode();
69407
+ }
69408
+ }
69386
69409
  if (ev.key === "Shift" && !this.gui_states.sphere) {
69410
+ if (this.protectedData.Is_Ctrl_Pressed) {
69411
+ return;
69412
+ }
69387
69413
  this.configDragMode();
69388
69414
  }
69389
69415
  });
@@ -69659,6 +69685,7 @@
69659
69685
  currentShowingSlice: undefined,
69660
69686
  mainPreSlices: undefined,
69661
69687
  Is_Shift_Pressed: false,
69688
+ Is_Ctrl_Pressed: false,
69662
69689
  Is_Draw: false,
69663
69690
  axis: "z",
69664
69691
  maskData: {
@@ -69809,6 +69836,18 @@
69809
69836
  handleZoomWheel: (e) => { },
69810
69837
  handleSphereWheel: (e) => { },
69811
69838
  };
69839
+ this.contrastEventPrameters = {
69840
+ move_x: 0,
69841
+ move_y: 0,
69842
+ x: 0,
69843
+ y: 0,
69844
+ w: 0,
69845
+ h: 0,
69846
+ handleOnContrastMouseDown: (ev) => { },
69847
+ handleOnContrastMouseMove: (ev) => { },
69848
+ handleOnContrastMouseUp: (ev) => { },
69849
+ handleOnContrastMouseLeave: (ev) => { },
69850
+ };
69812
69851
  this.eraserUrls = [];
69813
69852
  this.pencilUrls = [];
69814
69853
  this.undoArray = [];
@@ -69822,13 +69861,31 @@
69822
69861
  this.protectedData.ctxes.drawingCtx.strokeStyle = this.gui_states.color;
69823
69862
  this.protectedData.ctxes.drawingCtx.stroke();
69824
69863
  };
69864
+ this.configContrastDragMode = () => {
69865
+ this.container.style.cursor = "pointer";
69866
+ this.container.addEventListener("pointerdown", this.contrastEventPrameters.handleOnContrastMouseDown, true);
69867
+ this.container.addEventListener("pointerup", this.contrastEventPrameters.handleOnContrastMouseUp, true);
69868
+ };
69869
+ this.removeContrastDragMode = () => {
69870
+ this.container.style.cursor = "";
69871
+ this.container.removeEventListener("pointerdown", this.contrastEventPrameters.handleOnContrastMouseDown, true);
69872
+ this.container.removeEventListener("pointermove", this.contrastEventPrameters.handleOnContrastMouseMove, true);
69873
+ this.container.removeEventListener("pointerup", this.contrastEventPrameters.handleOnContrastMouseUp, true);
69874
+ this.container.removeEventListener("pointerleave", this.contrastEventPrameters.handleOnContrastMouseLeave, true);
69875
+ this.setIsDrawFalse(1000);
69876
+ };
69825
69877
  this.container = container;
69826
69878
  this.mainAreaContainer = mainAreaContainer;
69827
69879
  this.initDrawToolCore();
69828
69880
  }
69829
69881
  initDrawToolCore() {
69882
+ let undoFlag = false;
69830
69883
  this.container.addEventListener("keydown", (ev) => {
69831
69884
  if (ev.key === "Shift" && !this.gui_states.sphere) {
69885
+ if (this.protectedData.Is_Ctrl_Pressed) {
69886
+ this.protectedData.Is_Shift_Pressed = false;
69887
+ return;
69888
+ }
69832
69889
  this.protectedData.Is_Shift_Pressed = true;
69833
69890
  this.nrrd_states.enableCursorChoose = false;
69834
69891
  }
@@ -69837,8 +69894,29 @@
69837
69894
  this.nrrd_states.enableCursorChoose =
69838
69895
  !this.nrrd_states.enableCursorChoose;
69839
69896
  }
69897
+ if ((ev.ctrlKey || ev.metaKey) && ev.code === "KeyZ") {
69898
+ undoFlag = true;
69899
+ this.undoLastPainting();
69900
+ }
69840
69901
  });
69841
69902
  this.container.addEventListener("keyup", (ev) => {
69903
+ if (ev.key === 'Control' || ev.key === 'Meta') {
69904
+ if (undoFlag) {
69905
+ this.gui_states.readyToUpdate = true;
69906
+ undoFlag = false;
69907
+ return;
69908
+ }
69909
+ // Ctrl key pressed on either Windows or macOS
69910
+ this.protectedData.Is_Shift_Pressed = false;
69911
+ this.protectedData.Is_Ctrl_Pressed = !this.protectedData.Is_Ctrl_Pressed;
69912
+ if (this.protectedData.Is_Ctrl_Pressed) {
69913
+ this.configContrastDragMode();
69914
+ }
69915
+ else {
69916
+ this.removeContrastDragMode();
69917
+ this.gui_states.readyToUpdate = true;
69918
+ }
69919
+ }
69842
69920
  if (ev.key === "Shift") {
69843
69921
  this.protectedData.Is_Shift_Pressed = false;
69844
69922
  }
@@ -70200,6 +70278,7 @@
70200
70278
  }
70201
70279
  else {
70202
70280
  if (this.protectedData.Is_Shift_Pressed) {
70281
+ console.log("draw");
70203
70282
  if (!this.gui_states.segmentation &&
70204
70283
  !this.gui_states.Eraser &&
70205
70284
  this.nrrd_states.Mouse_Over) {
@@ -70227,11 +70306,6 @@
70227
70306
  this.redrawDisplayCanvas();
70228
70307
  }
70229
70308
  };
70230
- document.addEventListener("keydown", (e) => {
70231
- if ((e.ctrlKey || e.metaKey) && e.code === "KeyZ") {
70232
- this.undoLastPainting();
70233
- }
70234
- });
70235
70309
  }
70236
70310
  drawLinesOnLayer(ctx, x, y) {
70237
70311
  ctx.beginPath();
@@ -70941,6 +71015,46 @@
70941
71015
  return sharedPlaceImages;
70942
71016
  }
70943
71017
  /******************************** Utils gui related functions ***************************************/
71018
+ /**
71019
+ * Set up root container events fns for drag function
71020
+ * @param callback
71021
+ */
71022
+ setupConrastEvents(callback) {
71023
+ this.contrastEventPrameters.w = this.container.offsetWidth;
71024
+ this.contrastEventPrameters.h = this.container.offsetHeight;
71025
+ this.contrastEventPrameters.handleOnContrastMouseDown = (ev) => {
71026
+ if (ev.button === 0) {
71027
+ this.contrastEventPrameters.x = ev.offsetX / this.contrastEventPrameters.x;
71028
+ this.contrastEventPrameters.y = ev.offsetY / this.contrastEventPrameters.h;
71029
+ this.container.addEventListener("pointermove", this.contrastEventPrameters.handleOnContrastMouseMove);
71030
+ }
71031
+ };
71032
+ this.contrastEventPrameters.handleOnContrastMouseUp = (ev) => {
71033
+ this.container.removeEventListener("pointermove", this.contrastEventPrameters.handleOnContrastMouseMove);
71034
+ };
71035
+ this.contrastEventPrameters.handleOnContrastMouseMove = throttle((ev) => {
71036
+ if (this.contrastEventPrameters.y - ev.offsetY / this.contrastEventPrameters.h >= 0) {
71037
+ this.contrastEventPrameters.move_y = -Math.ceil((this.contrastEventPrameters.y - ev.offsetY / this.contrastEventPrameters.h) * 10);
71038
+ }
71039
+ else {
71040
+ this.contrastEventPrameters.move_y = -Math.floor((this.contrastEventPrameters.y - ev.offsetY / this.contrastEventPrameters.h) * 10);
71041
+ }
71042
+ if (this.contrastEventPrameters.move_y !== 0 && Math.abs(this.contrastEventPrameters.move_y) === 1) {
71043
+ callback(this.contrastEventPrameters.move_y, "vertical");
71044
+ }
71045
+ if (this.contrastEventPrameters.x - ev.offsetX / this.contrastEventPrameters.w >= 0) {
71046
+ this.contrastEventPrameters.move_x = -Math.ceil((this.contrastEventPrameters.x - ev.offsetX / this.contrastEventPrameters.w) * 10);
71047
+ }
71048
+ else {
71049
+ this.contrastEventPrameters.move_x = -Math.floor((this.contrastEventPrameters.x - ev.offsetX / this.contrastEventPrameters.w) * 10);
71050
+ }
71051
+ if (this.contrastEventPrameters.move_x !== 0 && Math.abs(this.contrastEventPrameters.move_x) === 1) {
71052
+ callback(this.contrastEventPrameters.move_x, "horizental");
71053
+ }
71054
+ this.contrastEventPrameters.x = ev.offsetX / this.contrastEventPrameters.w;
71055
+ this.contrastEventPrameters.y = ev.offsetY / this.contrastEventPrameters.h;
71056
+ }, 100);
71057
+ }
70944
71058
  updateSlicesContrast(value, flag) {
70945
71059
  switch (flag) {
70946
71060
  case "lowerThreshold":
@@ -71021,6 +71135,13 @@
71021
71135
  setDisplaySliceIndexPanel(panel) {
71022
71136
  this.dragOperator.setShowDragNumberDiv(panel);
71023
71137
  }
71138
+ /**
71139
+ * Enable the drag function for contrast images window center and window high.
71140
+ * @param callback
71141
+ */
71142
+ enableContrastDragEvents(callback) {
71143
+ this.setupConrastEvents(callback);
71144
+ }
71024
71145
  /**
71025
71146
  * Set up GUI for drawing panel
71026
71147
  * @param gui GUI
@@ -71075,6 +71196,12 @@
71075
71196
  this.guiParameterSettings = setupGui(guiOptions);
71076
71197
  }
71077
71198
  getGuiSettings() {
71199
+ if (!!this.guiParameterSettings) {
71200
+ // update image volume
71201
+ this.guiParameterSettings.windowHigh.value = this.guiParameterSettings.windowLow.value = this.protectedData.mainPreSlices.volume;
71202
+ this.guiParameterSettings.windowHigh.max = this.guiParameterSettings.windowLow.max = this.protectedData.mainPreSlices.volume.max;
71203
+ this.guiParameterSettings.windowHigh.min = this.guiParameterSettings.windowLow.min = this.protectedData.mainPreSlices.volume.min;
71204
+ }
71078
71205
  return {
71079
71206
  guiState: this.gui_states,
71080
71207
  guiSetting: this.guiParameterSettings,
@@ -72062,8 +72189,8 @@
72062
72189
  }
72063
72190
 
72064
72191
  // import * as kiwrious from "copper3d_plugin_heart_k";
72065
- const REVISION = "v2.0.6";
72066
- console.log("%cCopper3D Visualisation %cBeta:v2.0.6", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
72192
+ const REVISION = "v2.0.7";
72193
+ console.log("%cCopper3D Visualisation %cBeta:v2.0.7", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
72067
72194
 
72068
72195
  exports.CameraViewPoint = CameraViewPoint;
72069
72196
  exports.Copper3dTrackballControls = Copper3dTrackballControls;
package/dist/index.d.ts CHANGED
@@ -19,6 +19,6 @@ import { removeGuiFolderChilden } from "./Utils/segmentation/coreTools/gui";
19
19
  import { nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, exportPaintImageType, IOptVTKLoader } from "./types/types";
20
20
  import { IPaintImage } from "./Utils/segmentation/coreTools/coreType";
21
21
  import "./css/style.css";
22
- export declare const REVISION = "v2.0.6";
22
+ export declare const REVISION = "v2.0.7";
23
23
  export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, NrrdTools, loading, Copper3dTrackballControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, };
24
24
  export type { positionType, screenPosType, optsType, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, };
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import { Copper3dTrackballControls } from "./Controls/Copper3dTrackballControls"
18
18
  import { MeshNodeTool } from "./Utils/MeshNodeTool";
19
19
  import { removeGuiFolderChilden } from "./Utils/segmentation/coreTools/gui";
20
20
  import "./css/style.css";
21
- export const REVISION = "v2.0.6";
22
- console.log("%cCopper3D Visualisation %cBeta:v2.0.6", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
21
+ export const REVISION = "v2.0.7";
22
+ console.log("%cCopper3D Visualisation %cBeta:v2.0.7", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
23
23
  export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, NrrdTools, loading, Copper3dTrackballControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, };
24
24
  //# sourceMappingURL=index.js.map
@@ -1,9 +1,10 @@
1
- import { IDrawingEvents, IDrawOpts, IPaintImage, IPaintImages, IUndoType } from "./coreTools/coreType";
1
+ import { IDrawingEvents, IContrastEvents, IDrawOpts, IPaintImage, IPaintImages, IUndoType } from "./coreTools/coreType";
2
2
  import { CommToolsData } from "./CommToolsData";
3
3
  export declare class DrawToolCore extends CommToolsData {
4
4
  container: HTMLElement;
5
5
  mainAreaContainer: HTMLDivElement;
6
6
  drawingPrameters: IDrawingEvents;
7
+ contrastEventPrameters: IContrastEvents;
7
8
  eraserUrls: string[];
8
9
  pencilUrls: string[];
9
10
  undoArray: Array<IUndoType>;
@@ -94,6 +95,13 @@ export declare class DrawToolCore extends CommToolsData {
94
95
  replaceArray(mainArr: number[] | Uint8ClampedArray, replaceArr: number[] | Uint8ClampedArray): void;
95
96
  findSliceInSharedPlace(): ImageData[];
96
97
  /******************************** Utils gui related functions ***************************************/
98
+ /**
99
+ * Set up root container events fns for drag function
100
+ * @param callback
101
+ */
102
+ setupConrastEvents(callback: (step: number, towards: "horizental" | "vertical") => void): void;
103
+ configContrastDragMode: () => void;
104
+ removeContrastDragMode: () => void;
97
105
  updateSlicesContrast(value: number, flag: string): void;
98
106
  repraintCurrentContrastSlice(): void;
99
107
  }
@@ -1,6 +1,6 @@
1
1
  import { nrrdSliceType, storeExportPaintImageType, loadingBarType } from "../../types/types";
2
2
  import { GUI } from "dat.gui";
3
- import { IStoredPaintImages, IMaskData, IDragOpts } from "./coreTools/coreType";
3
+ import { IStoredPaintImages, IMaskData, IDragOpts, IGuiParameterSettings } from "./coreTools/coreType";
4
4
  import { DragOperator } from "./DragOperator";
5
5
  import { DrawToolCore } from "./DrawToolCore";
6
6
  export declare class NrrdTools extends DrawToolCore {
@@ -23,6 +23,11 @@ export declare class NrrdTools extends DrawToolCore {
23
23
  */
24
24
  setBaseDrawDisplayCanvasesSize(size: number): void;
25
25
  setDisplaySliceIndexPanel(panel: HTMLDivElement): void;
26
+ /**
27
+ * Enable the drag function for contrast images window center and window high.
28
+ * @param callback
29
+ */
30
+ enableContrastDragEvents(callback: (step: number, towards: "horizental" | "vertical") => void): void;
26
31
  /**
27
32
  * Set up GUI for drawing panel
28
33
  * @param gui GUI
@@ -30,7 +35,7 @@ export declare class NrrdTools extends DrawToolCore {
30
35
  setupGUI(gui: GUI): void;
31
36
  getGuiSettings(): {
32
37
  guiState: import("./coreTools/coreType").IGUIStates;
33
- guiSetting: any;
38
+ guiSetting: IGuiParameterSettings | undefined;
34
39
  };
35
40
  /**
36
41
  * A initialise function for nrrd_tools