From 9db60eabfd7b99729efca40a783ae81fec13e6ed Mon Sep 17 00:00:00 2001 From: LinkunGao Date: Thu, 6 Jun 2024 23:53:51 +1200 Subject: [PATCH] fix bug --- src/Utils/segmentation/CommToolsData.ts | 30 +-- src/Utils/segmentation/coreTools/coreType.ts | 205 ++++++++++--------- 2 files changed, 121 insertions(+), 114 deletions(-) diff --git a/src/Utils/segmentation/CommToolsData.ts b/src/Utils/segmentation/CommToolsData.ts index 2d412bc..b324a37 100644 --- a/src/Utils/segmentation/CommToolsData.ts +++ b/src/Utils/segmentation/CommToolsData.ts @@ -6,10 +6,10 @@ import { ICursorPage, IPaintImages, IConvertObjType, + ICommXYZ, } from "./coreTools/coreType"; import { switchPencilIcon } from "../utils"; import { enableDownload } from "./coreTools/divControlTools"; -import { ICommXYZ } from "copper3d/dist/types/Utils/segmentation/coreTools/coreType"; export class CommToolsData { baseCanvasesSize: number = 1; @@ -47,10 +47,10 @@ export class CommToolsData { skinSphereOrigin: null, ribSphereOrigin: null, nippleSphereOrigin: null, - tumourColor:"#00ff00", - skinColor:"#FFEB3B", - ribcageColor:"#2196F3", - nippleColor:"#E91E63", + tumourColor: "#00ff00", + skinColor: "#FFEB3B", + ribcageColor: "#2196F3", + nippleColor: "#E91E63", spherePlanB: true, sphereRadius: 10, @@ -74,7 +74,12 @@ export class CommToolsData { clearAllFlag: boolean ) => {}, getSphere: (sphereOrigin: number[], sphereRadius: number) => {}, - getCalculateSpherePositions:(tumourSphereOrigin:ICommXYZ|null, skinSphereOrigin:ICommXYZ|null, ribSphereOrigin:ICommXYZ|null, nippleSphereOrigin:ICommXYZ|null,)=>{}, + getCalculateSpherePositions: ( + tumourSphereOrigin: ICommXYZ | null, + skinSphereOrigin: ICommXYZ | null, + ribSphereOrigin: ICommXYZ | null, + nippleSphereOrigin: ICommXYZ | null + ) => {}, drawStartPos: { x: 1, y: 1 }, }; @@ -97,7 +102,7 @@ export class CommToolsData { index: 0, updated: false, }, - }; + }; gui_states: IGUIStates = { mainAreaSize: 3, @@ -112,9 +117,9 @@ export class CommToolsData { brushAndEraserSize: 15, cursor: "dot", label: "label1", - cal_distance:"tumour", + cal_distance: "tumour", sphere: false, - calculator:false, + calculator: false, readyToUpdate: true, defaultPaintCursor: switchPencilIcon("dot"), max_sensitive: 100, @@ -164,7 +169,7 @@ export class CommToolsData { currentShowingSlice: undefined, mainPreSlices: undefined, Is_Shift_Pressed: false, - Is_Ctrl_Pressed:false, + Is_Ctrl_Pressed: false, Is_Draw: false, axis: "z", maskData: { @@ -247,10 +252,7 @@ export class CommToolsData { /** * Rewrite this {createEmptyPaintImage} function under NrrdTools */ - createEmptyPaintImage( - dimensions: Array, - paintImages: IPaintImages - ) { + createEmptyPaintImage(dimensions: Array, paintImages: IPaintImages) { throw new Error( "Child class must implement abstract clearStoreImages, currently you can find it in NrrdTools." ); diff --git a/src/Utils/segmentation/coreTools/coreType.ts b/src/Utils/segmentation/coreTools/coreType.ts index 7ce5ac7..103d07a 100644 --- a/src/Utils/segmentation/coreTools/coreType.ts +++ b/src/Utils/segmentation/coreTools/coreType.ts @@ -48,8 +48,8 @@ interface IDrawingEvents { } interface IContrastEvents { - move_x:number; - move_y:number; + move_x: number; + move_y: number; x: number; y: number; w: number; @@ -57,7 +57,7 @@ interface IContrastEvents { handleOnContrastMouseDown: (ev: MouseEvent) => void; handleOnContrastMouseMove: (ev: MouseEvent) => void; handleOnContrastMouseUp: (ev: MouseEvent) => void; - handleOnContrastMouseLeave:(ev: MouseEvent) => void; + handleOnContrastMouseLeave: (ev: MouseEvent) => void; } // drawing on canvas @@ -94,7 +94,7 @@ interface IProtected { currentShowingSlice: any; mainPreSlices: any; Is_Shift_Pressed: boolean; - Is_Ctrl_Pressed:boolean; + Is_Ctrl_Pressed: boolean; Is_Draw: boolean; axis: "x" | "y" | "z"; maskData: IMaskData; @@ -136,9 +136,9 @@ interface IGUIStates { brushAndEraserSize: number; cursor: string; label: string; - cal_distance:"tumour" | "skin" | "nipple" | "ribcage"; + cal_distance: "tumour" | "skin" | "nipple" | "ribcage"; sphere: boolean; - calculator:boolean; + calculator: boolean; // subView: boolean; // subViewScale: number; readyToUpdate: boolean; @@ -182,14 +182,14 @@ interface INrrdStates { cursorPageX: number; cursorPageY: number; sphereOrigin: ICommXYZ; - tumourSphereOrigin: ICommXYZ | null, - skinSphereOrigin: ICommXYZ | null, - ribSphereOrigin: ICommXYZ | null, - nippleSphereOrigin: ICommXYZ | null, - tumourColor:"#00ff00", - skinColor:"#FFEB3B", - ribcageColor:"#2196F3", - nippleColor:"#E91E63", + tumourSphereOrigin: ICommXYZ | null; + skinSphereOrigin: ICommXYZ | null; + ribSphereOrigin: ICommXYZ | null; + nippleSphereOrigin: ICommXYZ | null; + tumourColor: "#00ff00"; + skinColor: "#FFEB3B"; + ribcageColor: "#2196F3"; + nippleColor: "#E91E63"; spherePlanB: boolean; sphereRadius: number; Mouse_Over_x: number; @@ -212,7 +212,12 @@ interface INrrdStates { clearAllFlag: boolean ) => void; getSphere: (sphereOrigin: number[], sphereRadius: number) => void; - getCalculateSpherePositions:(tumourSphereOrigin:ICommXYZ|null, skinSphereOrigin:ICommXYZ|null, ribSphereOrigin:ICommXYZ|null, nippleSphereOrigin:ICommXYZ|null,)=>void, + getCalculateSpherePositions: ( + tumourSphereOrigin: ICommXYZ | null, + skinSphereOrigin: ICommXYZ | null, + ribSphereOrigin: ICommXYZ | null, + nippleSphereOrigin: ICommXYZ | null + ) => void; drawStartPos: ICommXY; } @@ -266,111 +271,111 @@ interface ICursorPage { interface IGuiParameterSettings { globalAlpha: { - name: "Opacity", - min: number, - max: number, - step: number, - }, + name: "Opacity"; + min: number; + max: number; + step: number; + }; segmentation: { - name: "Pencil", - onChange: ()=>void, - }, + name: "Pencil"; + onChange: () => void; + }; sphere: { - name: "Sphere", - onChange: ()=>void, - }, + name: "Sphere"; + onChange: () => void; + }; brushAndEraserSize: { - name: "BrushAndEraserSize", - min: number, - max: number, - step: number, - onChange: ()=>void, - }, + name: "BrushAndEraserSize"; + min: number; + max: number; + step: number; + onChange: () => void; + }; Eraser: { - name: "Eraser", - onChange: ()=>void, - }, - calculator:{ - name:"Calculator", - onChange: ()=>void, - }, - cal_distance:{ - name:"CalculatorDistance", - onChange: (val:"tumour"|"skin"|"ribcage"|"nipple")=>void - } + name: "Eraser"; + onChange: () => void; + }; + calculator: { + name: "Calculator"; + onChange: () => void; + }; + cal_distance: { + name: "CalculatorDistance"; + onChange: (val: "tumour" | "skin" | "ribcage" | "nipple") => void; + }; clear: { - name: "Clear", - }, + name: "Clear"; + }; clearAll: { - name: "ClearAll", - }, + name: "ClearAll"; + }; undo: { - name: "Undo", - }, + name: "Undo"; + }; resetZoom: { - name: "ResetZoom", - }, + name: "ResetZoom"; + }; windowHigh: { - name: "ImageContrast", - value: null, - min: number, - max: number, - step: number, - onChange: (value: number)=>void, - onFinished: ()=>void, - }, + name: "ImageContrast"; + value: null; + min: number; + max: number; + step: number; + onChange: (value: number) => void; + onFinished: () => void; + }; windowLow: { - name: "WindowLow", - value: null, - min: number, - max: number, - step: number, - onChange: (value: number)=>void, - onFinished: ()=>void, - }, + name: "WindowLow"; + value: null; + min: number; + max: number; + step: number; + onChange: (value: number) => void; + onFinished: () => void; + }; advance: { label: { - name: "Label", - value: ["label1", "label2", "label3"], - }, + name: "Label"; + value: ["label1", "label2", "label3"]; + }; cursor: { - name: "CursorIcon", - value: ["crosshair", "pencil", "dot"], - }, + name: "CursorIcon"; + value: ["crosshair", "pencil", "dot"]; + }; mainAreaSize: { - name: "Zoom", - min: number, - max: number, - step: number, - onFinished: null, - }, + name: "Zoom"; + min: number; + max: number; + step: number; + onFinished: null; + }; dragSensitivity: { - name: "DragSensitivity", - min: number, - max: number, - step: number, - }, + name: "DragSensitivity"; + min: number; + max: number; + step: number; + }; pencilSettings: { lineWidth: { - name: "OuterLineWidth", - min: number, - max: number, - step: number, - }, + name: "OuterLineWidth"; + min: number; + max: number; + step: number; + }; color: { - name: "Color", - }, + name: "Color"; + }; fillColor: { - name: "FillColor", - }, - }, + name: "FillColor"; + }; + }; BrushSettings: { brushColor: { - name: "BrushColor", - }, - }, - }, -}; + name: "BrushColor"; + }; + }; + }; +} export { ICommXYZ, @@ -392,5 +397,5 @@ export { IMaskData, IUndoType, ICursorPage, - IGuiParameterSettings + IGuiParameterSettings, };