|
@@ -90,7 +90,25 @@ function registerTools(viewportId, renderingEngineId) {
|
|
|
|
|
|
toolGroup.addViewport(viewportId, renderingEngineId);
|
|
toolGroup.addViewport(viewportId, renderingEngineId);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+function addLMark(): void {
|
|
|
|
+ // Implement the logic to add an L mark
|
|
|
|
+ console.log('Adding L Mark');
|
|
|
|
+ toolGroup.setToolActive(LabelTool.toolName, {
|
|
|
|
+ bindings: [
|
|
|
|
+ // {
|
|
|
|
+ // mouseButton: MouseBindings.Primary, // Left Click
|
|
|
|
+ // },
|
|
|
|
+ ],
|
|
|
|
+ });
|
|
|
|
+ const position: Types.Point3 = [100, 100, 0]; // Example position
|
|
|
|
+ const text = 'L'; // Predefined text
|
|
|
|
+ LabelTool.hydrate(currentViewportId, position, text);
|
|
|
|
+ toolGroup.setToolPassive(LabelTool.toolName, {
|
|
|
|
+ removeAllBindings: true,
|
|
|
|
+ });
|
|
|
|
+ // const enabledElement = cornerstone.getEnabledElementByViewportId(currentViewportId);
|
|
|
|
+ // cursors.elementCursor.resetElementCursor(elementRef.current as HTMLDivElement);
|
|
|
|
+}
|
|
function addRLabel(viewportId) {
|
|
function addRLabel(viewportId) {
|
|
toolGroup.setToolActive(LabelTool.toolName, {
|
|
toolGroup.setToolActive(LabelTool.toolName, {
|
|
bindings: [],
|
|
bindings: [],
|
|
@@ -116,6 +134,22 @@ function deleteSelectedMark(): void {
|
|
}
|
|
}
|
|
viewport.render();
|
|
viewport.render();
|
|
}
|
|
}
|
|
|
|
+function HorizontalFlip(): void {
|
|
|
|
+ const viewport = cornerstone.getEnabledElementByViewportId(currentViewportId)
|
|
|
|
+ .viewport as cornerstone.StackViewport;
|
|
|
|
+ // 切换水平翻转状态
|
|
|
|
+ const { flipHorizontal } = viewport.getCamera();
|
|
|
|
+ viewport.setCamera({ flipHorizontal: !flipHorizontal });
|
|
|
|
+ console.log('Flipping Image Horizontally');
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function VerticalFlip(): void {
|
|
|
|
+ const viewport = cornerstone.getEnabledElementByViewportId(currentViewportId)
|
|
|
|
+ .viewport as cornerstone.StackViewport;
|
|
|
|
+ // 切换竖直翻转状态
|
|
|
|
+ const { flipVertical } = viewport.getCamera();
|
|
|
|
+ viewport.setCamera({ flipVertical: !flipVertical });
|
|
|
|
+}
|
|
|
|
|
|
const StackViewer = ({
|
|
const StackViewer = ({
|
|
imageIndex = 0,
|
|
imageIndex = 0,
|
|
@@ -196,23 +230,7 @@ const StackViewer = ({
|
|
// Handle the action
|
|
// Handle the action
|
|
switch (action) {
|
|
switch (action) {
|
|
case 'Add L Mark':
|
|
case 'Add L Mark':
|
|
- // Implement the logic to add an L mark
|
|
|
|
- console.log('Adding L Mark');
|
|
|
|
- toolGroup.setToolActive(LabelTool.toolName, {
|
|
|
|
- bindings: [
|
|
|
|
- // {
|
|
|
|
- // mouseButton: MouseBindings.Primary, // Left Click
|
|
|
|
- // },
|
|
|
|
- ],
|
|
|
|
- });
|
|
|
|
- const position: Types.Point3 = [100, 100, 0]; // Example position
|
|
|
|
- const text = 'L'; // Predefined text
|
|
|
|
- LabelTool.hydrate(currentViewportId, position, text);
|
|
|
|
- toolGroup.setToolPassive(LabelTool.toolName, {
|
|
|
|
- removeAllBindings: true,
|
|
|
|
- });
|
|
|
|
- // const enabledElement = cornerstone.getEnabledElementByViewportId(currentViewportId);
|
|
|
|
- // cursors.elementCursor.resetElementCursor(elementRef.current as HTMLDivElement);
|
|
|
|
|
|
+ addLMark();
|
|
break;
|
|
break;
|
|
case 'Add R Mark':
|
|
case 'Add R Mark':
|
|
// Implement the logic to add an R mark
|
|
// Implement the logic to add an R mark
|
|
@@ -224,8 +242,11 @@ const StackViewer = ({
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case 'Horizontal Flip': {
|
|
case 'Horizontal Flip': {
|
|
- // Implement the logic to flip the image horizontally
|
|
|
|
- console.log('Flipping Image Horizontally');
|
|
|
|
|
|
+ HorizontalFlip();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case 'Vertical Flip': {
|
|
|
|
+ VerticalFlip();
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case 'Rotate Counterclockwise 90': {
|
|
case 'Rotate Counterclockwise 90': {
|