2024-04-02 09:35:30 -04:00
|
|
|
import React, { ReactNode } from 'react';
|
2024-11-06 07:15:27 -05:00
|
|
|
import { nonWLModalities, WindowLevelActionMenu } from './WindowLevelActionMenu';
|
2024-04-02 09:35:30 -04:00
|
|
|
|
|
|
|
|
export function getWindowLevelActionMenu({
|
|
|
|
|
viewportId,
|
|
|
|
|
element,
|
|
|
|
|
displaySets,
|
|
|
|
|
servicesManager,
|
|
|
|
|
commandsManager,
|
|
|
|
|
verticalDirection,
|
|
|
|
|
horizontalDirection,
|
2024-11-06 07:15:27 -05:00
|
|
|
}: withAppTypes<{
|
|
|
|
|
viewportId: string;
|
|
|
|
|
element: HTMLElement;
|
|
|
|
|
displaySets: AppTypes.DisplaySet[];
|
|
|
|
|
}>): ReactNode {
|
2024-04-02 09:35:30 -04:00
|
|
|
const { customizationService } = servicesManager.services;
|
|
|
|
|
|
|
|
|
|
const { presets } = customizationService.get('cornerstone.windowLevelPresets');
|
|
|
|
|
const colorbarProperties = customizationService.get('cornerstone.colorbar');
|
|
|
|
|
const { volumeRenderingPresets, volumeRenderingQualityRange } = customizationService.get(
|
|
|
|
|
'cornerstone.3dVolumeRendering'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const displaySetPresets = displaySets
|
|
|
|
|
.filter(displaySet => presets[displaySet.Modality])
|
|
|
|
|
.map(displaySet => {
|
|
|
|
|
return { [displaySet.Modality]: presets[displaySet.Modality] };
|
|
|
|
|
});
|
|
|
|
|
|
2024-11-06 07:15:27 -05:00
|
|
|
const modalities = displaySets
|
|
|
|
|
.map(displaySet => displaySet.Modality)
|
|
|
|
|
.filter(modality => !nonWLModalities.includes(modality));
|
|
|
|
|
|
|
|
|
|
if (modalities.length === 0) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-16 10:31:06 -02:30
|
|
|
return (
|
2024-04-02 09:35:30 -04:00
|
|
|
<WindowLevelActionMenu
|
|
|
|
|
viewportId={viewportId}
|
|
|
|
|
element={element}
|
2024-04-16 10:31:06 -02:30
|
|
|
presets={displaySetPresets}
|
2024-04-02 09:35:30 -04:00
|
|
|
verticalDirection={verticalDirection}
|
|
|
|
|
horizontalDirection={horizontalDirection}
|
|
|
|
|
commandsManager={commandsManager}
|
2024-05-08 12:12:49 -04:00
|
|
|
servicesManager={servicesManager}
|
2024-04-02 09:35:30 -04:00
|
|
|
colorbarProperties={colorbarProperties}
|
|
|
|
|
displaySets={displaySets}
|
|
|
|
|
volumeRenderingPresets={volumeRenderingPresets}
|
|
|
|
|
volumeRenderingQualityRange={volumeRenderingQualityRange}
|
|
|
|
|
/>
|
2024-04-16 10:31:06 -02:30
|
|
|
);
|
2024-04-02 09:35:30 -04:00
|
|
|
}
|