2019-10-09 16:23:14 +02:00
|
|
|
import OHIF from '@ohif/core';
|
|
|
|
|
import cornerstone from 'cornerstone-core';
|
2019-05-02 23:12:06 +02:00
|
|
|
|
|
|
|
|
export default function updateTableWithNewMeasurementData({
|
|
|
|
|
toolType,
|
|
|
|
|
measurementNumber,
|
|
|
|
|
location,
|
2019-10-09 16:23:14 +02:00
|
|
|
description,
|
2019-05-02 23:12:06 +02:00
|
|
|
}) {
|
|
|
|
|
// Update all measurements by measurement number
|
2019-05-29 14:39:54 +02:00
|
|
|
const measurementApi = OHIF.measurements.MeasurementApi.Instance;
|
2019-05-02 23:12:06 +02:00
|
|
|
const measurements = measurementApi.tools[toolType].filter(
|
|
|
|
|
m => m.measurementNumber === measurementNumber
|
2019-05-29 14:39:54 +02:00
|
|
|
);
|
2019-05-02 23:12:06 +02:00
|
|
|
|
|
|
|
|
measurements.forEach(measurement => {
|
2019-05-29 14:39:54 +02:00
|
|
|
measurement.location = location;
|
|
|
|
|
measurement.description = description;
|
2019-05-02 23:12:06 +02:00
|
|
|
|
2019-05-29 14:39:54 +02:00
|
|
|
measurementApi.updateMeasurement(measurement.toolType, measurement);
|
|
|
|
|
});
|
2019-05-02 23:12:06 +02:00
|
|
|
|
2019-05-29 14:39:54 +02:00
|
|
|
measurementApi.syncMeasurementsAndToolData();
|
2019-05-02 23:12:06 +02:00
|
|
|
|
|
|
|
|
// Update images in all active viewports
|
|
|
|
|
cornerstone.getEnabledElements().forEach(enabledElement => {
|
2019-05-29 14:39:54 +02:00
|
|
|
cornerstone.updateImage(enabledElement.element);
|
|
|
|
|
});
|
2019-05-02 23:12:06 +02:00
|
|
|
}
|