Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions extensions/cornerstone/src/initCornerstoneTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import * as polySeg from '@cornerstonejs/polymorphic-segmentation';
import CalibrationLineTool from './tools/CalibrationLineTool';
import ImageOverlayViewerTool from './tools/ImageOverlayViewerTool';
import SmartStackScrollTool from './tools/SmartStackScrollTool';
import PHIBoundingBoxTool from './tools/PHIBoundingBoxTool';

export default function initCornerstoneTools(configuration = {}) {
CrosshairsTool.isAnnotation = false;
Expand Down Expand Up @@ -119,6 +120,7 @@ export default function initCornerstoneTools(configuration = {}) {
addTool(SplineContourSegmentationTool);
addTool(LabelMapEditWithContourTool);
addTool(SmartStackScrollTool);
addTool(PHIBoundingBoxTool);
// Modify annotation tools to use dashed lines on SR
const annotationStyle = {
textBoxFontSize: '15px',
Expand Down Expand Up @@ -183,6 +185,7 @@ const toolNames = {
SplineContourSegmentation: SplineContourSegmentationTool.toolName,
LabelMapEditWithContourTool: LabelMapEditWithContourTool.toolName,
SmartStackScroll: SmartStackScrollTool.toolName,
PHIBoundingBox: PHIBoundingBoxTool.toolName,
};

export { toolNames };
9 changes: 9 additions & 0 deletions extensions/cornerstone/src/initMeasurementService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const initMeasurementService = (
Angle,
CobbAngle,
RectangleROI,
PHIBoundingBox,
PlanarFreehandROI,
SplineROI,
LivewireContour,
Expand Down Expand Up @@ -128,6 +129,14 @@ const initMeasurementService = (
RectangleROI.toMeasurement
);

measurementService.addMapping(
csTools3DVer1MeasurementSource,
'PHIBoundingBox',
PHIBoundingBox.matchingCriteria,
PHIBoundingBox.toAnnotation,
PHIBoundingBox.toMeasurement
);

measurementService.addMapping(
csTools3DVer1MeasurementSource,
'PlanarFreehandROI',
Expand Down
16 changes: 16 additions & 0 deletions extensions/cornerstone/src/tools/PHIBoundingBoxTool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { RectangleROITool } from '@cornerstonejs/tools';

class PHIBoundingBoxTool extends RectangleROITool {
static toolName = 'PHIBoundingBox';

constructor(
toolProps = {},
defaultToolProps = {
configuration: { getTextLines: () => ['PHI Bounding Box'] },
}
) {
super(toolProps, defaultToolProps);
}
}

export default PHIBoundingBoxTool;
3 changes: 2 additions & 1 deletion extensions/cornerstone/src/tools/SmartStackScrollTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { getEnabledElement, getEnabledElementByIds } from '@cornerstonejs/core';
import { StackScrollTool, Types } from '@cornerstonejs/tools';

class SmartStackScrollTool extends StackScrollTool {
static toolName = 'SmartStackScroll';

parentDragCallback: (evt: Types.EventTypes.InteractionEventType) => void;
parentMouseWheelCallback: (evt: Types.EventTypes.MouseWheelEventType) => void;

Expand Down Expand Up @@ -45,5 +47,4 @@ class SmartStackScrollTool extends StackScrollTool {
}
}

SmartStackScrollTool.toolName = 'SmartStackScroll';
export default SmartStackScrollTool;
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const supportedTools = [
'CobbAngle',
'Probe',
'RectangleROI',
'PHIBoundingBox',
'PlanarFreehandROI',
'SplineROI',
'LivewireContour',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,22 @@ const measurementServiceMappingsFactory = (
},
],
},
PHIBoundingBox: {
toAnnotation: RectangleROI.toAnnotation,
toMeasurement: csToolsAnnotation =>
RectangleROI.toMeasurement(
csToolsAnnotation,
displaySetService,
cornerstoneViewportService,
_getValueTypeFromToolType,
customizationService
),
matchingCriteria: [
{
valueType: MeasurementService.VALUE_TYPES.POLYLINE,
},
],
},
PlanarFreehandROI: {
toAnnotation: PlanarFreehandROI.toAnnotation,
toMeasurement: csToolsAnnotation =>
Expand Down
12 changes: 11 additions & 1 deletion extensions/measurement-tracking/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import getContextModule from './getContextModule';
import getContextModule, { useTrackedMeasurements } from './getContextModule';
import getPanelModule from './getPanelModule';
import getViewportModule from './getViewportModule';
import { id } from './id.js';
Expand Down Expand Up @@ -51,6 +51,16 @@ const measurementTrackingExtension = {
});
},
getCustomizationModule,
getUtilityModule() {
return [
{
name: 'measurement-tracking',
exports: {
useTrackedMeasurements,
},
},
];
},
};

export default measurementTrackingExtension;
Expand Down
2 changes: 2 additions & 0 deletions modes/basic/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ export const toolbarSections = {
'SegmentLabelTool',
'OPFSTool',
],

PHIBoundingBox: ['PHIBoundingBox'],
};

export const basicLayout = {
Expand Down
2 changes: 2 additions & 0 deletions modes/basic/src/initToolGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function initDefaultToolGroup(extensionManager, toolGroupService, commandsManage
{ toolName: toolNames.EllipticalROI },
{ toolName: toolNames.CircleROI },
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why there are two duplicated config here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the query is about the duplicate configs, it is for different toolGroups.
If the query is about the duplicate tools, then they are separate tools for drawing circles, ellipses, etc.

{ toolName: toolNames.RectangleROI },
{ toolName: toolNames.PHIBoundingBox },
{
toolName: toolNames.SmartStackScroll,
bindings: [
Expand Down Expand Up @@ -231,6 +232,7 @@ function initMPRToolGroup(extensionManager, toolGroupService, commandsManager) {
{ toolName: toolNames.EllipticalROI },
{ toolName: toolNames.CircleROI },
{ toolName: toolNames.RectangleROI },
{ toolName: toolNames.PHIBoundingBox },
{ toolName: toolNames.StackScroll },
{ toolName: toolNames.Angle },
{ toolName: toolNames.CobbAngle },
Expand Down
11 changes: 11 additions & 0 deletions modes/basic/src/toolbarButtons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,17 @@ const toolbarButtons: Button[] = [
evaluate: 'evaluate.cornerstoneTool',
},
},
{
id: 'PHIBoundingBox',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-rectangle',
label: i18n.t('Buttons:PHIBoundingBox'),
tooltip: i18n.t('Buttons:PHI BoundingBox'),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a typo?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a typo. This is the viewer tooltip naming convention

commands: setToolActiveToolbar,
evaluate: 'evaluate.cornerstoneTool',
},
},
{
id: 'CircleROI',
uiType: 'ohif.toolButton',
Expand Down
2 changes: 2 additions & 0 deletions modes/segmentation/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ function modeFactory({ modeConfiguration }) {

toolbarService.updateSection('BrushTools', ['Brush', 'Eraser', 'Threshold']);

toolbarService.updateSection('PHIBoundingBox', ['PHIBoundingBox']);

// Making the 'cornerstone.panelTool' the default/first right panel will automaically
// handle the evaluate functions for segmentation panel tools through the toolbox components.
// But since we changed the order, we need to call this here to handle the evaluate functions.
Expand Down
1 change: 1 addition & 0 deletions modes/segmentation/src/initToolGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ function createTools({ utilityModule, commandsManager }) {
},
},
},
{ toolName: toolNames.PHIBoundingBox },
],
disabled: [{ toolName: toolNames.ReferenceLines }, { toolName: toolNames.AdvancedMagnify }],
};
Expand Down
11 changes: 11 additions & 0 deletions modes/segmentation/src/toolbarButtons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,17 @@ export const toolbarButtons: Button[] = [
commands: 'showOPFSManagementTool',
},
},
{
id: 'PHIBoundingBox',
uiType: 'ohif.toolButton',
props: {
icon: 'tool-rectangle',
label: i18n.t('Buttons:PHIBoundingBox'),
tooltip: i18n.t('Buttons:PHI BoundingBox'),
commands: setToolActiveToolbar,
evaluate: 'evaluate.cornerstoneTool',
},
},
];

export default toolbarButtons;
2 changes: 1 addition & 1 deletion platform/app/public/config/gradient.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ window.config = {
showStudyList: true,
// some windows systems have issues with more than 3 web workers
maxNumberOfWebWorkers: 3,

measurementTrackingMode: 'simplified',
// below flag is for performance reasons, but it might not work for all servers
omitQuotationForMultipartRequest: true,
showWarningMessageForCrossOrigin: true,
Expand Down
2 changes: 1 addition & 1 deletion platform/app/public/config/gradient_production.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ window.config = {
showStudyList: true,
// some windows systems have issues with more than 3 web workers
maxNumberOfWebWorkers: 3,

measurementTrackingMode: 'simplified',
// below flag is for performance reasons, but it might not work for all servers
omitQuotationForMultipartRequest: true,
showWarningMessageForCrossOrigin: true,
Expand Down