Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkunGao committed Jun 6, 2024
1 parent 0d108c0 commit 9db60ea
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 114 deletions.
30 changes: 16 additions & 14 deletions src/Utils/segmentation/CommToolsData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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 },
};

Expand All @@ -97,7 +102,7 @@ export class CommToolsData {
index: 0,
updated: false,
},
};
};

gui_states: IGUIStates = {
mainAreaSize: 3,
Expand All @@ -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,
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -247,10 +252,7 @@ export class CommToolsData {
/**
* Rewrite this {createEmptyPaintImage} function under NrrdTools
*/
createEmptyPaintImage(
dimensions: Array<number>,
paintImages: IPaintImages
) {
createEmptyPaintImage(dimensions: Array<number>, paintImages: IPaintImages) {
throw new Error(
"Child class must implement abstract clearStoreImages, currently you can find it in NrrdTools."
);
Expand Down
205 changes: 105 additions & 100 deletions src/Utils/segmentation/coreTools/coreType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ interface IDrawingEvents {
}

interface IContrastEvents {
move_x:number;
move_y:number;
move_x: number;
move_y: number;
x: number;
y: number;
w: number;
h: number;
handleOnContrastMouseDown: (ev: MouseEvent) => void;
handleOnContrastMouseMove: (ev: MouseEvent) => void;
handleOnContrastMouseUp: (ev: MouseEvent) => void;
handleOnContrastMouseLeave:(ev: MouseEvent) => void;
handleOnContrastMouseLeave: (ev: MouseEvent) => void;
}

// drawing on canvas
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down Expand Up @@ -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,
Expand All @@ -392,5 +397,5 @@ export {
IMaskData,
IUndoType,
ICursorPage,
IGuiParameterSettings
IGuiParameterSettings,
};

0 comments on commit 9db60ea

Please sign in to comment.