Skip to content

Commit

Permalink
Merge pull request #307 from LinkunGao/feat/v2.1.2
Browse files Browse the repository at this point in the history
Feat/v2.1.2
  • Loading branch information
LinkunGao authored Nov 5, 2024
2 parents e4149f7 + a434f7f commit 57c7952
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 46 deletions.
84 changes: 57 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@
},
"dependencies": {
"@types/dat.gui": "^0.7.9",
"@types/three": "^0.152.0",
"@types/three": "^0.169.0",
"copper3d_plugin_heart_k": "^1.0.14",
"dat.gui": "^0.7.9",
"dicom-parser": "^1.8.13",
"fflate": "^0.7.3",
"file-saver": "^2.0.5",
"glsl-blend-soft-light": "^1.0.5",
"glsl-film-grain": "^1.0.4",
"three": "^0.161.0"
"three": "^0.170.0"
}
}
18 changes: 9 additions & 9 deletions src/Controls/Copper3dTrackballControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class Copper3dTrackballControls extends EventDispatcher {
scope.object.lookAt(scope.target);

if (lastPosition.distanceToSquared(scope.object.position) > EPS) {
scope.dispatchEvent(_changeEvent);
scope.dispatchEvent(_changeEvent as never);

lastPosition.copy(scope.object.position);
}
Expand All @@ -395,7 +395,7 @@ class Copper3dTrackballControls extends EventDispatcher {
lastPosition.distanceToSquared(scope.object.position) > EPS ||
lastZoom !== scope.object.zoom
) {
scope.dispatchEvent(_changeEvent);
scope.dispatchEvent(_changeEvent as never);

lastPosition.copy(scope.object.position);
lastZoom = scope.object.zoom;
Expand All @@ -420,7 +420,7 @@ class Copper3dTrackballControls extends EventDispatcher {

scope.object.lookAt(scope.target);

scope.dispatchEvent(_changeEvent);
scope.dispatchEvent(_changeEvent as never);

lastPosition.copy(scope.object.position);
lastZoom = scope.object.zoom;
Expand Down Expand Up @@ -538,7 +538,7 @@ class Copper3dTrackballControls extends EventDispatcher {
_panEnd.copy(_panStart);
}

scope.dispatchEvent(_startEvent);
scope.dispatchEvent(_startEvent as never);
}

function onMouseMove(event: PointerEvent) {
Expand All @@ -557,7 +557,7 @@ class Copper3dTrackballControls extends EventDispatcher {
function onMouseUp() {
_state = STATE.NONE;

scope.dispatchEvent(_endEvent);
scope.dispatchEvent(_endEvent as never);
}

function onMouseWheel(event: WheelEvent) {
Expand All @@ -584,8 +584,8 @@ class Copper3dTrackballControls extends EventDispatcher {
break;
}

scope.dispatchEvent(_startEvent);
scope.dispatchEvent(_endEvent);
scope.dispatchEvent(_startEvent as never);
scope.dispatchEvent(_endEvent as never);
}

function onTouchStart(event: PointerEvent) {
Expand Down Expand Up @@ -626,7 +626,7 @@ class Copper3dTrackballControls extends EventDispatcher {
break;
}

scope.dispatchEvent(_startEvent);
scope.dispatchEvent(_startEvent as never);
}

function onTouchMove(event: PointerEvent) {
Expand Down Expand Up @@ -709,7 +709,7 @@ class Copper3dTrackballControls extends EventDispatcher {
break;
}

scope.dispatchEvent(_endEvent);
scope.dispatchEvent(_endEvent as never);
}

function contextmenu(event: MouseEvent) {
Expand Down
4 changes: 2 additions & 2 deletions src/Loader/copperNrrdLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,9 @@ export function getWholeSlices(
export function addBoxHelper(
scene: copperScene,
volume: any,
boxCube?: THREE.Object3D<THREE.Event>
boxCube?: THREE.Object3D<THREE.Object3DEventMap>
) {
let obj: THREE.Object3D<THREE.Event>;
let obj: THREE.Object3D<THREE.Object3DEventMap>;
boxCube ? (obj = boxCube) : (obj = cube);

const boxHelper = new THREE.BoxHelper(obj);
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/copperMSceneRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class copperMSceneRenderer {
init() {
// this.renderer.physicallyCorrectLights = true;
// this.renderer.outputEncoding = THREE.sRGBEncoding;
this.renderer.useLegacyLights = true;
// this.renderer.useLegacyLights = true;
this.renderer.outputColorSpace = THREE.SRGBColorSpace;

this.pmremGenerator.compileEquirectangularShader();
Expand Down
8 changes: 5 additions & 3 deletions src/Utils/segmentation/DrawToolCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export class DrawToolCore extends CommToolsData {
);
let mouseX = e.offsetX / this.nrrd_states.sizeFoctor;
let mouseY = e.offsetY / this.nrrd_states.sizeFoctor;

// record mouseX,Y, and enable crosshair function
this.nrrd_states.sphereOrigin[this.protectedData.axis] = [
mouseX,
Expand Down Expand Up @@ -1215,8 +1215,8 @@ export class DrawToolCore extends CommToolsData {
Math.min(this.nrrd_states.sphereRadius, 50)
);
// get mouse position
const mouseX = this.nrrd_states.sphereOrigin[this.protectedData.axis][0] * this.nrrd_states.sizeFoctor;
const mouseY = this.nrrd_states.sphereOrigin[this.protectedData.axis][1] * this.nrrd_states.sizeFoctor;
const mouseX = this.nrrd_states.sphereOrigin[this.protectedData.axis][0] ;
const mouseY = this.nrrd_states.sphereOrigin[this.protectedData.axis][1];
this.drawSphere(mouseX, mouseY, this.nrrd_states.sphereRadius);
};
return sphereEvent;
Expand Down Expand Up @@ -1254,6 +1254,8 @@ export class DrawToolCore extends CommToolsData {


drawSphere(mouseX: number, mouseY: number, radius: number) {
console.log(radius);

// clear canvas
const [canvas, ctx] = this.clearSphereCanvas()
this.drawSphereCore(ctx as CanvasRenderingContext2D, mouseX, mouseY, radius,this.gui_states.fillColor);
Expand Down
1 change: 1 addition & 0 deletions src/Utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as THREE from "three";
export function fullScreenListenner(
container: HTMLDivElement | HTMLCanvasElement
) {
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ import { IPaintImage, ICommXYZ } from "./Utils/segmentation/coreTools/coreType";

import "./css/style.css";

export const REVISION = "v2.1.1";
export const REVISION = "v2.1.2";

console.log(
"%cCopper3D Visualisation %cBeta:v2.1.1",
"%cCopper3D Visualisation %cBeta:v2.1.2",
"padding: 3px;color:white; background:#023047",
"padding: 3px;color:white; background:#f50a25"
);
Expand Down
1 change: 1 addition & 0 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { copperScene } from "../Scene/copperScene";
import { baseScene } from "../Scene/baseScene";
import { copperMScene } from "../Scene/copperMScene";
import { GUI } from "dat.gui";
import * as THREE from "three";

interface SceneMapType {
[key: string]: copperScene | baseScene | copperMScene;
Expand Down

0 comments on commit 57c7952

Please sign in to comment.