copper3d 2.0.9 → 2.1.1

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.
@@ -15,6 +15,10 @@ export declare class DrawToolCore extends CommToolsData {
15
15
  setPencilIconUrls(urls: string[]): void;
16
16
  private setCurrentLayer;
17
17
  draw(opts?: IDrawOpts): void;
18
+ drawCalSphereDown(x: number, y: number, sliceIndex: number, cal_position: "tumour" | "skin" | "nipple" | "ribcage"): void;
19
+ drawCalSphereUp(): void;
20
+ private zoomActionAfterDrawSphere;
21
+ private clearSpherePrintStoreImages;
18
22
  private paintOnCanvas;
19
23
  /*************************************May consider to move outside *******************************************/
20
24
  private drawLine;
@@ -25,13 +29,26 @@ export declare class DrawToolCore extends CommToolsData {
25
29
  private configMouseZoomWheel;
26
30
  private enableCrosshair;
27
31
  drawImageOnEmptyImage(canvas: HTMLCanvasElement): void;
32
+ /****************************Sphere calculate distance functions****************************************************/
33
+ private getSpherePosition;
34
+ drawCalculatorSphereOnEachViews(axis: "x" | "y" | "z"): void;
28
35
  /****************************Sphere functions****************************************************/
29
36
  private storeSphereImages;
30
37
  private drawSphereOnEachViews;
38
+ /**
39
+ *
40
+ * @param ctx draw sphere canvas ctx
41
+ * @param x width must be match the origin size, size factor 1, ignore the size factor
42
+ * @param y height must be match the origin size, size factor 1, ignore the size factor
43
+ * @param radius radius must be match the origin size, size factor 1, ignore the size factor
44
+ * @param color sphere color
45
+ */
31
46
  private drawSphereCore;
32
47
  private setSphereCanvasSize;
33
48
  private configMouseSphereWheel;
49
+ drawCalculatorSphere(radius: number): void;
34
50
  drawSphere(mouseX: number, mouseY: number, radius: number): void;
51
+ private clearSphereCanvas;
35
52
  /**
36
53
  * We generate the MRI slice from threejs based on mm, but when we display it is based on pixel size/distance.
37
54
  * So, the index munber on each axis (sagittal, axial, coronal) is the slice's depth in mm distance. And the width and height displayed on screen is the slice's width and height in pixel distance.
@@ -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, IGuiParameterSettings } from "./coreTools/coreType";
3
+ import { IPaintImages, 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 {
@@ -61,13 +61,14 @@ export declare class NrrdTools extends DrawToolCore {
61
61
  getVoxelSpacing(): number[];
62
62
  getSpaceOrigin(): number[];
63
63
  getMaskData(): IMaskData;
64
+ setCalculateDistanceSphere(x: number, y: number, sliceIndex: number, cal_position: "tumour" | "skin" | "nipple" | "ribcage"): void;
64
65
  private getSharedPlace;
65
66
  /**
66
67
  * init all painted images for store images
67
68
  * @param dimensions
68
69
  */
69
70
  private initPaintImages;
70
- private createEmptyPaintImage;
71
+ createEmptyPaintImage(dimensions: Array<number>, paintImages: IPaintImages): void;
71
72
  /**
72
73
  * Switch all contrast slices' orientation
73
74
  * @param {string} aixs:"x" | "y" | "z"
@@ -124,7 +124,9 @@ interface IGUIStates {
124
124
  brushAndEraserSize: number;
125
125
  cursor: string;
126
126
  label: string;
127
+ cal_distance: "tumour" | "skin" | "nipple" | "ribcage";
127
128
  sphere: boolean;
129
+ calculator: boolean;
128
130
  readyToUpdate: boolean;
129
131
  defaultPaintCursor: string;
130
132
  max_sensitive: number;
@@ -163,6 +165,14 @@ interface INrrdStates {
163
165
  cursorPageX: number;
164
166
  cursorPageY: number;
165
167
  sphereOrigin: ICommXYZ;
168
+ tumourSphereOrigin: ICommXYZ | null;
169
+ skinSphereOrigin: ICommXYZ | null;
170
+ ribSphereOrigin: ICommXYZ | null;
171
+ nippleSphereOrigin: ICommXYZ | null;
172
+ tumourColor: "#00ff00";
173
+ skinColor: "#FFEB3B";
174
+ ribcageColor: "#2196F3";
175
+ nippleColor: "#E91E63";
166
176
  spherePlanB: boolean;
167
177
  sphereRadius: number;
168
178
  Mouse_Over_x: number;
@@ -177,6 +187,7 @@ interface INrrdStates {
177
187
  labels: ["label1", "label2", "label3"];
178
188
  getMask: (mask: ImageData, sliceId: number, label: string, width: number, height: number, clearAllFlag: boolean) => void;
179
189
  getSphere: (sphereOrigin: number[], sphereRadius: number) => void;
190
+ getCalculateSpherePositions: (tumourSphereOrigin: ICommXYZ | null, skinSphereOrigin: ICommXYZ | null, ribSphereOrigin: ICommXYZ | null, nippleSphereOrigin: ICommXYZ | null, aixs: "x" | "y" | "z") => void;
180
191
  drawStartPos: ICommXY;
181
192
  }
182
193
  interface IDragOpts {
@@ -186,6 +197,7 @@ interface IDragOpts {
186
197
  interface IDrawOpts {
187
198
  getMaskData?: (mask: ImageData, sliceId: number, label: string, width: number, height: number, clearAllFlag?: boolean) => void;
188
199
  getSphereData?: (sphereOrigin: number[], sphereRadius: number) => void;
200
+ getCalculateSpherePositionsData?: (tumourSphereOrigin: ICommXYZ | null, skinSphereOrigin: ICommXYZ | null, ribSphereOrigin: ICommXYZ | null, nippleSphereOrigin: ICommXYZ | null, aixs: "x" | "y" | "z") => void;
189
201
  }
190
202
  type UndoLayerType = {
191
203
  label1: Array<HTMLImageElement>;
@@ -242,6 +254,14 @@ interface IGuiParameterSettings {
242
254
  name: "Eraser";
243
255
  onChange: () => void;
244
256
  };
257
+ calculator: {
258
+ name: "Calculator";
259
+ onChange: () => void;
260
+ };
261
+ cal_distance: {
262
+ name: "CalculatorDistance";
263
+ onChange: (val: "tumour" | "skin" | "ribcage" | "nipple") => void;
264
+ };
245
265
  clear: {
246
266
  name: "Clear";
247
267
  };
@@ -17,8 +17,8 @@ import { Copper3dTrackballControls } from "./Controls/Copper3dTrackballControls"
17
17
  import { MeshNodeTool } from "./Utils/MeshNodeTool";
18
18
  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
- import { IPaintImage } from "./Utils/segmentation/coreTools/coreType";
20
+ import { IPaintImage, ICommXYZ } from "./Utils/segmentation/coreTools/coreType";
21
21
  import "./css/style.css";
22
- export declare const REVISION = "v2.0.9";
22
+ export declare const REVISION = "v2.1.1";
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
- export type { positionType, screenPosType, optsType, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, };
24
+ export type { positionType, screenPosType, optsType, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, ICommXYZ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "copper3d",
3
3
  "description": "A 3d visualisation package base on threejs provides multiple scenes and Nrrd image load funtion.",
4
- "version": "2.0.9",
4
+ "version": "2.1.1",
5
5
  "main": "dist/bundle.umd.js",
6
6
  "moudle": "dist/bundle.esm.js",
7
7
  "types": "dist/types/index.d.ts",