fix(measurement and microscopy): various small fixes for measurement and microscopy side panel (#3696)

This commit is contained in:
Joe Boccanfuso 2023-10-04 14:11:09 -04:00 committed by GitHub
parent 646bef1d93
commit c1d5ee7e3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 77 additions and 84 deletions

View File

@ -44,7 +44,7 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/tools": "^1.19.3",
"@cornerstonejs/tools": "^1.19.4",
"react-color": "^2.19.3"
}
}

View File

@ -44,9 +44,9 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^1.19.3",
"@cornerstonejs/core": "^1.19.3",
"@cornerstonejs/tools": "^1.19.3",
"@cornerstonejs/adapters": "^1.19.4",
"@cornerstonejs/core": "^1.19.4",
"@cornerstonejs/tools": "^1.19.4",
"classnames": "^2.3.2"
}
}

View File

@ -36,7 +36,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.2",
"@cornerstonejs/codec-openjph": "^2.4.2",
"@cornerstonejs/dicom-image-loader": "^1.19.3",
"@cornerstonejs/dicom-image-loader": "^1.19.4",
"@ohif/core": "3.7.0-beta.98",
"@ohif/ui": "3.7.0-beta.98",
"dcmjs": "^0.29.6",
@ -52,10 +52,10 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^1.19.3",
"@cornerstonejs/core": "^1.19.3",
"@cornerstonejs/streaming-image-volume-loader": "^1.19.3",
"@cornerstonejs/tools": "^1.19.3",
"@cornerstonejs/adapters": "^1.19.4",
"@cornerstonejs/core": "^1.19.4",
"@cornerstonejs/streaming-image-volume-loader": "^1.19.4",
"@cornerstonejs/tools": "^1.19.4",
"@kitware/vtk.js": "27.3.1",
"html2canvas": "^1.4.1",
"lodash.debounce": "4.0.8",

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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})`;

View File

@ -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;
}

View File

@ -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})`;

View File

