copper3d 2.0.6 → 2.0.7

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: {
@@ -69373,9 +69385,20 @@ class DragOperator {
69373
69385
  if (ev.key === "Shift") {
69374
69386
  this.removeDragMode();
69375
69387
  }
69388
+ if (ev.key === 'Control' || ev.key === 'Meta') {
69389
+ if (this.protectedData.Is_Ctrl_Pressed) {
69390
+ this.removeDragMode();
69391
+ }
69392
+ else {
69393
+ this.configDragMode();
69394
+ }
69395
+ }
69376
69396
  });
69377
69397
  this.container.addEventListener("keyup", (ev) => {
69378
69398
  if (ev.key === "Shift" && !this.gui_states.sphere) {
69399
+ if (this.protectedData.Is_Ctrl_Pressed) {
69400
+ return;
69401
+ }
69379
69402
  this.configDragMode();
69380
69403
  }
69381
69404
  });
@@ -69651,6 +69674,7 @@ class CommToolsData {
69651
69674
  currentShowingSlice: undefined,
69652
69675
  mainPreSlices: undefined,
69653
69676
  Is_Shift_Pressed: false,
69677
+ Is_Ctrl_Pressed: false,
69654
69678
  Is_Draw: false,
69655
69679
  axis: "z",
69656
69680
  maskData: {
@@ -69801,6 +69825,18 @@ class DrawToolCore extends CommToolsData {
69801
69825
  handleZoomWheel: (e) => { },
69802
69826
  handleSphereWheel: (e) => { },
69803
69827
  };
69828
+ this.contrastEventPrameters = {
69829
+ move_x: 0,
69830
+ move_y: 0,
69831
+ x: 0,
69832
+ y: 0,
69833
+ w: 0,
69834
+ h: 0,
69835
+ handleOnContrastMouseDown: (ev) => { },
69836
+ handleOnContrastMouseMove: (ev) => { },
69837
+ handleOnContrastMouseUp: (ev) => { },
69838
+ handleOnContrastMouseLeave: (ev) => { },
69839
+ };
69804
69840
  this.eraserUrls = [];
69805
69841
  this.pencilUrls = [];
69806
69842
  this.undoArray = [];
@@ -69814,6 +69850,19 @@ class DrawToolCore extends CommToolsData {
69814
69850
  this.protectedData.ctxes.drawingCtx.strokeStyle = this.gui_states.color;
69815
69851
  this.protectedData.ctxes.drawingCtx.stroke();
69816
69852
  };
69853
+ this.configContrastDragMode = () => {
69854
+ this.container.style.cursor = "pointer";
69855
+ this.container.addEventListener("pointerdown", this.contrastEventPrameters.handleOnContrastMouseDown, true);
69856
+ this.container.addEventListener("pointerup", this.contrastEventPrameters.handleOnContrastMouseUp, true);
69857
+ };
69858
+ this.removeContrastDragMode = () => {
69859
+ this.container.style.cursor = "";
69860
+ this.container.removeEventListener("pointerdown", this.contrastEventPrameters.handleOnContrastMouseDown, true);
69861
+ this.container.removeEventListener("pointermove", this.contrastEventPrameters.handleOnContrastMouseMove, true);
69862
+ this.container.removeEventListener("pointerup", this.contrastEventPrameters.handleOnContrastMouseUp, true);
69863
+ this.container.removeEventListener("pointerleave", this.contrastEventPrameters.handleOnContrastMouseLeave, true);
69864
+ this.setIsDrawFalse(1000);
69865
+ };
69817
69866
  this.container = container;
69818
69867
  this.mainAreaContainer = mainAreaContainer;
69819
69868
  this.initDrawToolCore();
@@ -69821,9 +69870,24 @@ class DrawToolCore extends CommToolsData {
69821
69870
  initDrawToolCore() {
69822
69871
  this.container.addEventListener("keydown", (ev) => {
69823
69872
  if (ev.key === "Shift" && !this.gui_states.sphere) {
69873
+ if (this.protectedData.Is_Ctrl_Pressed) {
69874
+ this.protectedData.Is_Shift_Pressed = false;
69875
+ return;
69876
+ }
69824
69877
  this.protectedData.Is_Shift_Pressed = true;
69825
69878
  this.nrrd_states.enableCursorChoose = false;
69826
69879
  }
69880
+ if (ev.key === 'Control' || ev.key === 'Meta') {
69881
+ // Ctrl key pressed on either Windows or macOS
69882
+ this.protectedData.Is_Shift_Pressed = false;
69883
+ this.protectedData.Is_Ctrl_Pressed = !this.protectedData.Is_Ctrl_Pressed;
69884
+ if (this.protectedData.Is_Ctrl_Pressed) {
69885
+ this.configContrastDragMode();
69886
+ }
69887
+ else {
69888
+ this.removeContrastDragMode();
69889
+ }
69890
+ }
69827
69891
  if (ev.key === "s") {
69828
69892
  this.protectedData.Is_Draw = false;
69829
69893
  this.nrrd_states.enableCursorChoose =
@@ -70933,6 +70997,46 @@ class DrawToolCore extends CommToolsData {
70933
70997
  return sharedPlaceImages;
70934
70998
  }
70935
70999
  /******************************** Utils gui related functions ***************************************/
71000
+ /**
71001
+ * Set up root container events fns for drag function
71002
+ * @param callback
71003
+ */
71004
+ setupConrastEvents(callback) {
71005
+ this.contrastEventPrameters.w = this.container.offsetWidth;
71006
+ this.contrastEventPrameters.h = this.container.offsetHeight;
71007
+ this.contrastEventPrameters.handleOnContrastMouseDown = (ev) => {
71008
+ if (ev.button === 0) {
71009
+ this.contrastEventPrameters.x = ev.offsetX / this.contrastEventPrameters.x;
71010
+ this.contrastEventPrameters.y = ev.offsetY / this.contrastEventPrameters.h;
71011
+ this.container.addEventListener("pointermove", this.contrastEventPrameters.handleOnContrastMouseMove);
71012
+ }
71013
+ };
71014
+ this.contrastEventPrameters.handleOnContrastMouseUp = (ev) => {
71015
+ this.container.removeEventListener("pointermove", this.contrastEventPrameters.handleOnContrastMouseMove);
71016
+ };
71017
+ this.contrastEventPrameters.handleOnContrastMouseMove = throttle((ev) => {
71018
+ if (this.contrastEventPrameters.y - ev.offsetY / this.contrastEventPrameters.h >= 0) {
71019
+ this.contrastEventPrameters.move_y = -Math.ceil((this.contrastEventPrameters.y - ev.offsetY / this.contrastEventPrameters.h) * 10);
71020
+ }
71021
+ else {
71022
+ this.contrastEventPrameters.move_y = -Math.floor((this.contrastEventPrameters.y - ev.offsetY / this.contrastEventPrameters.h) * 10);
71023
+ }
71024
+ if (this.contrastEventPrameters.move_y !== 0 && Math.abs(this.contrastEventPrameters.move_y) === 1) {
71025
+ callback(this.contrastEventPrameters.move_y, "vertical");
71026
+ }
71027
+ if (this.contrastEventPrameters.x - ev.offsetX / this.contrastEventPrameters.w >= 0) {
71028
+ this.contrastEventPrameters.move_x = -Math.ceil((this.contrastEventPrameters.x - ev.offsetX / this.contrastEventPrameters.w) * 10);
71029
+ }
71030
+ else {
71031
+ this.contrastEventPrameters.move_x = -Math.floor((this.contrastEventPrameters.x - ev.offsetX / this.contrastEventPrameters.w) * 10);
71032
+ }
71033
+ if (this.contrastEventPrameters.move_x !== 0 && Math.abs(this.contrastEventPrameters.move_x) === 1) {
71034
+ callback(this.contrastEventPrameters.move_x, "horizental");
71035
+ }
71036
+ this.contrastEventPrameters.x = ev.offsetX / this.contrastEventPrameters.w;
71037
+ this.contrastEventPrameters.y = ev.offsetY / this.contrastEventPrameters.h;
71038
+ }, 100);
71039
+ }
70936
71040
  updateSlicesContrast(value, flag) {
70937
71041
  switch (flag) {
70938
71042
  case "lowerThreshold":
@@ -71013,6 +71117,13 @@ class NrrdTools extends DrawToolCore {
71013
71117
  setDisplaySliceIndexPanel(panel) {
71014
71118
  this.dragOperator.setShowDragNumberDiv(panel);
71015
71119
  }
71120
+ /**
71121
+ * Enable the drag function for contrast images window center and window high.
71122
+ * @param callback
71123
+ */
71124
+ enableContrastDragEvents(callback) {
71125
+ this.setupConrastEvents(callback);
71126
+ }
71016
71127
  /**
71017
71128
  * Set up GUI for drawing panel
71018
71129
  * @param gui GUI
@@ -71067,6 +71178,12 @@ class NrrdTools extends DrawToolCore {
71067
71178
  this.guiParameterSettings = setupGui(guiOptions);
71068
71179
  }
71069
71180
  getGuiSettings() {
71181
+ if (!!this.guiParameterSettings) {
71182
+ // update image volume
71183
+ this.guiParameterSettings.windowHigh.value = this.guiParameterSettings.windowLow.value = this.protectedData.mainPreSlices.volume;
71184
+ this.guiParameterSettings.windowHigh.max = this.guiParameterSettings.windowLow.max = this.protectedData.mainPreSlices.volume.max;
71185
+ this.guiParameterSettings.windowHigh.min = this.guiParameterSettings.windowLow.min = this.protectedData.mainPreSlices.volume.min;
71186
+ }
71070
71187
  return {
71071
71188
  guiState: this.gui_states,
71072
71189
  guiSetting: this.guiParameterSettings,
@@ -72054,7 +72171,7 @@ function evaluateElement(element, weights) {
72054
72171
  }
72055
72172
 
72056
72173
  // 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");
72174
+ const REVISION = "v2.0.7";
72175
+ console.log("%cCopper3D Visualisation %cBeta:v2.0.7", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
72059
72176
 
72060
72177
  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: {
@@ -69381,9 +69393,20 @@
69381
69393
  if (ev.key === "Shift") {
69382
69394
  this.removeDragMode();
69383
69395
  }
69396
+ if (ev.key === 'Control' || ev.key === 'Meta') {
69397
+ if (this.protectedData.Is_Ctrl_Pressed) {
69398
+ this.removeDragMode();
69399
+ }
69400
+ else {
69401
+ this.configDragMode();
69402
+ }
69403
+ }
69384
69404
  });
69385
69405
  this.container.addEventListener("keyup", (ev) => {
69386
69406
  if (ev.key === "Shift" && !this.gui_states.sphere) {
69407
+ if (this.protectedData.Is_Ctrl_Pressed) {
69408
+ return;
69409
+ }
69387
69410
  this.configDragMode();
69388
69411
  }
69389
69412
  });
@@ -69659,6 +69682,7 @@
69659
69682
  currentShowingSlice: undefined,
69660
69683
  mainPreSlices: undefined,
69661
69684
  Is_Shift_Pressed: false,
69685
+ Is_Ctrl_Pressed: false,
69662
69686
  Is_Draw: false,
69663
69687
  axis: "z",
69664
69688
  maskData: {
@@ -69809,6 +69833,18 @@
69809
69833
  handleZoomWheel: (e) => { },
69810
69834
  handleSphereWheel: (e) => { },
69811
69835
  };
69836
+ this.contrastEventPrameters = {
69837
+ move_x: 0,
69838
+ move_y: 0,
69839
+ x: 0,
69840
+ y: 0,
69841
+ w: 0,
69842
+ h: 0,
69843
+ handleOnContrastMouseDown: (ev) => { },
69844
+ handleOnContrastMouseMove: (ev) => { },
69845
+ handleOnContrastMouseUp: (ev) => { },
69846
+ handleOnContrastMouseLeave: (ev) => { },
69847
+ };
69812
69848
  this.eraserUrls = [];
69813
69849
  this.pencilUrls = [];
69814
69850
  this.undoArray = [];
@@ -69822,6 +69858,19 @@
69822
69858
  this.protectedData.ctxes.drawingCtx.strokeStyle = this.gui_states.color;
69823
69859
  this.protectedData.ctxes.drawingCtx.stroke();
69824
69860
  };
69861
+ this.configContrastDragMode = () => {
69862
+ this.container.style.cursor = "pointer";
69863
+ this.container.addEventListener("pointerdown", this.contrastEventPrameters.handleOnContrastMouseDown, true);
69864
+ this.container.addEventListener("pointerup", this.contrastEventPrameters.handleOnContrastMouseUp, true);
69865
+ };
69866
+ this.removeContrastDragMode = () => {
69867
+ this.container.style.cursor = "";
69868
+ this.container.removeEventListener("pointerdown", this.contrastEventPrameters.handleOnContrastMouseDown, true);
69869
+ this.container.removeEventListener("pointermove", this.contrastEventPrameters.handleOnContrastMouseMove, true);
69870
+ this.container.removeEventListener("pointerup", this.contrastEventPrameters.handleOnContrastMouseUp, true);
69871
+ this.container.removeEventListener("pointerleave", this.contrastEventPrameters.handleOnContrastMouseLeave, true);
69872
+ this.setIsDrawFalse(1000);
69873
+ };
69825
69874
  this.container = container;
69826
69875
  this.mainAreaContainer = mainAreaContainer;
69827
69876
  this.initDrawToolCore();
@@ -69829,9 +69878,24 @@
69829
69878
  initDrawToolCore() {
69830
69879
  this.container.addEventListener("keydown", (ev) => {
69831
69880
  if (ev.key === "Shift" && !this.gui_states.sphere) {
69881
+ if (this.protectedData.Is_Ctrl_Pressed) {
69882
+ this.protectedData.Is_Shift_Pressed = false;
69883
+ return;
69884
+ }
69832
69885
  this.protectedData.Is_Shift_Pressed = true;
69833
69886
  this.nrrd_states.enableCursorChoose = false;
69834
69887
  }
69888
+ if (ev.key === 'Control' || ev.key === 'Meta') {
69889
+ // Ctrl key pressed on either Windows or macOS
69890
+ this.protectedData.Is_Shift_Pressed = false;
69891
+ this.protectedData.Is_Ctrl_Pressed = !this.protectedData.Is_Ctrl_Pressed;
69892
+ if (this.protectedData.Is_Ctrl_Pressed) {
69893
+ this.configContrastDragMode();
69894
+ }
69895
+ else {
69896
+ this.removeContrastDragMode();
69897
+ }
69898
+ }
69835
69899
  if (ev.key === "s") {
69836
69900
  this.protectedData.Is_Draw = false;
69837
69901
  this.nrrd_states.enableCursorChoose =
@@ -70941,6 +71005,46 @@
70941
71005
  return sharedPlaceImages;
70942
71006
  }
70943
71007
  /******************************** Utils gui related functions ***************************************/
71008
+ /**
71009
+ * Set up root container events fns for drag function
71010
+ * @param callback
71011
+ */
71012
+ setupConrastEvents(callback) {
71013
+ this.contrastEventPrameters.w = this.container.offsetWidth;
71014
+ this.contrastEventPrameters.h = this.container.offsetHeight;
71015
+ this.contrastEventPrameters.handleOnContrastMouseDown = (ev) => {
71016
+ if (ev.button === 0) {
71017
+ this.contrastEventPrameters.x = ev.offsetX / this.contrastEventPrameters.x;
71018
+ this.contrastEventPrameters.y = ev.offsetY / this.contrastEventPrameters.h;
71019
+ this.container.addEventListener("pointermove", this.contrastEventPrameters.handleOnContrastMouseMove);
71020
+ }
71021
+ };
71022
+ this.contrastEventPrameters.handleOnContrastMouseUp = (ev) => {
71023
+ this.container.removeEventListener("pointermove", this.contrastEventPrameters.handleOnContrastMouseMove);
71024
+ };
71025
+ this.contrastEventPrameters.handleOnContrastMouseMove = throttle((ev) => {
71026
+ if (this.contrastEventPrameters.y - ev.offsetY / this.contrastEventPrameters.h >= 0) {
71027
+ this.contrastEventPrameters.move_y = -Math.ceil((this.contrastEventPrameters.y - ev.offsetY / this.contrastEventPrameters.h) * 10);
71028
+ }
71029
+ else {
71030
+ this.contrastEventPrameters.move_y = -Math.floor((this.contrastEventPrameters.y - ev.offsetY / this.contrastEventPrameters.h) * 10);
71031
+ }
71032
+ if (this.contrastEventPrameters.move_y !== 0 && Math.abs(this.contrastEventPrameters.move_y) === 1) {
71033
+ callback(this.contrastEventPrameters.move_y, "vertical");
71034
+ }
71035
+ if (this.contrastEventPrameters.x - ev.offsetX / this.contrastEventPrameters.w >= 0) {
71036
+ this.contrastEventPrameters.move_x = -Math.ceil((this.contrastEventPrameters.x - ev.offsetX / this.contrastEventPrameters.w) * 10);
71037
+ }
71038
+ else {
71039
+ this.contrastEventPrameters.move_x = -Math.floor((this.contrastEventPrameters.x - ev.offsetX / this.contrastEventPrameters.w) * 10);
71040
+ }
71041
+ if (this.contrastEventPrameters.move_x !== 0 && Math.abs(this.contrastEventPrameters.move_x) === 1) {
71042
+ callback(this.contrastEventPrameters.move_x, "horizental");
71043
+ }
71044
+ this.contrastEventPrameters.x = ev.offsetX / this.contrastEventPrameters.w;
71045
+ this.contrastEventPrameters.y = ev.offsetY / this.contrastEventPrameters.h;
71046
+ }, 100);
71047
+ }
70944
71048
  updateSlicesContrast(value, flag) {
70945
71049
  switch (flag) {
70946
71050
  case "lowerThreshold":
@@ -71021,6 +71125,13 @@
71021
71125
  setDisplaySliceIndexPanel(panel) {
71022
71126
  this.dragOperator.setShowDragNumberDiv(panel);
71023
71127
  }
71128
+ /**
71129
+ * Enable the drag function for contrast images window center and window high.
71130
+ * @param callback
71131
+ */
71132
+ enableContrastDragEvents(callback) {
71133
+ this.setupConrastEvents(callback);
71134
+ }
71024
71135
  /**
71025
71136
  * Set up GUI for drawing panel
71026
71137
  * @param gui GUI
@@ -71075,6 +71186,12 @@
71075
71186
  this.guiParameterSettings = setupGui(guiOptions);
71076
71187
  }
71077
71188
  getGuiSettings() {
71189
+ if (!!this.guiParameterSettings) {
71190
+ // update image volume
71191
+ this.guiParameterSettings.windowHigh.value = this.guiParameterSettings.windowLow.value = this.protectedData.mainPreSlices.volume;
71192
+ this.guiParameterSettings.windowHigh.max = this.guiParameterSettings.windowLow.max = this.protectedData.mainPreSlices.volume.max;
71193
+ this.guiParameterSettings.windowHigh.min = this.guiParameterSettings.windowLow.min = this.protectedData.mainPreSlices.volume.min;
71194
+ }
71078
71195
  return {
71079
71196
  guiState: this.gui_states,
71080
71197
  guiSetting: this.guiParameterSettings,
@@ -72062,8 +72179,8 @@
72062
72179
  }
72063
72180
 
72064
72181
  // 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");
72182
+ const REVISION = "v2.0.7";
72183
+ console.log("%cCopper3D Visualisation %cBeta:v2.0.7", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
72067
72184
 
72068
72185
  exports.CameraViewPoint = CameraViewPoint;
72069
72186
  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