Files
ohif-viewer/extensions/measurement-tracking/src/_shared/createReportAsync.js
T
James PettsandDanny Brown 3eba027003 [OHIF-288] Rehydrating SRs is missing Labels (#1885)
* WIP

* Finish OHIF-288, need to update dcmjs.

* Remove unused copied resources.

* Cleaned up label import code.

* Update for dcmjs Findings -> Finding.

* Update dcmjs

* Remove debuggers

* Respond to reviewer comments.

* update dcmjs version

Co-authored-by: Danny Brown <danny.ri.brown@gmail.com>
2020-07-10 15:11:22 -04:00

49 lines
1.2 KiB
JavaScript

import React from 'react';
import { DICOMSR } from '@ohif/core';
async function createReportAsync(servicesManager, dataSource, measurements) {
const {
UINotificationService,
UIDialogService,
DisplaySetService,
} = servicesManager.services;
const loadingDialogId = UIDialogService.create({
showOverlay: true,
isDraggable: false,
centralize: true,
// TODO: Create a loading indicator component + zeplin design?
content: Loading,
});
try {
const naturalizedReport = await DICOMSR.storeMeasurements(
measurements,
dataSource,
['ArrowAnnotate']
);
DisplaySetService.makeDisplaySets([naturalizedReport], {
madeInClient: true,
});
UINotificationService.show({
title: 'Create Report',
message: 'Measurements saved successfully',
type: 'success',
});
} catch (error) {
UINotificationService.show({
title: 'Create Report',
message: error.message || 'Failed to store measurements',
type: 'error',
});
} finally {
UIDialogService.dismiss({ id: loadingDialogId });
}
}
function Loading() {
return <div className="text-primary-active">Loading...</div>;
}
export default createReportAsync;