@ -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})`;

View File

@ -0,0 +1,3 @@
const getDisplayUnit = unit => (unit == null ? '' : unit);
export default getDisplayUnit;

View File

@ -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,
};

View File

@ -6,5 +6,6 @@
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"arrowParens": "avoid"
"arrowParens": "avoid",
"endOfLine": "auto"
}

View File

@ -76,8 +76,8 @@ function MicroscopyPanel(props: IMicroscopyPanelProps) {
const { uiDialogService, displaySetService } = servicesManager.services;
useEffect(() => {
const viewport = props.viewports[props.activeViewportId];
if (viewport.displaySetInstanceUIDs[0]) {
const viewport = props.viewports.get(props.activeViewportId);
if (viewport?.displaySetInstanceUIDs[0]) {
const displaySet = displaySetService.getDisplaySetByUID(viewport.displaySetInstanceUIDs[0]);
if (displaySet) {
setStudyInstanceUID(displaySet.StudyInstanceUID);

View File

@ -30,8 +30,8 @@
"start": "yarn run dev"
},
"peerDependencies": {
"@cornerstonejs/core": "^1.19.3",
"@cornerstonejs/tools": "^1.19.3",
"@cornerstonejs/core": "^1.19.4",
"@cornerstonejs/tools": "^1.19.4",
"@ohif/core": "3.7.0-beta.98",
"@ohif/extension-cornerstone-dicom-sr": "3.7.0-beta.98",
"@ohif/ui": "3.7.0-beta.98",

View File

@ -6,5 +6,6 @@
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"arrowParens": "avoid"
"arrowParens": "avoid",
"endOfLine": "auto"
}

View File

@ -50,7 +50,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.2",
"@cornerstonejs/codec-openjph": "^2.4.2",
"@cornerstonejs/dicom-image-loader": "^1.19.3",
"@cornerstonejs/dicom-image-loader": "^1.19.4",
"@ohif/core": "3.7.0-beta.98",
"@ohif/extension-cornerstone": "3.7.0-beta.98",
"@ohif/extension-cornerstone-dicom-rt": "3.7.0-beta.98",

View File

@ -6,5 +6,6 @@
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"arrowParens": "avoid"
"arrowParens": "avoid",
"endOfLine": "auto"
}

View File

@ -6,5 +6,6 @@
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"arrowParens": "avoid"
"arrowParens": "avoid",
"endOfLine": "auto"
}

View File

@ -35,7 +35,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.2",
"@cornerstonejs/codec-openjph": "^2.4.2",
"@cornerstonejs/dicom-image-loader": "^1.19.3",
"@cornerstonejs/dicom-image-loader": "^1.19.4",
"@ohif/ui": "3.7.0-beta.98",
"cornerstone-math": "0.1.9",
"dicom-parser": "^1.8.21"

View File

@ -1482,10 +1482,10 @@
resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9"
integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==
"@cornerstonejs/adapters@^1.19.3":
version "1.19.3"
resolved "https://registry.yarnpkg.com/@cornerstonejs/adapters/-/adapters-1.19.3.tgz#4480d16bb92346ee63a4737b5dd2b8699b8c79a0"
integrity sha512-aDJLYZ1FaT5LwSr1ZBS2br/bF9Tl5wHOoPBt6MOGP9mMUA+OaEqd4tY4C04tDOqLOBFUfTcI0+NxrpovQ+sLYw==
"@cornerstonejs/adapters@^1.19.4":
version "1.19.4"
resolved "https://registry.yarnpkg.com/@cornerstonejs/adapters/-/adapters-1.19.4.tgz#65b5f83f709faf2b62ba87effde7579a034fcfd6"
integrity sha512-ulirXb8Jx2zWRviXKbumU1K4J9q+nTRCAeG8SONZFFWlWTSwWWPNyQfOHDb3SE/KcupVk4gKzIjd+r0cC+cPdw==
dependencies:
"@babel/runtime-corejs2" "^7.17.8"
buffer "^6.0.3"
@ -1534,43 +1534,43 @@
resolved "https://registry.yarnpkg.com/@cornerstonejs/codec-openjph/-/codec-openjph-2.4.2.tgz#e96721d56f6ec96f7f95c16321d88cc8467d8d81"
integrity sha512-lgdvBvvNezleY+4pIe2ceUsJzlZe/0PipdeubQ3vZZOz3xxtHHMR1XFCl4fgd8gosR8COHuD7h6q+MwgrwBsng==
"@cornerstonejs/core@^1.19.3":
version "1.19.3"
resolved "https://registry.yarnpkg.com/@cornerstonejs/core/-/core-1.19.3.tgz#30d6360b6bda821c62daf20e0e752e0af7d4c604"
integrity sha512-NJt41RALQXnEbutGALwhvNg6iNoypkTRVYFRdDsMTwTzu03ODSZnVPCZVdgBjiIJS1wb9WknCC49p/opV712qQ==
"@cornerstonejs/core@^1.19.4":
version "1.19.4"
resolved "https://registry.yarnpkg.com/@cornerstonejs/core/-/core-1.19.4.tgz#7d527f151a1487955e7817b8113ab4c9ad2f7231"
integrity sha512-vVV3I6SzMbP4JqqRp49fBmVSr44l7qOXrO/gb6J3cY/EmwuUdFeSQdmN6ggouaQ45fhKPqPGcyHNO/iww9BR3Q==
dependencies:
"@kitware/vtk.js" "27.3.1"
detect-gpu "^5.0.22"
gl-matrix "^3.4.3"
lodash.clonedeep "4.5.0"
"@cornerstonejs/dicom-image-loader@^1.19.3":
version "1.19.3"
resolved "https://registry.yarnpkg.com/@cornerstonejs/dicom-image-loader/-/dicom-image-loader-1.19.3.tgz#f6dce05099fe21abe31f35d6b159d785cd0f360b"
integrity sha512-ouJtxCZaAxfS/hN3i4DdeszEw/VMTtKve43eGK9bL/+/eyhJegsVkrDPJEJyHjtGOK9tjbnxkg1PlpVeNgWJbg==
"@cornerstonejs/dicom-image-loader@^1.19.4":
version "1.19.4"
resolved "https://registry.yarnpkg.com/@cornerstonejs/dicom-image-loader/-/dicom-image-loader-1.19.4.tgz#778d933f8531233382080c3afea45854e7cf92b5"
integrity sha512-1+Dt+FR12pfbybPwOVJONx2KcoHbTyp8zCxrbmpRUxivwbq55SMExQa4ef8fFL97/+Hb9euczdA+PO9bbcD3Fw==
dependencies:
"@cornerstonejs/codec-charls" "^1.2.3"
"@cornerstonejs/codec-libjpeg-turbo-8bit" "^1.2.2"
"@cornerstonejs/codec-openjpeg" "^1.2.2"
"@cornerstonejs/codec-openjph" "^2.4.2"
"@cornerstonejs/core" "^1.19.3"
"@cornerstonejs/core" "^1.19.4"
dicom-parser "^1.8.9"
pako "^2.0.4"
uuid "^9.0.0"
"@cornerstonejs/streaming-image-volume-loader@^1.19.3":
version "1.19.3"
resolved "https://registry.yarnpkg.com/@cornerstonejs/streaming-image-volume-loader/-/streaming-image-volume-loader-1.19.3.tgz#8895690efbbcc8cad8cee8b1be8c06be1e420830"
integrity sha512-tGXzeD8CuRNoGvWU+vZsDvU7GA5jy+AimHbPPr5kLM02Ghygrch98BXjW2tA6Cu9PGABE64KxtsZmMayw0nOLg==
"@cornerstonejs/streaming-image-volume-loader@^1.19.4":
version "1.19.4"
resolved "https://registry.yarnpkg.com/@cornerstonejs/streaming-image-volume-loader/-/streaming-image-volume-loader-1.19.4.tgz#d2a7afcd673ba112d851e95d2895109c3490cdce"
integrity sha512-Y+g6hdM3cTsdjKjsgy/H19/qEveRqSeT/Og/mCi7AjKe/UeS+EB3vqA7GfkkyGkM2x/U/+F+5RkyzFCXPA2nOw==
dependencies:
"@cornerstonejs/core" "^1.19.3"
"@cornerstonejs/core" "^1.19.4"
"@cornerstonejs/tools@^1.19.3":
version "1.19.3"
resolved "https://registry.yarnpkg.com/@cornerstonejs/tools/-/tools-1.19.3.tgz#d5f8f02adcdc4e5627b6565b4c60c642032a95c4"
integrity sha512-YcxrP6D5SR7epS+gmLZNK+K2yyFMshgPqHBf6PxS0nKq8jhYT6KHFjT0SBBRh+EJNrYCIYgy0D10PPSTg+kmVw==
"@cornerstonejs/tools@^1.19.4":
version "1.19.4"
resolved "https://registry.yarnpkg.com/@cornerstonejs/tools/-/tools-1.19.4.tgz#c0d97c40c3d3b0c13dd359eef703de394994c719"
integrity sha512-BVlmi1LuLH4Q5ZYGAPJT/p7t9p8NGLrux1eBGx7LmDe7G2ZOsOWU3kGkbGAzVtb/d0HB9eBV3cruA0+xRwmpMA==
dependencies:
"@cornerstonejs/core" "^1.19.3"
"@cornerstonejs/core" "^1.19.4"
lodash.clonedeep "4.5.0"
lodash.get "^4.4.2"