feature(segmentation): Add contour tools and utilities in a side panel (#5517)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Dan Rukas <dan.rukas@gmail.com>
This commit is contained in:
73 files changed
+2770
-435
No files matched your search
@@ -1,53 +1,67 @@
|
||||
import React from 'react';
|
||||
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Toolbox } from '@ohif/extension-default';
|
||||
import PanelSegmentation from './panels/PanelSegmentation';
|
||||
import ActiveViewportWindowLevel from './components/ActiveViewportWindowLevel';
|
||||
import PanelMeasurement from './panels/PanelMeasurement';
|
||||
import { SegmentationRepresentations } from '@cornerstonejs/tools/enums';
|
||||
import i18n from '@ohif/i18n';
|
||||
|
||||
const getPanelModule = ({ commandsManager, servicesManager, extensionManager }: withAppTypes) => {
|
||||
const wrappedPanelSegmentation = ({ configuration }) => {
|
||||
const { toolbarService } = servicesManager.services;
|
||||
|
||||
const toolSectionMap = {
|
||||
[SegmentationRepresentations.Labelmap]: toolbarService.sections.labelMapSegmentationToolbox,
|
||||
[SegmentationRepresentations.Contour]: toolbarService.sections.contourSegmentationToolbox,
|
||||
};
|
||||
|
||||
const wrappedPanelSegmentation = props => {
|
||||
return (
|
||||
<PanelSegmentation
|
||||
commandsManager={commandsManager}
|
||||
servicesManager={servicesManager}
|
||||
extensionManager={extensionManager}
|
||||
configuration={{
|
||||
...configuration,
|
||||
...props?.configuration,
|
||||
}}
|
||||
segmentationRepresentationType={props?.segmentationRepresentationType}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const wrappedPanelSegmentationNoHeader = ({ configuration }) => {
|
||||
const wrappedPanelSegmentationNoHeader = props => {
|
||||
return (
|
||||
<PanelSegmentation
|
||||
commandsManager={commandsManager}
|
||||
servicesManager={servicesManager}
|
||||
extensionManager={extensionManager}
|
||||
configuration={{
|
||||
...configuration,
|
||||
...props?.configuration,
|
||||
}}
|
||||
segmentationRepresentationType={props?.segmentationRepresentationType}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const wrappedPanelSegmentationWithTools = ({ configuration }) => {
|
||||
const { toolbarService } = servicesManager.services;
|
||||
const wrappedPanelSegmentationWithTools = props => {
|
||||
const { t } = useTranslation('SegmentationTable');
|
||||
const tKey = `${props.segmentationRepresentationType ?? 'Segmentation'} tools`;
|
||||
const tValue = t(tKey);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Toolbox
|
||||
buttonSectionId={toolbarService.sections.segmentationToolbox}
|
||||
title="Segmentation Tools"
|
||||
buttonSectionId={toolSectionMap[props.segmentationRepresentationType]}
|
||||
title={tValue}
|
||||
/>
|
||||
<PanelSegmentation
|
||||
commandsManager={commandsManager}
|
||||
servicesManager={servicesManager}
|
||||
extensionManager={extensionManager}
|
||||
configuration={{
|
||||
...configuration,
|
||||
...props?.configuration,
|
||||
}}
|
||||
segmentationRepresentationType={props?.segmentationRepresentationType}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
@@ -82,11 +96,26 @@ const getPanelModule = ({ commandsManager, servicesManager, extensionManager }:
|
||||
component: wrappedPanelSegmentationNoHeader,
|
||||
},
|
||||
{
|
||||
name: 'panelSegmentationWithTools',
|
||||
name: 'panelSegmentationWithToolsLabelMap',
|
||||
iconName: 'tab-segmentation',
|
||||
iconLabel: 'Segmentation',
|
||||
label: 'Segmentation',
|
||||
component: wrappedPanelSegmentationWithTools,
|
||||
label: i18n.t('SegmentationTable:Labelmap'),
|
||||
component: props =>
|
||||
wrappedPanelSegmentationWithTools({
|
||||
...props,
|
||||
segmentationRepresentationType: SegmentationRepresentations.Labelmap,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: 'panelSegmentationWithToolsContour',
|
||||
iconName: 'tab-contours',
|
||||
iconLabel: 'Segmentation',
|
||||
label: i18n.t('SegmentationTable:Contour'),
|
||||
component: props =>
|
||||
wrappedPanelSegmentationWithTools({
|
||||
...props,
|
||||
segmentationRepresentationType: SegmentationRepresentations.Contour,
|
||||
}),
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user