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
330 changes: 165 additions & 165 deletions bun.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions extensions/cornerstone-dicom-pmap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
},
"dependencies": {
"@babel/runtime": "7.28.2",
"@cornerstonejs/adapters": "4.15.6",
"@cornerstonejs/core": "4.15.6",
"@cornerstonejs/adapters": "4.15.7",
"@cornerstonejs/core": "4.15.7",
"@kitware/vtk.js": "34.15.1",
"react-color": "2.19.3"
}
Expand Down
4 changes: 2 additions & 2 deletions extensions/cornerstone-dicom-seg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
},
"dependencies": {
"@babel/runtime": "7.28.2",
"@cornerstonejs/adapters": "4.15.6",
"@cornerstonejs/core": "4.15.6",
"@cornerstonejs/adapters": "4.15.7",
"@cornerstonejs/core": "4.15.7",
"@kitware/vtk.js": "34.15.1",
"react-color": "2.19.3"
}
Expand Down
6 changes: 3 additions & 3 deletions extensions/cornerstone-dicom-sr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
},
"dependencies": {
"@babel/runtime": "7.28.2",
"@cornerstonejs/adapters": "4.15.6",
"@cornerstonejs/core": "4.15.6",
"@cornerstonejs/tools": "4.15.6",
"@cornerstonejs/adapters": "4.15.7",
"@cornerstonejs/core": "4.15.7",
"@cornerstonejs/tools": "4.15.7",
"classnames": "2.5.1"
}
}
4 changes: 2 additions & 2 deletions extensions/cornerstone-dynamic-volume/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
},
"dependencies": {
"@babel/runtime": "7.28.2",
"@cornerstonejs/core": "4.15.6",
"@cornerstonejs/tools": "4.15.6",
"@cornerstonejs/core": "4.15.7",
"@cornerstonejs/tools": "4.15.7",
"classnames": "2.5.1"
}
}
14 changes: 7 additions & 7 deletions extensions/cornerstone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "1.2.2",
"@cornerstonejs/codec-openjpeg": "1.3.0",
"@cornerstonejs/codec-openjph": "2.4.7",
"@cornerstonejs/dicom-image-loader": "4.15.6",
"@cornerstonejs/dicom-image-loader": "4.15.7",
"@ohif/core": "3.12.0-beta.121",
"@ohif/ui": "3.12.0-beta.121",
"dcmjs": "0.45.0",
Expand All @@ -53,12 +53,12 @@
},
"dependencies": {
"@babel/runtime": "7.28.2",
"@cornerstonejs/adapters": "4.15.6",
"@cornerstonejs/ai": "4.15.6",
"@cornerstonejs/core": "4.15.6",
"@cornerstonejs/labelmap-interpolation": "4.15.6",
"@cornerstonejs/polymorphic-segmentation": "4.15.6",
"@cornerstonejs/tools": "4.15.6",
"@cornerstonejs/adapters": "4.15.7",
"@cornerstonejs/ai": "4.15.7",
"@cornerstonejs/core": "4.15.7",
"@cornerstonejs/labelmap-interpolation": "4.15.7",
"@cornerstonejs/polymorphic-segmentation": "4.15.7",
"@cornerstonejs/tools": "4.15.7",
"@itk-wasm/morphological-contour-interpolation": "1.1.0",
"@kitware/vtk.js": "34.15.1",
"html2canvas": "1.4.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { utils } from '../..';
import { useViewportSegmentations } from '../../hooks';
import { useMeasurementTracking } from '../../hooks/useMeasurementTracking';
import { useViewportDisplaySets } from '../../hooks/useViewportDisplaySets';
import { SegmentationRepresentations } from '@cornerstonejs/tools/enums';

/**
* NavigationComponent provides navigation controls for viewports containing
Expand All @@ -27,7 +28,11 @@ function NavigationComponent({ viewportId }: { viewportId: string }) {
viewportId,
});

const hasSegmentations = segmentationsWithRepresentations.length > 0;
const hasSegmentations =
segmentationsWithRepresentations.length > 0 &&
segmentationsWithRepresentations.some(
segmentation => segmentation?.representation?.type !== SegmentationRepresentations.Surface
);

// prefer segment navigation if available
const navigationMode = hasSegmentations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const CustomDropdownMenuContent = () => {
exportOptions,
activeSegmentation,
activeSegmentationId,
segmentationRepresentationType,
segmentationRepresentationTypes,
disableEditing,
} = useSegmentationTableContext('CustomDropdownMenu');

Expand Down Expand Up @@ -79,7 +79,12 @@ export const CustomDropdownMenuContent = () => {
<DropdownMenuContent align="start">
{!disableEditing && (
<DropdownMenuItem
onClick={() => onSegmentationAdd({ segmentationId, segmentationRepresentationType })}
onClick={() =>
onSegmentationAdd({
segmentationId,
segmentationRepresentationType: segmentationRepresentationTypes?.[0],
})
}
>
<Icons.Add className="text-foreground" />
<span className="pl-2">{t('Create New Segmentation')}</span>
Expand All @@ -97,7 +102,7 @@ export const CustomDropdownMenuContent = () => {
</DropdownMenuItem>
<ExportSegmentationSubMenuItem
segmentationId={segmentationId}
segmentationRepresentationType={segmentationRepresentationType}
segmentationRepresentationType={segmentationRepresentationTypes?.[0]}
allowExport={allowExport}
actions={actions}
/>
Expand Down
17 changes: 10 additions & 7 deletions extensions/cornerstone/src/getPanelModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const getPanelModule = ({ commandsManager, servicesManager, extensionManager }:
configuration={{
...props?.configuration,
}}
segmentationRepresentationType={props?.segmentationRepresentationType}
segmentationRepresentationTypes={props?.segmentationRepresentationTypes}
/>
);
};
Expand All @@ -38,20 +38,20 @@ const getPanelModule = ({ commandsManager, servicesManager, extensionManager }:
configuration={{
...props?.configuration,
}}
segmentationRepresentationType={props?.segmentationRepresentationType}
segmentationRepresentationTypes={props?.segmentationRepresentationTypes}
/>
);
};

const wrappedPanelSegmentationWithTools = props => {
const { t } = useTranslation('SegmentationPanel');
const tKey = `${props.segmentationRepresentationType ?? 'Segmentation'} tools`;
const tKey = `${props.segmentationRepresentationTypes?.[0] ?? 'Segmentation'} tools`;
const tValue = t(tKey);

return (
<>
<Toolbox
buttonSectionId={toolSectionMap[props.segmentationRepresentationType]}
buttonSectionId={toolSectionMap[props.segmentationRepresentationTypes?.[0]]}
title={tValue}
/>
<PanelSegmentation
Expand All @@ -61,7 +61,7 @@ const getPanelModule = ({ commandsManager, servicesManager, extensionManager }:
configuration={{
...props?.configuration,
}}
segmentationRepresentationType={props?.segmentationRepresentationType}
segmentationRepresentationTypes={props?.segmentationRepresentationTypes}
/>
</>
);
Expand Down Expand Up @@ -103,7 +103,10 @@ const getPanelModule = ({ commandsManager, servicesManager, extensionManager }:
component: props =>
wrappedPanelSegmentationWithTools({
...props,
segmentationRepresentationType: SegmentationRepresentations.Labelmap,
segmentationRepresentationTypes: [
SegmentationRepresentations.Labelmap,
SegmentationRepresentations.Surface,
],
}),
},
{
Expand All @@ -114,7 +117,7 @@ const getPanelModule = ({ commandsManager, servicesManager, extensionManager }:
component: props =>
wrappedPanelSegmentationWithTools({
...props,
segmentationRepresentationType: SegmentationRepresentations.Contour,
segmentationRepresentationTypes: [SegmentationRepresentations.Contour],
}),
},
];
Expand Down
28 changes: 19 additions & 9 deletions extensions/cornerstone/src/panels/PanelSegmentation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ import {
type PanelSegmentationProps = {
children?: React.ReactNode;

// The representation type for this segmentation panel. Undefined means all types.
segmentationRepresentationType?: SegmentationRepresentations;
// The representation types for this segmentation panel. Undefined means all types.
// The first element is the primary type. Additional elements are secondary types.
segmentationRepresentationTypes?: SegmentationRepresentations[];
} & withAppTypes;

export default function PanelSegmentation({
children,
segmentationRepresentationType,
segmentationRepresentationTypes,
}: PanelSegmentationProps) {
const { commandsManager, servicesManager } = useSystem();
const {
Expand All @@ -48,11 +49,20 @@ export default function PanelSegmentation({
store => store.selectedSegmentationsForViewport[activeViewportId]
);

const selectedSegmentationIdForType = segmentationRepresentationType
? selectedSegmentationsForViewportMap?.get(segmentationRepresentationType)
const selectedSegmentationIdForType = segmentationRepresentationTypes
? segmentationRepresentationTypes.reduce(
(selectedSegmentation, type) =>
selectedSegmentation ||
(selectedSegmentationsForViewportMap?.has(type)
? selectedSegmentationsForViewportMap?.get(type)
: undefined),
undefined
)
: segmentationService?.getActiveSegmentation(activeViewportId)?.segmentationId;

const buttonSection = utilitiesSectionMap[segmentationRepresentationType];
const buttonSection = segmentationRepresentationTypes?.[0]
? utilitiesSectionMap[segmentationRepresentationTypes[0]]
: undefined;

const { activeToolOptions: activeUtilityOptions } = useActiveToolOptions({
buttonSectionId: buttonSection,
Expand Down Expand Up @@ -129,7 +139,7 @@ export default function PanelSegmentation({
commandsManager.run('deleteSegment', { segmentationId, segmentIndex });
},
onSegmentCopy:
segmentationRepresentationType === SegmentationRepresentations.Contour
segmentationRepresentationTypes?.[0] === SegmentationRepresentations.Contour
? (segmentationId, segmentIndex) => {
commandsManager.run('copyContourSegment', {
sourceSegmentInfo: { segmentationId, segmentIndex },
Expand Down Expand Up @@ -227,13 +237,13 @@ export default function PanelSegmentation({
disabled,
data: segmentationsWithRepresentations,
mode: segmentationTableMode,
title: `${segmentationRepresentationType ? `${segmentationRepresentationType} ` : ''}Segmentations`,
title: `${segmentationRepresentationTypes?.[0] ? `${segmentationRepresentationTypes[0]} ` : ''}Segmentations`,
exportOptions,
disableEditing,
onSegmentationAdd,
showAddSegment,
renderInactiveSegmentations: handlers.getRenderInactiveSegmentations(),
segmentationRepresentationType,
segmentationRepresentationTypes,
selectedSegmentationIdForType,
...handlers,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,10 @@ class SegmentationService extends PubSubService {

viewportIds.forEach(viewportId => {
const { viewport } = getEnabledElementByViewportId(viewportId);
if (!viewport?.jumpToWorld) {
return;
}

viewport.jumpToWorld(world);

highlightSegment &&
Expand Down
4 changes: 2 additions & 2 deletions extensions/measurement-tracking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"start": "yarn run dev"
},
"peerDependencies": {
"@cornerstonejs/core": "4.15.6",
"@cornerstonejs/tools": "4.15.6",
"@cornerstonejs/core": "4.15.7",
"@cornerstonejs/tools": "4.15.7",
"@ohif/core": "3.12.0-beta.121",
"@ohif/extension-cornerstone-dicom-sr": "3.12.0-beta.121",
"@ohif/extension-default": "3.12.0-beta.121",
Expand Down
4 changes: 2 additions & 2 deletions extensions/usAnnotation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
},
"dependencies": {
"@babel/runtime": "7.28.2",
"@cornerstonejs/core": "4.15.6",
"@cornerstonejs/tools": "4.15.6",
"@cornerstonejs/core": "4.15.7",
"@cornerstonejs/tools": "4.15.7",
"@ohif/core": "3.12.0-beta.121",
"@ohif/extension-cornerstone": "3.12.0-beta.121",
"@ohif/extension-default": "3.12.0-beta.121",
Expand Down
4 changes: 2 additions & 2 deletions modes/usAnnotation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
},
"dependencies": {
"@babel/runtime": "7.28.2",
"@cornerstonejs/core": "4.15.6",
"@cornerstonejs/tools": "4.15.6",
"@cornerstonejs/core": "4.15.7",
"@cornerstonejs/tools": "4.15.7",
"@ohif/core": "3.12.0-beta.121",
"@ohif/extension-cornerstone-dicom-sr": "3.12.0-beta.121",
"@ohif/extension-ultrasound-pleura-bline": "3.12.0-beta.121",
Expand Down
2 changes: 1 addition & 1 deletion platform/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "1.2.2",
"@cornerstonejs/codec-openjpeg": "1.3.0",
"@cornerstonejs/codec-openjph": "2.4.7",
"@cornerstonejs/dicom-image-loader": "4.15.6",
"@cornerstonejs/dicom-image-loader": "4.15.7",
"@emotion/serialize": "1.3.3",
"@ohif/core": "3.12.0-beta.121",
"@ohif/extension-cornerstone": "3.12.0-beta.121",
Expand Down
4 changes: 2 additions & 2 deletions platform/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "1.2.2",
"@cornerstonejs/codec-openjpeg": "1.3.0",
"@cornerstonejs/codec-openjph": "2.4.7",
"@cornerstonejs/core": "4.15.6",
"@cornerstonejs/dicom-image-loader": "4.15.6",
"@cornerstonejs/core": "4.15.7",
"@cornerstonejs/dicom-image-loader": "4.15.7",
"@ohif/ui": "3.12.0-beta.121",
"cornerstone-math": "0.1.9",
"dicom-parser": "1.8.21"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export const AddSegmentationRow: React.FC<{ children?: React.ReactNode }> = ({
disableEditing,
mode,
disabled,
segmentationRepresentationType,
segmentationRepresentationTypes,
} = useSegmentationTableContext('AddSegmentationRow');

// Check if we have at least one segmentation of the representation type for the panel this component is contained in.
const hasRepresentationType =
(!segmentationRepresentationType && data.length > 0) ||
data.some(info => segmentationRepresentationType === info.representation?.type);
(!segmentationRepresentationTypes && data.length > 0) ||
data.some(info => segmentationRepresentationTypes?.includes(info.representation?.type));

if (hasRepresentationType && mode === 'collapsed') {
return null;
Expand All @@ -35,7 +35,11 @@ export const AddSegmentationRow: React.FC<{ children?: React.ReactNode }> = ({
data-cy="addSegmentation"
className={`group ${disabled ? 'pointer-events-none cursor-not-allowed opacity-70' : ''}`}
onClick={() =>
!disabled && onSegmentationAdd({ segmentationId: '', segmentationRepresentationType })
!disabled &&
onSegmentationAdd({
segmentationId: '',
segmentationRepresentationType: segmentationRepresentationTypes?.[0],
})
}
>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ const SegmentationCollapsedDropdownMenu = ({ children }: { children: React.React
// Selector component - for the segmentation selection dropdown
const SegmentationCollapsedSelector = () => {
const { t } = useTranslation('SegmentationPanel.HeaderCollapsed');
const { data, onSegmentationClick, segmentationRepresentationType } = useSegmentationTableContext(
'SegmentationCollapsedSelector'
);
const { data, onSegmentationClick, segmentationRepresentationTypes } =
useSegmentationTableContext('SegmentationCollapsedSelector');
const { segmentation } = useSegmentationExpanded('SegmentationCollapsedSelector');

if (!data?.length) {
Expand All @@ -63,8 +62,8 @@ const SegmentationCollapsedSelector = () => {
// Only show segmentations of the representation type for this panel. Show all segmentations if no type is specified.
.filter(
seg =>
!segmentationRepresentationType ||
segmentationRepresentationType === seg.representation.type
!segmentationRepresentationTypes ||
segmentationRepresentationTypes.includes(seg.representation?.type)
)
.map(seg => ({
id: seg.segmentation.segmentationId,
Expand Down Expand Up @@ -132,14 +131,14 @@ const SegmentationCollapsedContent = ({ children }: { children: React.ReactNode
const SegmentationCollapsedRoot: React.FC<{ children?: React.ReactNode }> = ({
children = null,
}) => {
const { mode, data, segmentationRepresentationType, selectedSegmentationIdForType } =
const { mode, data, segmentationRepresentationTypes, selectedSegmentationIdForType } =
useSegmentationTableContext('SegmentationCollapsed');

// Find the segmentations for the representation type for this collapsed view.
const segmentations = data.filter(
segmentation =>
!segmentationRepresentationType ||
segmentationRepresentationType === segmentation.representation?.type
!segmentationRepresentationTypes ||
segmentationRepresentationTypes.includes(segmentation.representation?.type)
);

// Check if we should render.
Expand Down
Loading