Files
ohif-viewer/platform/viewer/src/lib/updateTableWithNewMeasurementData.js
T

29 lines
855 B
JavaScript
Raw Normal View History

2019-08-13 15:36:46 -04:00
import OHIF from "@ohif/core";
import cornerstone from "cornerstone-core";
2019-05-02 17:12:06 -04:00
export default function updateTableWithNewMeasurementData({
toolType,
measurementNumber,
location,
2019-08-13 15:36:46 -04:00
description
2019-05-02 17:12:06 -04:00
}) {
// Update all measurements by measurement number
2019-05-29 08:39:54 -04:00
const measurementApi = OHIF.measurements.MeasurementApi.Instance;
2019-05-02 17:12:06 -04:00
const measurements = measurementApi.tools[toolType].filter(
m => m.measurementNumber === measurementNumber
2019-05-29 08:39:54 -04:00
);
2019-05-02 17:12:06 -04:00
measurements.forEach(measurement => {
2019-05-29 08:39:54 -04:00
measurement.location = location;
measurement.description = description;
2019-05-02 17:12:06 -04:00
2019-05-29 08:39:54 -04:00
measurementApi.updateMeasurement(measurement.toolType, measurement);
});
2019-05-02 17:12:06 -04:00
2019-05-29 08:39:54 -04:00
measurementApi.syncMeasurementsAndToolData();
2019-05-02 17:12:06 -04:00
// Update images in all active viewports
cornerstone.getEnabledElements().forEach(enabledElement => {
2019-05-29 08:39:54 -04:00
cornerstone.updateImage(enabledElement.element);
});
2019-05-02 17:12:06 -04:00
}