copper3d 1.15.7 → 1.15.9

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.
Files changed (44) hide show
  1. package/README.md +5 -2
  2. package/dist/Loader/copperDicomLoader.js +0 -2
  3. package/dist/Loader/copperDicomLoader.js.map +1 -1
  4. package/dist/Loader/copperNrrdLoader.js +1 -4
  5. package/dist/Loader/copperNrrdLoader.js.map +1 -1
  6. package/dist/Renderer/baseRenderer.d.ts +3 -3
  7. package/dist/Renderer/baseRenderer.js +9 -5
  8. package/dist/Renderer/baseRenderer.js.map +1 -1
  9. package/dist/Renderer/copperRenderer.d.ts +2 -2
  10. package/dist/Renderer/copperRenderer.js +6 -2
  11. package/dist/Renderer/copperRenderer.js.map +1 -1
  12. package/dist/Renderer/copperRendererOnDemond.d.ts +2 -2
  13. package/dist/Renderer/copperRendererOnDemond.js +0 -3
  14. package/dist/Renderer/copperRendererOnDemond.js.map +1 -1
  15. package/dist/Scene/baseScene.d.ts +2 -2
  16. package/dist/Scene/baseScene.js +8 -5
  17. package/dist/Scene/baseScene.js.map +1 -1
  18. package/dist/Scene/commonSceneMethod.d.ts +4 -2
  19. package/dist/Scene/commonSceneMethod.js +13 -8
  20. package/dist/Scene/commonSceneMethod.js.map +1 -1
  21. package/dist/Scene/copperScene.d.ts +2 -1
  22. package/dist/Scene/copperScene.js +5 -10
  23. package/dist/Scene/copperScene.js.map +1 -1
  24. package/dist/Utils/convet.js.map +1 -0
  25. package/dist/Utils/nrrd_tool.js +0 -2
  26. package/dist/Utils/nrrd_tool.js.map +1 -1
  27. package/dist/bundle.esm.js +42 -42
  28. package/dist/bundle.umd.js +42 -42
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +2 -2
  31. package/dist/types/Renderer/baseRenderer.d.ts +3 -3
  32. package/dist/types/Renderer/copperRenderer.d.ts +2 -2
  33. package/dist/types/Renderer/copperRendererOnDemond.d.ts +2 -2
  34. package/dist/types/Scene/baseScene.d.ts +2 -2
  35. package/dist/types/Scene/commonSceneMethod.d.ts +4 -2
  36. package/dist/types/Scene/copperScene.d.ts +2 -1
  37. package/dist/types/index.d.ts +1 -1
  38. package/dist/types/types/types.d.ts +11 -5
  39. package/dist/types/types.d.ts +11 -5
  40. package/package.json +1 -1
  41. package/dist/Loader/convet.js.map +0 -1
  42. /package/dist/{Loader → Utils}/convet.d.ts +0 -0
  43. /package/dist/{Loader → Utils}/convet.js +0 -0
  44. /package/dist/types/{Loader → Utils}/convet.d.ts +0 -0
