2024-11-06 07:15:27 -05:00
|
|
|
import { showLabelAnnotationPopup } from './callInputDialog';
|
|
|
|
|
|
|
|
|
|
function promptLabelAnnotation({ servicesManager }, ctx, evt) {
|
2025-02-03 21:01:41 +05:30
|
|
|
const { measurementService, customizationService, toolGroupService } = servicesManager.services;
|
|
|
|
|
const { viewportId, StudyInstanceUID, SeriesInstanceUID, measurementId, toolName } = evt;
|
2024-04-05 08:12:48 +05:30
|
|
|
return new Promise(async function (resolve) {
|
2025-02-03 21:01:41 +05:30
|
|
|
const toolGroup = toolGroupService.getToolGroupForViewport(viewportId);
|
|
|
|
|
const activeToolOptions = toolGroup.getToolConfiguration(toolName);
|
|
|
|
|
if(activeToolOptions.getTextCallback) {
|
|
|
|
|
resolve({
|
|
|
|
|
StudyInstanceUID,
|
|
|
|
|
SeriesInstanceUID,
|
|
|
|
|
viewportId,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
const labelConfig = customizationService.getCustomization('measurementLabels');
|
|
|
|
|
const measurement = measurementService.getMeasurement(measurementId);
|
|
|
|
|
const renderContent = customizationService.getCustomization('ui.labellingComponent');
|
|
|
|
|
const value = await showLabelAnnotationPopup(
|
|
|
|
|
measurement,
|
|
|
|
|
servicesManager.services.uiDialogService,
|
|
|
|
|
labelConfig,
|
|
|
|
|
renderContent
|
|
|
|
|
);
|
2024-04-05 08:12:48 +05:30
|
|
|
|
2025-02-03 21:01:41 +05:30
|
|
|
measurementService.update(
|
|
|
|
|
measurementId,
|
|
|
|
|
{
|
|
|
|
|
...value,
|
|
|
|
|
},
|
|
|
|
|
true
|
|
|
|
|
);
|
2024-04-05 08:12:48 +05:30
|
|
|
|
2025-02-03 21:01:41 +05:30
|
|
|
resolve({
|
|
|
|
|
StudyInstanceUID,
|
|
|
|
|
SeriesInstanceUID,
|
|
|
|
|
viewportId,
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-04-05 08:12:48 +05:30
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default promptLabelAnnotation;
|