fix(measurements): Update the calibration tool to match changes in CS3D (#3505)

This change makes the OHIF side consistent with the CS3D user calibration settings, and will correctly display px and rounding values consistent with the CS3D display.
This commit is contained in:
Bill Wallace authored and GitHub committed 2023-09-15 10:50:23 -04:00
1 parent bd7f9592ea
commit 38af3112ec
8 files changed
+177 -90

No files matched your search

@@ -98,7 +98,7 @@ function getMappedAnnotations(annotation, displaySetService) {
);
const { SeriesNumber } = displaySet;
const { mean, stdDev, max, area, Modality, modalityUnit } = targetStats;
const { mean, stdDev, max, area, Modality, areaUnit, modalityUnit } = targetStats;
annotations.push({
SeriesInstanceUID,
@@ -107,6 +107,7 @@ function getMappedAnnotations(annotation, displaySetService) {
frameNumber,
Modality,
unit: modalityUnit,
areaUnit,
mean,
stdDev,
max,
@@ -131,14 +132,20 @@ function _getReport(mappedAnnotations, points, FrameOfReferenceUID) {
values.push('Cornerstone:EllipticalROI');
mappedAnnotations.forEach(annotation => {
const { mean, stdDev, max, area, unit } = annotation;
const { mean, stdDev, max, area, unit, areaUnit } = annotation;
if (!mean || !unit || !max || !area) {
return;
}
columns.push(`max (${unit})`, `mean (${unit})`, `std (${unit})`, `area (mm2)`);
values.push(max, mean, stdDev, area);
columns.push(
`max (${unit})`,
`mean (${unit})`,
`std (${unit})`,
'Area',
'Unit'
);
values.push(max, mean, stdDev, area, areaUnit);
});
if (FrameOfReferenceUID) {
@@ -168,7 +175,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
const displayText = [];
// Area is the same for all series
const { area, SOPInstanceUID, frameNumber } = mappedAnnotations[0];
const { area, SOPInstanceUID, frameNumber, areaUnit } = mappedAnnotations[0];
const instance = displaySet.images.find(image => image.SOPInstanceUID === SOPInstanceUID);
@@ -180,9 +187,8 @@ function getDisplayText(mappedAnnotations, displaySet) {
const instanceText = InstanceNumber ? ` I: ${InstanceNumber}` : '';
const frameText = displaySet.isMultiFrame ? ` F: ${frameNumber}` : '';
// Area sometimes becomes undefined if `preventHandleOutsideImage` is off.
const roundedArea = utils.roundNumber(area || 0, 2);
displayText.push(`${roundedArea} mm<sup>2</sup>`);
const roundedArea = utils.roundNumber(area, 2);
displayText.push(`${roundedArea} ${areaUnit}`);
// Todo: we need a better UI for displaying all these information
mappedAnnotations.forEach(mappedAnnotation => {