@@ -38582,11 +38582,9 @@ function copperDicomLoader(url, callback) {
38582
38582
  loader$1.load(url, (arrayBuffer) => {
38583
38583
  var dicomFileAsBuffer = new Uint8Array(arrayBuffer);
38584
38584
  const dataSet = dicomParser.parseDicom(dicomFileAsBuffer);
38585
- // console.log(dataSet1);
38586
38585
  // const dataSet = dicomParser.parseDicom(dicomFileAsBuffer, {
38587
38586
  // vrCallback(tag) {
38588
38587
  // const formatted = `(${tag.substring(1, 5)},${tag.substring(5, 9)})`;
38589
- // // console.log(!!TAG_DICT[formatted] ? TAG_DICT[formatted].vr : undefined);
38590
38588
  // return !!TAG_DICT[formatted] ? TAG_DICT[formatted].vr : undefined;
38591
38589
  // },
38592
38590
  // });
@@ -44094,7 +44092,6 @@ function copperNrrdTexture3dLoader(url, scene, container, callback) {
44094
44092
  // 获取边界框的尺寸
44095
44093
  const size_ = new Vector3();
44096
44094
  boundingBox.getSize(size_);
44097
- console.log(size_);
44098
44095
  scene.add(mesh);
44099
44096
  const gui = new GUI$1();
44100
44097
  gui.add(volconfig, "clim1_g", -500, 500, 1).onChange((value) => {
@@ -44163,7 +44160,6 @@ function getWholeSlices(nrrdSlices, scene, gui, controls) {
44163
44160
  // nrrdSlices.z.index = i;
44164
44161
  // nrrdSlices.z.repaint(nrrdSlices.z);
44165
44162
  // nrrdSlices.z.mesh.position.set(0, 0, 0.5);
44166
- // console.log(nrrdSlices.z.mesh);
44167
44163
  // }, 100);
44168
44164
  // }
44169
44165
  let up = true;
@@ -44208,7 +44204,6 @@ function getWholeSlices(nrrdSlices, scene, gui, controls) {
44208
44204
  // }
44209
44205
  // if (slicesX[index]) {
44210
44206
  // controls.enabled = false;
44211
- // console.log(slicesX[index]);
44212
44207
  // slicesX[index].visible = false;
44213
44208
  // // ? (slicesX[index].visible = false)
44214
44209
  // // : (slicesX[index].visible = true);
@@ -46990,7 +46985,7 @@ class OrbitControls extends EventDispatcher {
46990
46985
  }
46991
46986
 
46992
46987
  class commonScene {
46993
- constructor(container) {
46988
+ constructor(container, opt) {
46994
46989
  this.subDiv = null;
46995
46990
  this.subScene = new Scene();
46996
46991
  this.subCamera = null;
@@ -47002,7 +46997,16 @@ class commonScene {
47002
46997
  this.pickableObjects = [];
47003
46998
  this.container = container;
47004
46999
  this.scene = new Scene();
47005
- this.camera = new PerspectiveCamera(75, container.clientWidth / container.clientHeight, 0.1, 500);
47000
+ this.copperPerspectiveCamera = new PerspectiveCamera(75, container.clientWidth / container.clientHeight, 0.1, 500);
47001
+ const h = 1024;
47002
+ const aspect = window.innerWidth / window.innerHeight;
47003
+ this.copperOrthographicCamera = new OrthographicCamera((-h * aspect) / 2, (h * aspect) / 2, h / 2, -h / 2, 1, 2000);
47004
+ if ((opt === null || opt === void 0 ? void 0 : opt.camera) === "orthographic") {
47005
+ this.camera = this.copperOrthographicCamera;
47006
+ }
47007
+ else {
47008
+ this.camera = this.copperPerspectiveCamera;
47009
+ }
47006
47010
  this.controls = new Copper3dTrackballControls(this.camera, this.container);
47007
47011
  this.controls.dispose();
47008
47012
  this.preRenderCallbackFunctions = {
@@ -47203,9 +47207,7 @@ class commonScene {
47203
47207
  }
47204
47208
  loadNrrdTexture3d(url, callback) {
47205
47209
  // const h = 512; // frustum height
47206
- const h = 1024;
47207
- const aspect = window.innerWidth / window.innerHeight;
47208
- this.camera = new OrthographicCamera((-h * aspect) / 2, (h * aspect) / 2, h / 2, -h / 2, 1, 2000);
47210
+ this.camera.updateProjectionMatrix();
47209
47211
  this.camera.position.set(0, 0, 1280);
47210
47212
  this.camera.up.set(0, 0, 1);
47211
47213
  this.camera.updateProjectionMatrix();
@@ -47226,9 +47228,7 @@ class commonScene {
47226
47228
  this.scene.add(obj);
47227
47229
  !!callback && callback(obj);
47228
47230
  }, // called when loading is in progresses
47229
- (xhr) => {
47230
- // console.log((xhr.loaded / xhr.total) * 100 + "% loaded");
47231
- },
47231
+ (xhr) => { },
47232
47232
  // called when loading has errors
47233
47233
  (error) => {
47234
47234
  console.log("An error happened");
@@ -47238,8 +47238,8 @@ class commonScene {
47238
47238
 
47239
47239
  const IS_IOS = isIOS();
47240
47240
  class baseScene extends commonScene {
47241
- constructor(container, renderer, alpha) {
47242
- super(container);
47241
+ constructor(container, renderer, opt) {
47242
+ super(container, opt);
47243
47243
  // scene: THREE.Scene;
47244
47244
  // camera: THREE.PerspectiveCamera;
47245
47245
  this.sceneName = "";
@@ -47253,18 +47253,20 @@ class baseScene extends commonScene {
47253
47253
  this.lights = [];
47254
47254
  this.onWindowResize = () => {
47255
47255
  var _a;
47256
- console.log("adaa");
47257
47256
  this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
47258
47257
  this.onRenderCameraChange();
47259
47258
  (_a = this.vignette) === null || _a === void 0 ? void 0 : _a.style({
47260
47259
  aspect: this.camera.aspect,
47261
47260
  });
47261
+ if (this.controls instanceof Copper3dTrackballControls) {
47262
+ this.controls.handleResize();
47263
+ }
47262
47264
  this.renderer.setSize(this.container.clientWidth, this.container.clientHeight);
47263
47265
  };
47264
47266
  this.renderer = renderer;
47265
47267
  this.ambientLight = new AmbientLight(0x202020, 0.3);
47266
47268
  this.directionalLight = new DirectionalLight(0xffffff, 0.3);
47267
- if (!alpha) {
47269
+ if (!(opt === null || opt === void 0 ? void 0 : opt.alpha)) {
47268
47270
  this.vignette = createBackground({
47269
47271
  aspect: this.container.clientWidth / this.container.clientHeight,
47270
47272
  grainScale: IS_IOS ? 0 : 0.001,
@@ -47279,7 +47281,7 @@ class baseScene extends commonScene {
47279
47281
  init() {
47280
47282
  this.copperControl.setCameraViewPoint();
47281
47283
  this.camera.position.z = 2;
47282
- this.scene.add(this.camera);
47284
+ // this.scene.add(this.camera);
47283
47285
  this.renderer.setSize(this.container.clientWidth, this.container.clientHeight);
47284
47286
  this.addLights();
47285
47287
  }
@@ -48089,10 +48091,14 @@ class baseRenderer {
48089
48091
  this.pmremGenerator.compileEquirectangularShader();
48090
48092
  this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
48091
48093
  if (!!((_b = this.options) === null || _b === void 0 ? void 0 : _b.alpha)) {
48092
- this.currentScene = new baseScene(this.container, this.renderer, true);
48094
+ this.currentScene = new baseScene(this.container, this.renderer, {
48095
+ alpha: true,
48096
+ });
48093
48097
  }
48094
48098
  else {
48095
- this.currentScene = new baseScene(this.container, this.renderer, false);
48099
+ this.currentScene = new baseScene(this.container, this.renderer, {
48100
+ alpha: false,
48101
+ });
48096
48102
  }
48097
48103
  this.currentScene.sceneName = "default";
48098
48104
  !!this.currentScene.vignette &&
@@ -48177,11 +48183,11 @@ class baseRenderer {
48177
48183
  bgColor1Ctrl.onChange(() => this.currentScene.updateBackground(this.state.bgColor1, this.state.bgColor2));
48178
48184
  bgColor2Ctrl.onChange(() => this.currentScene.updateBackground(this.state.bgColor1, this.state.bgColor2));
48179
48185
  // camera
48180
- if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.camera) {
48186
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.cameraGui) {
48181
48187
  this.cameraFolder = gui.addFolder("Camera");
48182
48188
  }
48183
48189
  // Performance
48184
- if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.performance) {
48190
+ if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.performanceGui) {
48185
48191
  const perfFolder = gui.addFolder("Performance");
48186
48192
  const perfLi = document.createElement("li");
48187
48193
  this.stats.dom.style.position = "static";
@@ -48190,7 +48196,7 @@ class baseRenderer {
48190
48196
  perfFolder.__ul.appendChild(perfLi);
48191
48197
  }
48192
48198
  // lights
48193
- if ((_c = this.options) === null || _c === void 0 ? void 0 : _c.light) {
48199
+ if ((_c = this.options) === null || _c === void 0 ? void 0 : _c.lightGui) {
48194
48200
  const lightFolder = gui.addFolder("LightsFolder");
48195
48201
  [
48196
48202
  lightFolder.add(this.state, "addLights").listen(),
@@ -56235,11 +56241,8 @@ class TrackballControls extends EventDispatcher {
56235
56241
  }
56236
56242
 
56237
56243
  class copperScene extends baseScene {
56238
- // private preRenderCallbackFunctions: Array<preRenderCallbackFunctionType> = [];
56239
- // private preRenderCallbackFunctions: preRenderCallbackFunctionType;
56240
- // private sort: boolean = true; //default ascending order
56241
- constructor(container, renderer, controls, alpha) {
56242
- super(container, renderer, alpha);
56244
+ constructor(container, renderer, opt) {
56245
+ super(container, renderer, opt);
56243
56246
  this.clock = new Clock();
56244
56247
  // isHalfed: boolean = false;
56245
56248
  this.mixer = null;
@@ -56247,12 +56250,11 @@ class copperScene extends baseScene {
56247
56250
  this.modelReady = false;
56248
56251
  // rayster pick
56249
56252
  // texture2d
56250
- // private depthStep: number = 0.4;
56251
56253
  this.texture2dMesh = null;
56252
- if (controls === "trackball") {
56254
+ if ((opt === null || opt === void 0 ? void 0 : opt.controls) === "trackball") {
56253
56255
  this.controls = new TrackballControls(this.camera, this.renderer.domElement);
56254
56256
  }
56255
- else if (controls === "orbit") {
56257
+ else if ((opt === null || opt === void 0 ? void 0 : opt.controls) === "orbit") {
56256
56258
  this.controls = new OrbitControls(this.camera, this.renderer.domElement);
56257
56259
  }
56258
56260
  else {
@@ -56495,13 +56497,12 @@ class copperScene extends baseScene {
56495
56497
  }
56496
56498
  updateControls(camera) {
56497
56499
  this.controls.dispose();
56498
- this.controls = new OrbitControls(camera, this.renderer.domElement);
56500
+ this.controls = new Copper3dTrackballControls(camera, this.renderer.domElement);
56499
56501
  // this.controls.target.set(64, 64, 128);
56500
56502
  this.controls.target.set(0, 0, 0);
56501
56503
  this.controls.minZoom = 0.5;
56502
56504
  this.controls.maxZoom = 4;
56503
56505
  // this.controls.enablePan = false;
56504
- this.controls.update();
56505
56506
  }
56506
56507
  onRenderCameraChange() {
56507
56508
  const { width, height } = this.container.getBoundingClientRect();
@@ -56563,13 +56564,17 @@ class copperRenderer extends baseRenderer {
56563
56564
  }
56564
56565
  }
56565
56566
  createScene(name) {
56566
- var _a, _b;
56567
+ var _a, _b, _c;
56567
56568
  if (this.sceneMap[name] != undefined) {
56568
56569
  return undefined;
56569
56570
  }
56570
56571
  else {
56571
56572
  const alpha = !!((_a = this.options) === null || _a === void 0 ? void 0 : _a.alpha);
56572
- const new_scene = new copperScene(this.container, this.renderer, (_b = this.options) === null || _b === void 0 ? void 0 : _b.controls, alpha);
56573
+ const new_scene = new copperScene(this.container, this.renderer, {
56574
+ camera: (_b = this.options) === null || _b === void 0 ? void 0 : _b.cameraType,
56575
+ controls: (_c = this.options) === null || _c === void 0 ? void 0 : _c.controls,
56576
+ alpha: alpha,
56577
+ });
56573
56578
  new_scene.sceneName = name;
56574
56579
  this.updateEnvironment(new_scene.vignette);
56575
56580
  this.sceneMap[name] = new_scene;
@@ -56713,9 +56718,6 @@ class copperRendererOnDemond extends baseRenderer {
56713
56718
  constructor(container, options) {
56714
56719
  super(container, options);
56715
56720
  this.sceneMap = {};
56716
- // addGui(): void {
56717
- // console.log("hello");
56718
- // }
56719
56721
  this.animate = () => {
56720
56722
  this.render();
56721
56723
  this.stats.update();
@@ -67823,8 +67825,6 @@ class nrrd_tools {
67823
67825
  this.allSlicesArray[0].x.volume.dimensions[1];
67824
67826
  this.nrrd_states.nrrd_z_pixel =
67825
67827
  this.allSlicesArray[0].x.volume.dimensions[2];
67826
- console.log("mm", this.nrrd_states.nrrd_x_mm);
67827
- console.log("pixel", this.nrrd_states.nrrd_x_pixel);
67828
67828
  this.nrrd_states.voxelSpacing = this.allSlicesArray[0].x.volume.spacing;
67829
67829
  this.nrrd_states.ratios.x = this.allSlicesArray[0].x.volume.spacing[0];
67830
67830
  this.nrrd_states.ratios.y = this.allSlicesArray[0].x.volume.spacing[1];
@@ -69759,7 +69759,7 @@ class nrrd_tools {
69759
69759
  }
69760
69760
 
69761
69761
  // import * as kiwrious from "copper3d_plugin_heart_k";
69762
- const REVISION = "v1.15.7";
69763
- console.log("%cCopper3D Visualisation %cBeta:v1.15.7", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
69762
+ const REVISION = "v1.15.9";
69763
+ console.log("%cCopper3D Visualisation %cBeta:v1.15.9", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
69764
69764
 
69765
69765
  export { CameraViewPoint, Copper3dTrackballControls, REVISION, addBoxHelper, addLabelToScene, configKiwriousHeart, convert3DPostoScreenPos, convertScreenPosto3DPos, copperMScene, copperMSceneRenderer, copperRenderer, copperRendererOnDemond, copperScene, copperSceneOnDemond, createTexture2D_NRRD, fullScreenListenner, kiwrious, loading, nrrd_tools, setHDRFilePath };
@@ -38590,11 +38590,9 @@
38590
38590
  loader$1.load(url, (arrayBuffer) => {
38591
38591
  var dicomFileAsBuffer = new Uint8Array(arrayBuffer);
38592
38592
  const dataSet = dicomParser.parseDicom(dicomFileAsBuffer);
38593
- // console.log(dataSet1);
38594
38593
  // const dataSet = dicomParser.parseDicom(dicomFileAsBuffer, {
38595
38594
  // vrCallback(tag) {
38596
38595
  // const formatted = `(${tag.substring(1, 5)},${tag.substring(5, 9)})`;
38597
- // // console.log(!!TAG_DICT[formatted] ? TAG_DICT[formatted].vr : undefined);
38598
38596
  // return !!TAG_DICT[formatted] ? TAG_DICT[formatted].vr : undefined;
38599
38597
  // },
38600
38598
  // });
@@ -44102,7 +44100,6 @@
44102
44100
  // 获取边界框的尺寸
44103
44101
  const size_ = new Vector3();
44104
44102
  boundingBox.getSize(size_);
44105
- console.log(size_);
44106
44103
  scene.add(mesh);
44107
44104
  const gui = new GUI$1();
44108
44105
  gui.add(volconfig, "clim1_g", -500, 500, 1).onChange((value) => {
@@ -44171,7 +44168,6 @@
44171
44168
  // nrrdSlices.z.index = i;
44172
44169
  // nrrdSlices.z.repaint(nrrdSlices.z);
44173
44170
  // nrrdSlices.z.mesh.position.set(0, 0, 0.5);
44174
- // console.log(nrrdSlices.z.mesh);
44175
44171
  // }, 100);
44176
44172
  // }
44177
44173
  let up = true;
@@ -44216,7 +44212,6 @@
44216
44212
  // }
44217
44213
  // if (slicesX[index]) {
44218
44214
  // controls.enabled = false;
44219
- // console.log(slicesX[index]);
44220
44215
  // slicesX[index].visible = false;
44221
44216
  // // ? (slicesX[index].visible = false)
44222
44217
  // // : (slicesX[index].visible = true);
@@ -46998,7 +46993,7 @@
46998
46993
  }
46999
46994
 
47000
46995
  class commonScene {
47001
- constructor(container) {
46996
+ constructor(container, opt) {
47002
46997
  this.subDiv = null;
47003
46998
  this.subScene = new Scene();
47004
46999
  this.subCamera = null;
@@ -47010,7 +47005,16 @@
47010
47005
  this.pickableObjects = [];
47011
47006
  this.container = container;
47012
47007
  this.scene = new Scene();
47013
- this.camera = new PerspectiveCamera(75, container.clientWidth / container.clientHeight, 0.1, 500);
47008
+ this.copperPerspectiveCamera = new PerspectiveCamera(75, container.clientWidth / container.clientHeight, 0.1, 500);
47009
+ const h = 1024;
47010
+ const aspect = window.innerWidth / window.innerHeight;
47011
+ this.copperOrthographicCamera = new OrthographicCamera((-h * aspect) / 2, (h * aspect) / 2, h / 2, -h / 2, 1, 2000);
47012
+ if ((opt === null || opt === void 0 ? void 0 : opt.camera) === "orthographic") {
47013
+ this.camera = this.copperOrthographicCamera;
47014
+ }
47015
+ else {
47016
+ this.camera = this.copperPerspectiveCamera;
47017
+ }
47014
47018
  this.controls = new Copper3dTrackballControls(this.camera, this.container);
47015
47019
  this.controls.dispose();
47016
47020
  this.preRenderCallbackFunctions = {
@@ -47211,9 +47215,7 @@
47211
47215
  }
47212
47216
  loadNrrdTexture3d(url, callback) {
47213
47217
  // const h = 512; // frustum height
47214
- const h = 1024;
47215
- const aspect = window.innerWidth / window.innerHeight;
47216
- this.camera = new OrthographicCamera((-h * aspect) / 2, (h * aspect) / 2, h / 2, -h / 2, 1, 2000);
47218
+ this.camera.updateProjectionMatrix();
47217
47219
  this.camera.position.set(0, 0, 1280);
47218
47220
  this.camera.up.set(0, 0, 1);
47219
47221
  this.camera.updateProjectionMatrix();
@@ -47234,9 +47236,7 @@
47234
47236
  this.scene.add(obj);
47235
47237
  !!callback && callback(obj);
47236
47238
  }, // called when loading is in progresses
47237
- (xhr) => {
47238
- // console.log((xhr.loaded / xhr.total) * 100 + "% loaded");
47239
- },
47239
+ (xhr) => { },
47240
47240
  // called when loading has errors
47241
47241
  (error) => {
47242
47242
  console.log("An error happened");
@@ -47246,8 +47246,8 @@
47246
47246
 
47247
47247
  const IS_IOS = isIOS();
47248
47248
  class baseScene extends commonScene {
47249
- constructor(container, renderer, alpha) {
47250
- super(container);
47249
+ constructor(container, renderer, opt) {
47250
+ super(container, opt);
47251
47251
  // scene: THREE.Scene;
47252
47252
  // camera: THREE.PerspectiveCamera;
47253
47253
  this.sceneName = "";
@@ -47261,18 +47261,20 @@
47261
47261
  this.lights = [];
47262
47262
  this.onWindowResize = () => {
47263
47263
  var _a;
47264
- console.log("adaa");
47265
47264
  this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
47266
47265
  this.onRenderCameraChange();
47267
47266
  (_a = this.vignette) === null || _a === void 0 ? void 0 : _a.style({
47268
47267
  aspect: this.camera.aspect,
47269
47268
  });
47269
+ if (this.controls instanceof Copper3dTrackballControls) {
47270
+ this.controls.handleResize();
47271
+ }
47270
47272
  this.renderer.setSize(this.container.clientWidth, this.container.clientHeight);
47271
47273
  };
47272
47274
  this.renderer = renderer;
47273
47275
  this.ambientLight = new AmbientLight(0x202020, 0.3);
47274
47276
  this.directionalLight = new DirectionalLight(0xffffff, 0.3);
47275
- if (!alpha) {
47277
+ if (!(opt === null || opt === void 0 ? void 0 : opt.alpha)) {
47276
47278
  this.vignette = createBackground({
47277
47279
  aspect: this.container.clientWidth / this.container.clientHeight,
47278
47280
  grainScale: IS_IOS ? 0 : 0.001,
@@ -47287,7 +47289,7 @@
47287
47289
  init() {
47288
47290
  this.copperControl.setCameraViewPoint();
47289
47291
  this.camera.position.z = 2;
47290
- this.scene.add(this.camera);
47292
+ // this.scene.add(this.camera);
47291
47293
  this.renderer.setSize(this.container.clientWidth, this.container.clientHeight);
47292
47294
  this.addLights();
47293
47295
  }
@@ -48097,10 +48099,14 @@
48097
48099
  this.pmremGenerator.compileEquirectangularShader();
48098
48100
  this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
48099
48101
  if (!!((_b = this.options) === null || _b === void 0 ? void 0 : _b.alpha)) {
48100
- this.currentScene = new baseScene(this.container, this.renderer, true);
48102
+ this.currentScene = new baseScene(this.container, this.renderer, {
48103
+ alpha: true,
48104
+ });
48101
48105
  }
48102
48106
  else {
48103
- this.currentScene = new baseScene(this.container, this.renderer, false);
48107
+ this.currentScene = new baseScene(this.container, this.renderer, {
48108
+ alpha: false,
48109
+ });
48104
48110
  }
48105
48111
  this.currentScene.sceneName = "default";
48106
48112
  !!this.currentScene.vignette &&
@@ -48185,11 +48191,11 @@
48185
48191
  bgColor1Ctrl.onChange(() => this.currentScene.updateBackground(this.state.bgColor1, this.state.bgColor2));
48186
48192
  bgColor2Ctrl.onChange(() => this.currentScene.updateBackground(this.state.bgColor1, this.state.bgColor2));
48187
48193
  // camera
48188
- if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.camera) {
48194
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.cameraGui) {
48189
48195
  this.cameraFolder = gui.addFolder("Camera");
48190
48196
  }
48191
48197
  // Performance
48192
- if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.performance) {
48198
+ if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.performanceGui) {
48193
48199
  const perfFolder = gui.addFolder("Performance");
48194
48200
  const perfLi = document.createElement("li");
48195
48201
  this.stats.dom.style.position = "static";
@@ -48198,7 +48204,7 @@
48198
48204
  perfFolder.__ul.appendChild(perfLi);
48199
48205
  }
48200
48206
  // lights
48201
- if ((_c = this.options) === null || _c === void 0 ? void 0 : _c.light) {
48207
+ if ((_c = this.options) === null || _c === void 0 ? void 0 : _c.lightGui) {
48202
48208
  const lightFolder = gui.addFolder("LightsFolder");
48203
48209
  [
48204
48210
  lightFolder.add(this.state, "addLights").listen(),
@@ -56243,11 +56249,8 @@
56243
56249
  }
56244
56250
 
56245
56251
  class copperScene extends baseScene {
56246
- // private preRenderCallbackFunctions: Array<preRenderCallbackFunctionType> = [];
56247
- // private preRenderCallbackFunctions: preRenderCallbackFunctionType;
56248
- // private sort: boolean = true; //default ascending order
56249
- constructor(container, renderer, controls, alpha) {
56250
- super(container, renderer, alpha);
56252
+ constructor(container, renderer, opt) {
56253
+ super(container, renderer, opt);
56251
56254
  this.clock = new Clock();
56252
56255
  // isHalfed: boolean = false;
56253
56256
  this.mixer = null;
@@ -56255,12 +56258,11 @@
56255
56258
  this.modelReady = false;
56256
56259
  // rayster pick
56257
56260
  // texture2d
56258
- // private depthStep: number = 0.4;
56259
56261
  this.texture2dMesh = null;
56260
- if (controls === "trackball") {
56262
+ if ((opt === null || opt === void 0 ? void 0 : opt.controls) === "trackball") {
56261
56263
  this.controls = new TrackballControls(this.camera, this.renderer.domElement);
56262
56264
  }
56263
- else if (controls === "orbit") {
56265
+ else if ((opt === null || opt === void 0 ? void 0 : opt.controls) === "orbit") {
56264
56266
  this.controls = new OrbitControls(this.camera, this.renderer.domElement);
56265
56267
  }
56266
56268
  else {
@@ -56503,13 +56505,12 @@
56503
56505
  }
56504
56506
  updateControls(camera) {
56505
56507
  this.controls.dispose();
56506
- this.controls = new OrbitControls(camera, this.renderer.domElement);
56508
+ this.controls = new Copper3dTrackballControls(camera, this.renderer.domElement);
56507
56509
  // this.controls.target.set(64, 64, 128);
56508
56510
  this.controls.target.set(0, 0, 0);
56509
56511
  this.controls.minZoom = 0.5;
56510
56512
  this.controls.maxZoom = 4;
56511
56513
  // this.controls.enablePan = false;
56512
- this.controls.update();
56513
56514
  }
56514
56515
  onRenderCameraChange() {
56515
56516
  const { width, height } = this.container.getBoundingClientRect();
@@ -56571,13 +56572,17 @@
56571
56572
  }
56572
56573
  }
56573
56574
  createScene(name) {
56574
- var _a, _b;
56575
+ var _a, _b, _c;
56575
56576
  if (this.sceneMap[name] != undefined) {
56576
56577
  return undefined;
56577
56578
  }
56578
56579
  else {
56579
56580
  const alpha = !!((_a = this.options) === null || _a === void 0 ? void 0 : _a.alpha);
56580
- const new_scene = new copperScene(this.container, this.renderer, (_b = this.options) === null || _b === void 0 ? void 0 : _b.controls, alpha);
56581
+ const new_scene = new copperScene(this.container, this.renderer, {
56582
+ camera: (_b = this.options) === null || _b === void 0 ? void 0 : _b.cameraType,
56583
+ controls: (_c = this.options) === null || _c === void 0 ? void 0 : _c.controls,
56584
+ alpha: alpha,
56585
+ });
56581
56586
  new_scene.sceneName = name;
56582
56587
  this.updateEnvironment(new_scene.vignette);
56583
56588
  this.sceneMap[name] = new_scene;
@@ -56721,9 +56726,6 @@
56721
56726
  constructor(container, options) {
56722
56727
  super(container, options);
56723
56728
  this.sceneMap = {};
56724
- // addGui(): void {
56725
- // console.log("hello");
56726
- // }
56727
56729
  this.animate = () => {
56728
56730
  this.render();
56729
56731
  this.stats.update();
@@ -67831,8 +67833,6 @@
67831
67833
  this.allSlicesArray[0].x.volume.dimensions[1];
67832
67834
  this.nrrd_states.nrrd_z_pixel =
67833
67835
  this.allSlicesArray[0].x.volume.dimensions[2];
67834
- console.log("mm", this.nrrd_states.nrrd_x_mm);
67835
- console.log("pixel", this.nrrd_states.nrrd_x_pixel);
67836
67836
  this.nrrd_states.voxelSpacing = this.allSlicesArray[0].x.volume.spacing;
67837
67837
  this.nrrd_states.ratios.x = this.allSlicesArray[0].x.volume.spacing[0];
67838
67838
  this.nrrd_states.ratios.y = this.allSlicesArray[0].x.volume.spacing[1];
@@ -69767,8 +69767,8 @@
69767
69767
  }
69768
69768
 
69769
69769
  // import * as kiwrious from "copper3d_plugin_heart_k";
69770
- const REVISION = "v1.15.7";
69771
- console.log("%cCopper3D Visualisation %cBeta:v1.15.7", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
69770
+ const REVISION = "v1.15.9";
69771
+ console.log("%cCopper3D Visualisation %cBeta:v1.15.9", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
69772
69772
 
69773
69773
  exports.CameraViewPoint = CameraViewPoint;
69774
69774
  exports.Copper3dTrackballControls = Copper3dTrackballControls;
package/dist/index.d.ts CHANGED
@@ -16,6 +16,6 @@ import { nrrd_tools } from "./Utils/nrrd_tool";
16
16
  import { Copper3dTrackballControls } from "./Controls/Copper3dTrackballControls";
17
17
  import { nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, paintImageType, exportPaintImageType, IOptVTKLoader } from "./types/types";
18
18
  import "./css/style.css";
19
- export declare const REVISION = "v1.15.7";
19
+ export declare const REVISION = "v1.15.9";
20
20
  export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, nrrd_tools, loading, Copper3dTrackballControls, createTexture2D_NRRD, };
21
21
  export type { positionType, screenPosType, optsType, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, paintImageType, exportPaintImageType, IOptVTKLoader, };
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import kiwrious from "./Utils/kiwrious/configKiwrious";
16
16
  import { nrrd_tools } from "./Utils/nrrd_tool";
17
17
  import { Copper3dTrackballControls } from "./Controls/Copper3dTrackballControls";
18
18
  import "./css/style.css";
19
- export const REVISION = "v1.15.7";
20
- console.log("%cCopper3D Visualisation %cBeta:v1.15.7", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
19
+ export const REVISION = "v1.15.9";
20
+ console.log("%cCopper3D Visualisation %cBeta:v1.15.9", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
21
21
  export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, nrrd_tools, loading, Copper3dTrackballControls, createTexture2D_NRRD, };
22
22
  //# sourceMappingURL=index.js.map
@@ -4,7 +4,7 @@ import baseScene from "../Scene/baseScene";
4
4
  import { customMeshType } from "../lib/three-vignette";
5
5
  import Stats from "three/examples/jsm/libs/stats.module";
6
6
  import { GUI } from "dat.gui";
7
- import { optType } from "../types/types";
7
+ import { ICopperRenderOpt } from "../types/types";
8
8
  export default class baseRenderer {
9
9
  container: HTMLDivElement;
10
10
  renderer: THREE.WebGLRenderer;
@@ -12,12 +12,12 @@ export default class baseRenderer {
12
12
  stats: Stats;
13
13
  currentScene: baseScene;
14
14
  pmremGenerator: THREE.PMREMGenerator;
15
- options: optType | undefined;
15
+ options: ICopperRenderOpt | undefined;
16
16
  private state;
17
17
  private visualiseFolder;
18
18
  private visualCtrls;
19
19
  private cameraFolder;
20
- constructor(container: HTMLDivElement, options?: optType);
20
+ constructor(container: HTMLDivElement, options?: ICopperRenderOpt);
21
21
  init(): void;
22
22
  updateEnvironment(vignette?: customMeshType): void;
23
23
  private getCubeMapTexture;
@@ -1,10 +1,10 @@
1
1
  import baseRenderer from "./baseRenderer";
2
2
  import copperScene from "../Scene/copperScene";
3
- import { optType } from "../types/types";
3
+ import { ICopperRenderOpt } from "../types/types";
4
4
  export default class copperRenderer extends baseRenderer {
5
5
  private sceneMap;
6
6
  preRenderCallbackFunctions: Array<Function>;
7
- constructor(container: HTMLDivElement, options?: optType);
7
+ constructor(container: HTMLDivElement, options?: ICopperRenderOpt);
8
8
  getSceneByName(name: string): copperScene | import("../Scene/baseScene").default | import("../index").copperMScene;
9
9
  setCurrentScene(sceneIn: copperScene): void;
10
10
  createScene(name: string): copperScene | undefined;
@@ -1,10 +1,10 @@
1
1
  import baseRenderer from "./baseRenderer";
2
2
  import copperScene from "../Scene/copperScene";
3
- import { optType } from "../types/types";
3
+ import { ICopperRenderOpt } from "../types/types";
4
4
  import copperSceneOnDemond from "../Scene/copperSceneOnDemond";
5
5
  export default class copperRendererOnDemond extends baseRenderer {
6
6
  private sceneMap;
7
- constructor(container: HTMLDivElement, options?: optType);
7
+ constructor(container: HTMLDivElement, options?: ICopperRenderOpt);
8
8
  getSceneByName(name: string): copperScene | import("../Scene/baseScene").default | import("../index").copperMScene;
9
9
  setCurrentScene(sceneIn: copperSceneOnDemond): void;
10
10
  createScene(name: string): copperSceneOnDemond | undefined;
@@ -1,7 +1,7 @@
1
1
  import * as THREE from "three";
2
2
  import { Controls, CameraViewPoint } from "../Controls/copperControls";
3
3
  import { customMeshType } from "../lib/three-vignette";
4
- import { baseStateType } from "../types/types";
4
+ import { baseStateType, ICopperSceneOpts } from "../types/types";
5
5
  import commonScene from "./commonSceneMethod";
6
6
  export default class baseScene extends commonScene {
7
7
  renderer: THREE.WebGLRenderer;
@@ -18,7 +18,7 @@ export default class baseScene extends commonScene {
18
18
  private color1;
19
19
  private color2;
20
20
  private lights;
21
- constructor(container: HTMLDivElement, renderer: THREE.WebGLRenderer, alpha?: boolean);
21
+ constructor(container: HTMLDivElement, renderer: THREE.WebGLRenderer, opt?: ICopperSceneOpts);
22
22
  init(): void;
23
23
  loadMetadataUrl(url: string): void;
24
24
  loadViewUrl(url: string): void;
@@ -1,4 +1,4 @@
1
- import { preRenderCallbackFunctionType, nrrdMeshesType, nrrdSliceType, loadingBarType, dicomLoaderOptsType, mouseMovePositionType } from "../types/types";
1
+ import { preRenderCallbackFunctionType, nrrdMeshesType, nrrdSliceType, loadingBarType, dicomLoaderOptsType, mouseMovePositionType, ICopperSceneOpts } from "../types/types";
2
2
  import * as THREE from "three";
3
3
  import { GUI } from "dat.gui";
4
4
  import { optsType } from "../Loader/copperNrrdLoader";
@@ -10,6 +10,8 @@ export default class commonScene {
10
10
  container: HTMLDivElement;
11
11
  scene: THREE.Scene;
12
12
  camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
13
+ copperPerspectiveCamera: THREE.PerspectiveCamera;
14
+ copperOrthographicCamera: THREE.OrthographicCamera;
13
15
  subDiv: HTMLDivElement | null;
14
16
  subScene: THREE.Scene;
15
17
  subCamera: THREE.PerspectiveCamera | null;
@@ -21,7 +23,7 @@ export default class commonScene {
21
23
  protected sort: boolean;
22
24
  protected depthStep: number;
23
25
  protected pickableObjects: THREE.Mesh[];
24
- constructor(container: HTMLDivElement);
26
+ constructor(container: HTMLDivElement, opt?: ICopperSceneOpts);
25
27
  createDemoMesh(): void;
26
28
  addObject(obj: any): void;
27
29
  setDepth(value: number): void;
@@ -5,6 +5,7 @@ import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
5
5
  import baseScene from "./baseScene";
6
6
  import { vtkModels } from "../types/types";
7
7
  import { TrackballControls } from "three/examples/jsm/controls/TrackballControls";
8
+ import { ICopperSceneOpts } from "../types/types";
8
9
  export default class copperScene extends baseScene {
9
10
  clock: THREE.Clock;
10
11
  controls: Copper3dTrackballControls | OrbitControls | TrackballControls;
@@ -13,7 +14,7 @@ export default class copperScene extends baseScene {
13
14
  private modelReady;
14
15
  private clipAction;
15
16
  private texture2dMesh;
16
- constructor(container: HTMLDivElement, renderer: THREE.WebGLRenderer, controls?: "copper3d" | "orbit" | "trackball", alpha?: boolean);
17
+ constructor(container: HTMLDivElement, renderer: THREE.WebGLRenderer, opt?: ICopperSceneOpts);
17
18
  loadGltf(url: string, callback?: (content: THREE.Group) => void): void;
18
19
  loadVtk(url: string): void;
19
20
  loadVtks(models: Array<vtkModels>): void;
@@ -16,6 +16,6 @@ import { nrrd_tools } from "./Utils/nrrd_tool";
16
16
  import { Copper3dTrackballControls } from "./Controls/Copper3dTrackballControls";
17
17
  import { nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, paintImageType, exportPaintImageType, IOptVTKLoader } from "./types/types";
18
18
  import "./css/style.css";
19
- export declare const REVISION = "v1.15.7";
19
+ export declare const REVISION = "v1.15.9";
20
20
  export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, nrrd_tools, loading, Copper3dTrackballControls, createTexture2D_NRRD, };
21
21
  export type { positionType, screenPosType, optsType, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, paintImageType, exportPaintImageType, IOptVTKLoader, };