fix(measurement and microscopy): various small fixes for measurement and microscopy side panel (#3696)
This commit is contained in:
1 parent
646bef1d93
commit
c1d5ee7e3f
20 files changed
+77
-84
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import SUPPORTED_TOOLS from './constants/supportedTools';
|
||||
import { getDisplayUnit } from './utils';
|
||||
import getSOPInstanceAttributes from './utils/getSOPInstanceAttributes';
|
||||
import { utils } from '@ohif/core';
|
||||
|
||||
@@ -181,7 +182,9 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
return displayText;
|
||||
}
|
||||
const roundedAngle = utils.roundNumber(angle, 2);
|
||||
displayText.push(`${roundedAngle} ${unit} (S: ${SeriesNumber}${instanceText}${frameText})`);
|
||||
displayText.push(
|
||||
`${roundedAngle} ${getDisplayUnit(unit)} (S: ${SeriesNumber}${instanceText}${frameText})`
|
||||
);
|
||||
|
||||
return displayText;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { annotation } from '@cornerstonejs/tools';
|
||||
import SUPPORTED_TOOLS from './constants/supportedTools';
|
||||
import getSOPInstanceAttributes from './utils/getSOPInstanceAttributes';
|
||||
import { utils } from '@ohif/core';
|
||||
import { getDisplayUnit } from './utils';
|
||||
|
||||
const Bidirectional = {
|
||||
toAnnotation: measurement => {},
|
||||
@@ -161,14 +162,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
const displayText = [];
|
||||
|
||||
// Area is the same for all series
|
||||
const {
|
||||
length,
|
||||
width,
|
||||
unit,
|
||||
SeriesNumber,
|
||||
SOPInstanceUID,
|
||||
frameNumber,
|
||||
} = mappedAnnotations[0];
|
||||
const { length, width, unit, SeriesNumber, SOPInstanceUID, frameNumber } = mappedAnnotations[0];
|
||||
const roundedLength = utils.roundNumber(length, 2);
|
||||
const roundedWidth = utils.roundNumber(width, 2);
|
||||
|
||||
@@ -183,9 +177,9 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
const frameText = displaySet.isMultiFrame ? ` F: ${frameNumber}` : '';
|
||||
|
||||
displayText.push(
|
||||
`L: ${roundedLength} ${unit} (S: ${SeriesNumber}${instanceText}${frameText})`
|
||||
`L: ${roundedLength} ${getDisplayUnit(unit)} (S: ${SeriesNumber}${instanceText}${frameText})`
|
||||
);
|
||||
displayText.push(`W: ${roundedWidth} ${unit}`);
|
||||
displayText.push(`W: ${roundedWidth} ${getDisplayUnit(unit)}`);
|
||||
|
||||
return displayText;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SUPPORTED_TOOLS from './constants/supportedTools';
|
||||
import { getDisplayUnit } from './utils';
|
||||
import getSOPInstanceAttributes from './utils/getSOPInstanceAttributes';
|
||||
import { utils } from '@ohif/core';
|
||||
|
||||
@@ -138,13 +139,7 @@ function _getReport(mappedAnnotations, points, FrameOfReferenceUID) {
|
||||
return;
|
||||
}
|
||||
|
||||
columns.push(
|
||||
`max (${unit})`,
|
||||
`mean (${unit})`,
|
||||
`std (${unit})`,
|
||||
'Area',
|
||||
'Unit'
|
||||
);
|
||||
columns.push(`max (${unit})`, `mean (${unit})`, `std (${unit})`, 'Area', 'Unit');
|
||||
values.push(max, mean, stdDev, area, areaUnit);
|
||||
});
|
||||
|
||||
@@ -189,7 +184,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
|
||||
// Area sometimes becomes undefined if `preventHandleOutsideImage` is off.
|
||||
const roundedArea = utils.roundNumber(area || 0, 2);
|
||||
displayText.push(`${roundedArea} ${areaUnit}`);
|
||||
displayText.push(`${roundedArea} ${getDisplayUnit(areaUnit)}`);
|
||||
|
||||
// Todo: we need a better UI for displaying all these information
|
||||
mappedAnnotations.forEach(mappedAnnotation => {
|
||||
@@ -198,7 +193,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
let maxStr = '';
|
||||
if (max) {
|
||||
const roundedMax = utils.roundNumber(max, 2);
|
||||
maxStr = `Max: ${roundedMax} <small>${unit}</small> `;
|
||||
maxStr = `Max: ${roundedMax} <small>${getDisplayUnit(unit)}</small> `;
|
||||
}
|
||||
|
||||
const str = `${maxStr}(S:${SeriesNumber}${instanceText}${frameText})`;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SUPPORTED_TOOLS from './constants/supportedTools';
|
||||
import { getDisplayUnit } from './utils';
|
||||
import getSOPInstanceAttributes from './utils/getSOPInstanceAttributes';
|
||||
import { utils } from '@ohif/core';
|
||||
|
||||
@@ -181,7 +182,9 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
return displayText;
|
||||
}
|
||||
const roundedAngle = utils.roundNumber(angle, 2);
|
||||
displayText.push(`${roundedAngle} ${unit} (S: ${SeriesNumber}${instanceText}${frameText})`);
|
||||
displayText.push(
|
||||
`${roundedAngle} ${getDisplayUnit(unit)} (S: ${SeriesNumber}${instanceText}${frameText})`
|
||||
);
|
||||
|
||||
return displayText;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SUPPORTED_TOOLS from './constants/supportedTools';
|
||||
import { getDisplayUnit } from './utils';
|
||||
import getSOPInstanceAttributes from './utils/getSOPInstanceAttributes';
|
||||
import { utils } from '@ohif/core';
|
||||
|
||||
@@ -138,13 +139,7 @@ function _getReport(mappedAnnotations, points, FrameOfReferenceUID) {
|
||||
return;
|
||||
}
|
||||
|
||||
columns.push(
|
||||
`max (${unit})`,
|
||||
`mean (${unit})`,
|
||||
`std (${unit})`,
|
||||
'Area',
|
||||
'Unit'
|
||||
);
|
||||
columns.push(`max (${unit})`, `mean (${unit})`, `std (${unit})`, 'Area', 'Unit');
|
||||
values.push(max, mean, stdDev, area, areaUnit);
|
||||
});
|
||||
|
||||
@@ -188,7 +183,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
const frameText = displaySet.isMultiFrame ? ` F: ${frameNumber}` : '';
|
||||
|
||||
const roundedArea = utils.roundNumber(area, 2);
|
||||
displayText.push(`${roundedArea} ${areaUnit}`);
|
||||
displayText.push(`${roundedArea} ${getDisplayUnit(areaUnit)}`);
|
||||
|
||||
// Todo: we need a better UI for displaying all these information
|
||||
mappedAnnotations.forEach(mappedAnnotation => {
|
||||
@@ -197,7 +192,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
let maxStr = '';
|
||||
if (max) {
|
||||
const roundedMax = utils.roundNumber(max, 2);
|
||||
maxStr = `Max: ${roundedMax} <small>${unit}</small> `;
|
||||
maxStr = `Max: ${roundedMax} <small>${getDisplayUnit(unit)}</small> `;
|
||||
}
|
||||
|
||||
const str = `${maxStr}(S:${SeriesNumber}${instanceText}${frameText})`;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import SUPPORTED_TOOLS from './constants/supportedTools';
|
||||
import { getDisplayUnit } from './utils';
|
||||
import getSOPInstanceAttributes from './utils/getSOPInstanceAttributes';
|
||||
import { utils } from '@ohif/core';
|
||||
|
||||
@@ -25,11 +26,7 @@ const RectangleROI = {
|
||||
throw new Error('Tool not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
StudyInstanceUID,
|
||||
} = getSOPInstanceAttributes(
|
||||
const { SOPInstanceUID, SeriesInstanceUID, StudyInstanceUID } = getSOPInstanceAttributes(
|
||||
referencedImageId,
|
||||
CornerstoneViewportService,
|
||||
viewportId
|
||||
@@ -92,11 +89,8 @@ function getMappedAnnotations(annotation, DisplaySetService) {
|
||||
throw new Error('Non-acquisition plane measurement mapping not supported');
|
||||
}
|
||||
|
||||
const {
|
||||
SOPInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
frameNumber,
|
||||
} = getSOPInstanceAttributes(referencedImageId);
|
||||
const { SOPInstanceUID, SeriesInstanceUID, frameNumber } =
|
||||
getSOPInstanceAttributes(referencedImageId);
|
||||
|
||||
const displaySet = DisplaySetService.getDisplaySetForSOPInstanceUID(
|
||||
SOPInstanceUID,
|
||||
@@ -190,7 +184,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
|
||||
// Area sometimes becomes undefined if `preventHandleOutsideImage` is off.
|
||||
const roundedArea = utils.roundNumber(area || 0, 2);
|
||||
displayText.push(`${roundedArea} ${areaUnit}`);
|
||||
displayText.push(`${roundedArea} ${getDisplayUnit(areaUnit)}`);
|
||||
|
||||
// Todo: we need a better UI for displaying all these information
|
||||
mappedAnnotations.forEach(mappedAnnotation => {
|
||||
@@ -199,7 +193,7 @@ function getDisplayText(mappedAnnotations, displaySet) {
|
||||
let maxStr = '';
|
||||
if (max) {
|
||||
const roundedMax = utils.roundNumber(max, 2);
|
||||
maxStr = `Max: ${roundedMax} <small>${unit}</small> `;
|
||||
maxStr = `Max: ${roundedMax} <small>${getDisplayUnit(unit)}</small> `;
|
||||
}
|
||||
|
||||
const str = `${maxStr}(S:${SeriesNumber}${instanceText}${frameText})`;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
const getDisplayUnit = unit => (unit == null ? '' : unit);
|
||||
|
||||
export default getDisplayUnit;
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
getFirstAnnotationSelected,
|
||||
} from './selection';
|
||||
import getSOPInstanceAttributes from './getSOPInstanceAttributes';
|
||||
import getDisplayUnit from './getDisplayUnit';
|
||||
|
||||
export {
|
||||
getHandlesFromPoints,
|
||||
@@ -12,4 +13,5 @@ export {
|
||||
isAnnotationSelected,
|
||||
setAnnotationSelected,
|
||||
getFirstAnnotationSelected,
|
||||
getDisplayUnit,
|
||||
};
|
||||
Reference in new issue
Block a user