diff --git a/package-lock.json b/package-lock.json index 525789a..4910c01 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "copper3d", - "version": "2.1.2", + "version": "2.1.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "copper3d", - "version": "2.1.2", + "version": "2.1.3", "license": "Apache-2.0", "dependencies": { "@types/dat.gui": "^0.7.9", diff --git a/package.json b/package.json index c38b3d7..9ebe846 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "copper3d", "description": "A 3d visualisation package base on threejs provides multiple scenes and Nrrd image load funtion.", - "version": "2.1.2", + "version": "2.1.3", "main": "dist/bundle.umd.js", "moudle": "dist/bundle.esm.js", "types": "dist/types/index.d.ts", diff --git a/src/Utils/segmentation/DrawToolCore.ts b/src/Utils/segmentation/DrawToolCore.ts index be0a60f..cb8d4dc 100644 --- a/src/Utils/segmentation/DrawToolCore.ts +++ b/src/Utils/segmentation/DrawToolCore.ts @@ -1333,7 +1333,7 @@ export class DrawToolCore extends CommToolsData { }, y: { x: (val: number) => Math.ceil((val / nrrd_y_mm) * dimensions[1]), - z: (val: number) => Math.ceil((val / nrrd_z_mm) * dimensions[2]), + z: (val: number) => Math.ceil((1- val / nrrd_z_mm) * dimensions[2]), }, z: { x: (val: number) => Math.ceil((val / nrrd_x_mm) * dimensions[0]), @@ -1359,7 +1359,7 @@ export class DrawToolCore extends CommToolsData { x: (sliceIndex: number) => Math.ceil((sliceIndex / dimensions[2]) * nrrd_z_mm), y: (sliceIndex: number) => - Math.ceil((sliceIndex / dimensions[2]) * nrrd_z_mm), + Math.ceil((1 - sliceIndex / dimensions[2]) * nrrd_z_mm), }, }; @@ -1375,7 +1375,7 @@ export class DrawToolCore extends CommToolsData { currentIndex = convertIndex[from][to](cursorNumX); oldIndex = currentIndex * ratios.x; convertCursorNumY = convertCursor[from][to](currentSliceIndex); - convertCursorNumX = cursorNumY; + convertCursorNumX = dimensions[2] * ratios.z - cursorNumY; } else if (from === "z" && to === "y") { currentIndex = convertIndex[from][to](cursorNumY); oldIndex = currentIndex * ratios[to]; @@ -1385,7 +1385,7 @@ export class DrawToolCore extends CommToolsData { currentIndex = convertIndex[from][to](cursorNumY); oldIndex = currentIndex * ratios[to]; convertCursorNumX = convertCursor[from][to](currentSliceIndex); - convertCursorNumY = cursorNumX; + convertCursorNumY = dimensions[2] * ratios.z - cursorNumX; } else if (from === "x" && to === "z") { currentIndex = convertIndex[from][to](cursorNumX); oldIndex = currentIndex * ratios[to]; diff --git a/src/Utils/segmentation/NrrdTools.ts b/src/Utils/segmentation/NrrdTools.ts index a89b878..98e3cae 100644 --- a/src/Utils/segmentation/NrrdTools.ts +++ b/src/Utils/segmentation/NrrdTools.ts @@ -1127,6 +1127,12 @@ export class NrrdTools extends DrawToolCore { 0, -this.nrrd_states.changedHeight ); + }else if (this.protectedData.axis === "y") { + this.protectedData.ctxes.displayCtx?.scale(1, -1); + this.protectedData.ctxes.displayCtx?.translate( + 0, + -this.nrrd_states.changedHeight + ); } } diff --git a/src/index.ts b/src/index.ts index da7a42e..9b3ed73 100644 --- a/src/index.ts +++ b/src/index.ts @@ -44,10 +44,10 @@ import { IPaintImage, ICommXYZ } from "./Utils/segmentation/coreTools/coreType"; import "./css/style.css"; -export const REVISION = "v2.1.2"; +export const REVISION = "v2.1.3"; console.log( - "%cCopper3D Visualisation %cBeta:v2.1.2", + "%cCopper3D Visualisation %cBeta:v2.1.3", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25" );