|
@@ -11,7 +11,7 @@ import { clearAction } from '@/states/view/functionAreaSlice';
|
|
import { useDispatch } from 'react-redux';
|
|
import { useDispatch } from 'react-redux';
|
|
import { IP_PORT } from '@/API/config';
|
|
import { IP_PORT } from '@/API/config';
|
|
|
|
|
|
-const { PanTool, WindowLevelTool, StackScrollTool, ZoomTool, LabelTool, ToolGroupManager, Enums: csToolsEnums } = cornerstoneTools;
|
|
|
|
|
|
+const { PanTool, WindowLevelTool, StackScrollTool, ZoomTool, LabelTool, ToolGroupManager, Enums: csToolsEnums, PlanarRotateTool } = cornerstoneTools;
|
|
const { MouseBindings } = csToolsEnums;
|
|
const { MouseBindings } = csToolsEnums;
|
|
let toolGroup: cornerstoneTools.Types.IToolGroup;
|
|
let toolGroup: cornerstoneTools.Types.IToolGroup;
|
|
let currentViewportId: string;
|
|
let currentViewportId: string;
|
|
@@ -23,6 +23,7 @@ function registerTools(viewportId, renderingEngineId) {
|
|
cornerstoneTools.addTool(StackScrollTool);
|
|
cornerstoneTools.addTool(StackScrollTool);
|
|
cornerstoneTools.addTool(ZoomTool);
|
|
cornerstoneTools.addTool(ZoomTool);
|
|
cornerstoneTools.addTool(LabelTool);
|
|
cornerstoneTools.addTool(LabelTool);
|
|
|
|
+ cornerstoneTools.addTool(PlanarRotateTool);
|
|
// Define a tool group
|
|
// Define a tool group
|
|
const toolGroupId = 'STACK_TOOL_GROUP_ID';
|
|
const toolGroupId = 'STACK_TOOL_GROUP_ID';
|
|
const toolGroupTmp = ToolGroupManager.createToolGroup(toolGroupId);
|
|
const toolGroupTmp = ToolGroupManager.createToolGroup(toolGroupId);
|
|
@@ -36,6 +37,7 @@ function registerTools(viewportId, renderingEngineId) {
|
|
toolGroup.addTool(StackScrollTool.toolName);
|
|
toolGroup.addTool(StackScrollTool.toolName);
|
|
toolGroup.addTool(ZoomTool.toolName);
|
|
toolGroup.addTool(ZoomTool.toolName);
|
|
toolGroup.addTool(LabelTool.toolName);
|
|
toolGroup.addTool(LabelTool.toolName);
|
|
|
|
+ toolGroup.addTool(PlanarRotateTool.toolName);
|
|
|
|
|
|
// Set the LabelTool as active
|
|
// Set the LabelTool as active
|
|
// toolGroup.setToolActive(LabelTool.toolName, {
|
|
// toolGroup.setToolActive(LabelTool.toolName, {
|
|
@@ -229,7 +231,23 @@ const StackViewer = ({ imageIndex }) => {
|
|
break;
|
|
break;
|
|
case 'Rotate Any Angle':
|
|
case 'Rotate Any Angle':
|
|
// Implement the logic to rotate the image by any angle
|
|
// Implement the logic to rotate the image by any angle
|
|
- console.log('Rotating Image by Any Angle');
|
|
|
|
|
|
+ {
|
|
|
|
+ const planar = toolGroup.getToolInstance(PlanarRotateTool.toolName); // Reset rotation angle
|
|
|
|
+ const isActive = planar.mode === csToolsEnums.ToolModes.Active;
|
|
|
|
+ console.log(`PlanarRotateTool is currently ${isActive ? 'active' : 'inactive'}`);
|
|
|
|
+ if (isActive) {
|
|
|
|
+ toolGroup.setToolPassive(PlanarRotateTool.toolName, { removeAllBindings: true });
|
|
|
|
+ } else {
|
|
|
|
+ toolGroup.setToolActive(PlanarRotateTool.toolName, {
|
|
|
|
+ bindings: [
|
|
|
|
+ {
|
|
|
|
+ mouseButton: MouseBindings.Primary, // Left Click
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ console.log('Rotating Image by Any Angle');
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case 'Crop Image':
|
|
case 'Crop Image':
|
|
// Implement the logic to crop the image
|
|
// Implement the logic to crop the image
|