copper3d 1.15.7 → 1.15.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.
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 +7 -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 -11
  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 +41 -43
  28. package/dist/bundle.umd.js +41 -43
  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,19 @@ 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();
47262
47263
  this.renderer.setSize(this.container.clientWidth, this.container.clientHeight);
47263
47264
  };
47264
47265
  this.renderer = renderer;
47265
47266
  this.ambientLight = new AmbientLight(0x202020, 0.3);
47266
47267
  this.directionalLight = new DirectionalLight(0xffffff, 0.3);
47267
- if (!alpha) {
47268
+ if (!(opt === null || opt === void 0 ? void 0 : opt.alpha)) {
47268
47269
  this.vignette = createBackground({
47269
47270
  aspect: this.container.clientWidth / this.container.clientHeight,
47270
47271
  grainScale: IS_IOS ? 0 : 0.001,
@@ -47279,7 +47280,7 @@ class baseScene extends commonScene {
47279
47280
  init() {
47280
47281
  this.copperControl.setCameraViewPoint();
47281
47282
  this.camera.position.z = 2;
47282
- this.scene.add(this.camera);
47283
+ // this.scene.add(this.camera);
47283
47284
  this.renderer.setSize(this.container.clientWidth, this.container.clientHeight);
47284
47285
  this.addLights();
47285
47286
  }
@@ -48089,10 +48090,14 @@ class baseRenderer {
48089
48090
  this.pmremGenerator.compileEquirectangularShader();
48090
48091
  this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
48091
48092
  if (!!((_b = this.options) === null || _b === void 0 ? void 0 : _b.alpha)) {
48092
- this.currentScene = new baseScene(this.container, this.renderer, true);
48093
+ this.currentScene = new baseScene(this.container, this.renderer, {
48094
+ alpha: true,
48095
+ });
48093
48096
  }
48094
48097
  else {
48095
- this.currentScene = new baseScene(this.container, this.renderer, false);
48098
+ this.currentScene = new baseScene(this.container, this.renderer, {
48099
+ alpha: false,
48100
+ });
48096
48101
  }
48097
48102
  this.currentScene.sceneName = "default";
48098
48103
  !!this.currentScene.vignette &&
@@ -48177,11 +48182,11 @@ class baseRenderer {
48177
48182
  bgColor1Ctrl.onChange(() => this.currentScene.updateBackground(this.state.bgColor1, this.state.bgColor2));
48178
48183
  bgColor2Ctrl.onChange(() => this.currentScene.updateBackground(this.state.bgColor1, this.state.bgColor2));
48179
48184
  // camera
48180
- if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.camera) {
48185
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.cameraGui) {
48181
48186
  this.cameraFolder = gui.addFolder("Camera");
48182
48187
  }
48183
48188
  // Performance
48184
- if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.performance) {
48189
+ if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.performanceGui) {
48185
48190
  const perfFolder = gui.addFolder("Performance");
48186
48191
  const perfLi = document.createElement("li");
48187
48192
  this.stats.dom.style.position = "static";
@@ -48190,7 +48195,7 @@ class baseRenderer {
48190
48195
  perfFolder.__ul.appendChild(perfLi);
48191
48196
  }
48192
48197
  // lights
48193
- if ((_c = this.options) === null || _c === void 0 ? void 0 : _c.light) {
48198
+ if ((_c = this.options) === null || _c === void 0 ? void 0 : _c.lightGui) {
48194
48199
  const lightFolder = gui.addFolder("LightsFolder");
48195
48200
  [
48196
48201
  lightFolder.add(this.state, "addLights").listen(),
@@ -56235,11 +56240,8 @@ class TrackballControls extends EventDispatcher {
56235
56240
  }
56236
56241
 
56237
56242
  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);
56243
+ constructor(container, renderer, opt) {
56244
+ super(container, renderer, opt);
56243
56245
  this.clock = new Clock();
56244
56246
  // isHalfed: boolean = false;
56245
56247
  this.mixer = null;
@@ -56247,12 +56249,11 @@ class copperScene extends baseScene {
56247
56249
  this.modelReady = false;
56248
56250
  // rayster pick
56249
56251
  // texture2d
56250
- // private depthStep: number = 0.4;
56251
56252
  this.texture2dMesh = null;
56252
- if (controls === "trackball") {
56253
+ if ((opt === null || opt === void 0 ? void 0 : opt.controls) === "trackball") {
56253
56254
  this.controls = new TrackballControls(this.camera, this.renderer.domElement);
56254
56255
  }
56255
- else if (controls === "orbit") {
56256
+ else if ((opt === null || opt === void 0 ? void 0 : opt.controls) === "orbit") {
56256
56257
  this.controls = new OrbitControls(this.camera, this.renderer.domElement);
56257
56258
  }
56258
56259
  else {
@@ -56495,13 +56496,12 @@ class copperScene extends baseScene {
56495
56496
  }
56496
56497
  updateControls(camera) {
56497
56498
  this.controls.dispose();
56498
- this.controls = new OrbitControls(camera, this.renderer.domElement);
56499
+ this.controls = new Copper3dTrackballControls(camera, this.renderer.domElement);
56499
56500
  // this.controls.target.set(64, 64, 128);
56500
56501
  this.controls.target.set(0, 0, 0);
56501
56502
  this.controls.minZoom = 0.5;
56502
56503
  this.controls.maxZoom = 4;
56503
56504
  // this.controls.enablePan = false;
56504
- this.controls.update();
56505
56505
  }
56506
56506
  onRenderCameraChange() {
56507
56507
  const { width, height } = this.container.getBoundingClientRect();
@@ -56515,7 +56515,6 @@ class copperScene extends baseScene {
56515
56515
  else {
56516
56516
  this.camera.aspect = aspect;
56517
56517
  }
56518
- this.camera.updateProjectionMatrix();
56519
56518
  }
56520
56519
  render() {
56521
56520
  this.controls.update();
@@ -56563,13 +56562,17 @@ class copperRenderer extends baseRenderer {
56563
56562
  }
56564
56563
  }
56565
56564
  createScene(name) {
56566
- var _a, _b;
56565
+ var _a, _b, _c;
56567
56566
  if (this.sceneMap[name] != undefined) {
56568
56567
  return undefined;
56569
56568
  }
56570
56569
  else {
56571
56570
  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);
56571
+ const new_scene = new copperScene(this.container, this.renderer, {
56572
+ camera: (_b = this.options) === null || _b === void 0 ? void 0 : _b.cameraType,
56573
+ controls: (_c = this.options) === null || _c === void 0 ? void 0 : _c.controls,
56574
+ alpha: alpha,
56575
+ });
56573
56576
  new_scene.sceneName = name;
56574
56577
  this.updateEnvironment(new_scene.vignette);
56575
56578
  this.sceneMap[name] = new_scene;
@@ -56713,9 +56716,6 @@ class copperRendererOnDemond extends baseRenderer {
56713
56716
  constructor(container, options) {
56714
56717
  super(container, options);
56715
56718
  this.sceneMap = {};
56716
- // addGui(): void {
56717
- // console.log("hello");
56718
- // }
56719
56719
  this.animate = () => {
56720
56720
  this.render();
56721
56721
  this.stats.update();
@@ -67823,8 +67823,6 @@ class nrrd_tools {
67823
67823
  this.allSlicesArray[0].x.volume.dimensions[1];
67824
67824
  this.nrrd_states.nrrd_z_pixel =
67825
67825
  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
67826
  this.nrrd_states.voxelSpacing = this.allSlicesArray[0].x.volume.spacing;
67829
67827
  this.nrrd_states.ratios.x = this.allSlicesArray[0].x.volume.spacing[0];
67830
67828
  this.nrrd_states.ratios.y = this.allSlicesArray[0].x.volume.spacing[1];
@@ -69759,7 +69757,7 @@ class nrrd_tools {
69759
69757
  }
69760
69758
 
69761
69759
  // 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");
69760
+ const REVISION = "v1.15.8";
69761
+ console.log("%cCopper3D Visualisation %cBeta:v1.15.8", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
69764
69762
 
69765
69763
  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,19 @@
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();
47270
47271
  this.renderer.setSize(this.container.clientWidth, this.container.clientHeight);
47271
47272
  };
47272
47273
  this.renderer = renderer;
47273
47274
  this.ambientLight = new AmbientLight(0x202020, 0.3);
47274
47275
  this.directionalLight = new DirectionalLight(0xffffff, 0.3);
47275
- if (!alpha) {
47276
+ if (!(opt === null || opt === void 0 ? void 0 : opt.alpha)) {
47276
47277
  this.vignette = createBackground({
47277
47278
  aspect: this.container.clientWidth / this.container.clientHeight,
47278
47279
  grainScale: IS_IOS ? 0 : 0.001,
@@ -47287,7 +47288,7 @@
47287
47288
  init() {
47288
47289
  this.copperControl.setCameraViewPoint();
47289
47290
  this.camera.position.z = 2;
47290
- this.scene.add(this.camera);
47291
+ // this.scene.add(this.camera);
47291
47292
  this.renderer.setSize(this.container.clientWidth, this.container.clientHeight);
47292
47293
  this.addLights();
47293
47294
  }
@@ -48097,10 +48098,14 @@
48097
48098
  this.pmremGenerator.compileEquirectangularShader();
48098
48099
  this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
48099
48100
  if (!!((_b = this.options) === null || _b === void 0 ? void 0 : _b.alpha)) {
48100
- this.currentScene = new baseScene(this.container, this.renderer, true);
48101
+ this.currentScene = new baseScene(this.container, this.renderer, {
48102
+ alpha: true,
48103
+ });
48101
48104
  }
48102
48105
  else {
48103
- this.currentScene = new baseScene(this.container, this.renderer, false);
48106
+ this.currentScene = new baseScene(this.container, this.renderer, {
48107
+ alpha: false,
48108
+ });
48104
48109
  }
48105
48110
  this.currentScene.sceneName = "default";
48106
48111
  !!this.currentScene.vignette &&
@@ -48185,11 +48190,11 @@
48185
48190
  bgColor1Ctrl.onChange(() => this.currentScene.updateBackground(this.state.bgColor1, this.state.bgColor2));
48186
48191
  bgColor2Ctrl.onChange(() => this.currentScene.updateBackground(this.state.bgColor1, this.state.bgColor2));
48187
48192
  // camera
48188
- if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.camera) {
48193
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.cameraGui) {
48189
48194
  this.cameraFolder = gui.addFolder("Camera");
48190
48195
  }
48191
48196
  // Performance
48192
- if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.performance) {
48197
+ if ((_b = this.options) === null || _b === void 0 ? void 0 : _b.performanceGui) {
48193
48198
  const perfFolder = gui.addFolder("Performance");
48194
48199
  const perfLi = document.createElement("li");
48195
48200
  this.stats.dom.style.position = "static";
@@ -48198,7 +48203,7 @@
48198
48203
  perfFolder.__ul.appendChild(perfLi);
48199
48204
  }
48200
48205
  // lights
48201
- if ((_c = this.options) === null || _c === void 0 ? void 0 : _c.light) {
48206
+ if ((_c = this.options) === null || _c === void 0 ? void 0 : _c.lightGui) {
48202
48207
  const lightFolder = gui.addFolder("LightsFolder");
48203
48208
  [
48204
48209
  lightFolder.add(this.state, "addLights").listen(),
@@ -56243,11 +56248,8 @@
56243
56248
  }
56244
56249
 
56245
56250
  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);
56251
+ constructor(container, renderer, opt) {
56252
+ super(container, renderer, opt);
56251
56253
  this.clock = new Clock();
56252
56254
  // isHalfed: boolean = false;
56253
56255
  this.mixer = null;
@@ -56255,12 +56257,11 @@
56255
56257
  this.modelReady = false;
56256
56258
  // rayster pick
56257
56259
  // texture2d
56258
- // private depthStep: number = 0.4;
56259
56260
  this.texture2dMesh = null;
56260
- if (controls === "trackball") {
56261
+ if ((opt === null || opt === void 0 ? void 0 : opt.controls) === "trackball") {
56261
56262
  this.controls = new TrackballControls(this.camera, this.renderer.domElement);
56262
56263
  }
56263
- else if (controls === "orbit") {
56264
+ else if ((opt === null || opt === void 0 ? void 0 : opt.controls) === "orbit") {
56264
56265
  this.controls = new OrbitControls(this.camera, this.renderer.domElement);
56265
56266
  }
56266
56267
  else {
@@ -56503,13 +56504,12 @@
56503
56504
  }
56504
56505
  updateControls(camera) {
56505
56506
  this.controls.dispose();
56506
- this.controls = new OrbitControls(camera, this.renderer.domElement);
56507
+ this.controls = new Copper3dTrackballControls(camera, this.renderer.domElement);
56507
56508
  // this.controls.target.set(64, 64, 128);
56508
56509
  this.controls.target.set(0, 0, 0);
56509
56510
  this.controls.minZoom = 0.5;
56510
56511
  this.controls.maxZoom = 4;
56511
56512
  // this.controls.enablePan = false;
56512
- this.controls.update();
56513
56513
  }
56514
56514
  onRenderCameraChange() {
56515
56515
  const { width, height } = this.container.getBoundingClientRect();
@@ -56523,7 +56523,6 @@
56523
56523
  else {
56524
56524
  this.camera.aspect = aspect;
56525
56525
  }
56526
- this.camera.updateProjectionMatrix();
56527
56526
  }
56528
56527
  render() {
56529
56528
  this.controls.update();
@@ -56571,13 +56570,17 @@
56571
56570
  }
56572
56571
  }
56573
56572
  createScene(name) {
56574
- var _a, _b;
56573
+ var _a, _b, _c;
56575
56574
  if (this.sceneMap[name] != undefined) {
56576
56575
  return undefined;
56577
56576
  }
56578
56577
  else {
56579
56578
  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);
56579
+ const new_scene = new copperScene(this.container, this.renderer, {
56580
+ camera: (_b = this.options) === null || _b === void 0 ? void 0 : _b.cameraType,
56581
+ controls: (_c = this.options) === null || _c === void 0 ? void 0 : _c.controls,
56582
+ alpha: alpha,
56583
+ });
56581
56584
  new_scene.sceneName = name;
56582
56585
  this.updateEnvironment(new_scene.vignette);
56583
56586
  this.sceneMap[name] = new_scene;
@@ -56721,9 +56724,6 @@
56721
56724
  constructor(container, options) {
56722
56725
  super(container, options);
56723
56726
  this.sceneMap = {};
56724
- // addGui(): void {
56725
- // console.log("hello");
56726
- // }
56727
56727
  this.animate = () => {
56728
56728
  this.render();
56729
56729
  this.stats.update();
@@ -67831,8 +67831,6 @@
67831
67831
  this.allSlicesArray[0].x.volume.dimensions[1];
67832
67832
  this.nrrd_states.nrrd_z_pixel =
67833
67833
  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
67834
  this.nrrd_states.voxelSpacing = this.allSlicesArray[0].x.volume.spacing;
67837
67835
  this.nrrd_states.ratios.x = this.allSlicesArray[0].x.volume.spacing[0];
67838
67836
  this.nrrd_states.ratios.y = this.allSlicesArray[0].x.volume.spacing[1];
@@ -69767,8 +69765,8 @@
69767
69765
  }
69768
69766
 
69769
69767
  // 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");
69768
+ const REVISION = "v1.15.8";
69769
+ console.log("%cCopper3D Visualisation %cBeta:v1.15.8", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
69772
69770
 
69773
69771
  exports.CameraViewPoint = CameraViewPoint;
69774
69772
  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.8";
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.8";
20
+ console.log("%cCopper3D Visualisation %cBeta:v1.15.8", "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;