feat(data overlay): add foreground background control plus orientation change in the UI and add RTDOSE support (#5007)

This commit is contained in:
Alireza authored and GitHub committed 2025-05-05 16:35:05 -04:00
1 parent c1fced0573
commit cd4e6408bc
105 files changed
+3117 -788

No files matched your search

+139
View File
@@ -3,6 +3,12 @@ import { Types, DicomMetadataStore } from '@ohif/core';
import { ContextMenuController } from './CustomizableContextMenu';
import DicomTagBrowser from './DicomTagBrowser/DicomTagBrowser';
import reuseCachedLayouts from './utils/reuseCachedLayouts';
import {
configureViewportForLayerAddition,
configureViewportForLayerRemoval,
canAddDisplaySetToViewport,
DERIVED_OVERLAY_MODALITIES,
} from './utils/layerConfigurationUtils';
import findViewportsByPosition, {
findOrCreateViewport as layoutFindOrCreate,
} from './findViewportsByPosition';
@@ -51,6 +57,137 @@ const commandsModule = ({
const contextMenuController = new ContextMenuController(servicesManager, commandsManager);
const actions = {
/**
* Adds a display set as a layer to the specified viewport
*
* @param options.viewportId - The ID of the viewport to add the layer to
* @param options.displaySetInstanceUID - The UID of the display set to add as a layer
* @param options.removeFirst - Optional flag to remove the display set first if it's already added
*/
addDisplaySetAsLayer: ({ viewportId, displaySetInstanceUID, removeFirst = false }) => {
if (!viewportId || !displaySetInstanceUID) {
console.warn('Missing required parameters for addDisplaySetAsLayer command');
return;
}
const { displaySetService, viewportGridService, hangingProtocolService } =
servicesManager.services;
// Get the display set
const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);
if (!displaySet) {
return;
}
// Get current display sets for the viewport
const currentDisplaySetUIDs = viewportGridService.getDisplaySetsUIDsForViewport(viewportId);
// Check if we can add this display set to the viewport
const canAdd = canAddDisplaySetToViewport({
viewportId,
displaySetInstanceUID,
servicesManager,
});
if (!canAdd) {
return;
}
// Add the display set to the viewport
const updatedViewports = hangingProtocolService.getViewportsRequireUpdate(
viewportId,
displaySetInstanceUID
);
// Configure each viewport for layer addition
updatedViewports.forEach(viewport => {
configureViewportForLayerAddition({
viewport,
displaySetInstanceUID,
currentDisplaySetUIDs,
servicesManager,
});
});
// Update position presentation
commandsManager.runCommand('updateStoredPositionPresentation', {
viewportId,
displaySetInstanceUIDs: updatedViewports[0].displaySetInstanceUIDs,
});
// Run command to update viewports
commandsManager.run('setDisplaySetsForViewports', {
viewportsToUpdate: updatedViewports,
});
},
/**
* Removes a display set layer from the specified viewport
*
* @param options.viewportId - The ID of the viewport to remove the layer from
* @param options.displaySetInstanceUID - The UID of the display set to remove
*/
removeDisplaySetLayer: ({ viewportId, displaySetInstanceUID }) => {
if (!viewportId || !displaySetInstanceUID) {
console.warn('Missing required parameters for removeDisplaySetLayer command');
return;
}
const {
displaySetService,
viewportGridService,
hangingProtocolService,
segmentationService,
} = servicesManager.services;
// Get the display set
const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);
if (!displaySet) {
return;
}
// Get current display sets for the viewport
const currentDisplaySetUIDs = viewportGridService.getDisplaySetsUIDsForViewport(viewportId);
// If the display set is not in the viewport, no need to remove it
if (!currentDisplaySetUIDs.includes(displaySetInstanceUID)) {
return;
}
// Check if it's a segmentation and handle accordingly
const isSegmentation = DERIVED_OVERLAY_MODALITIES.includes(displaySet.Modality);
if (isSegmentation) {
segmentationService.removeSegmentationRepresentations(viewportId, {
segmentationId: displaySetInstanceUID,
});
}
const updatedViewports = hangingProtocolService.getViewportsRequireUpdate(
viewportId,
displaySetInstanceUID
);
// Configure each viewport for layer removal
updatedViewports.forEach(viewport => {
configureViewportForLayerRemoval({
viewport,
displaySetInstanceUID,
currentDisplaySetUIDs,
servicesManager,
});
});
// Update position presentation
commandsManager.runCommand('updateStoredPositionPresentation', {
viewportId,
displaySetInstanceUIDs: updatedViewports[0].displaySetInstanceUIDs,
});
// Update the viewports
commandsManager.run('setDisplaySetsForViewports', {
viewportsToUpdate: updatedViewports,
});
},
/**
* Runs a command in multi-monitor mode. No-op if not multi-monitor.
*/
@@ -644,6 +781,8 @@ const commandsModule = ({
openDICOMTagViewer: actions.openDICOMTagViewer,
updateViewportDisplaySet: actions.updateViewportDisplaySet,
scrollActiveThumbnailIntoView: actions.scrollActiveThumbnailIntoView,
addDisplaySetAsLayer: actions.addDisplaySetAsLayer,
removeDisplaySetLayer: actions.removeDisplaySetLayer,
};
return {