feat(findingSite): Allow customizing the measurement panel and show site/finding (#3155)
* feat: Allow customizing the measurements panel. Also includes default display of the site/finding values from the DICOM SR object. Update fixes PR review comments - move the recordInteraction to COmmandsManager.run PR fixes fix: Dependency updates to allow right click to be recognized PR fixes * Use newer CSWIL * Make both the base measurements and the tracking measurements show codes * Fix the right click context menu bringing up menu
This commit is contained in:
1 parent
dd22e37e4c
commit
8e9d7bd2bb
10 files changed
+152
-48
No files matched your search
@@ -35,7 +35,7 @@ function getFilteredCornerstoneToolState(
|
||||
);
|
||||
const toolData = imageIdSpecificToolState[toolType].data;
|
||||
|
||||
let finding;
|
||||
let { finding } = measurementDataI;
|
||||
const findingSites = [];
|
||||
|
||||
// NOTE -> We use the CORNERSTONEJS coding schemeDesignator which we have
|
||||
@@ -56,6 +56,10 @@ function getFilteredCornerstoneToolState(
|
||||
}
|
||||
}
|
||||
|
||||
if (measurementDataI.findingSites) {
|
||||
findingSites.push(...measurementDataI.findingSites);
|
||||
}
|
||||
|
||||
const measurement = Object.assign({}, annotation, {
|
||||
finding,
|
||||
findingSites,
|
||||
@@ -73,7 +77,7 @@ function getFilteredCornerstoneToolState(
|
||||
for (let i = 0; i < framesOfReference.length; i++) {
|
||||
const frameOfReference = framesOfReference[i];
|
||||
|
||||
const frameOfReferenceAnnotations = annotationManager.getFrameOfReferenceAnnotations(
|
||||
const frameOfReferenceAnnotations = annotationManager.getAnnotations(
|
||||
frameOfReference
|
||||
);
|
||||
|
||||
|
||||
@@ -11,6 +11,25 @@ const CORNERSTONE_3D_TOOLS_SOURCE_VERSION = '0.1';
|
||||
|
||||
const supportedLegacyCornerstoneTags = ['cornerstoneTools@^4.0.0'];
|
||||
|
||||
const convertCode = (codingValues, code) => {
|
||||
if (!code || code.CodingSchemeDesignator === 'CORNERSTONEJS') return;
|
||||
const ref = `${code.CodingSchemeDesignator}:${code.CodeValue}`;
|
||||
const ret = { ...codingValues[ref], ref, ...code, text: code.CodeMeaning };
|
||||
return ret;
|
||||
};
|
||||
|
||||
const convertSites = (codingValues, sites) => {
|
||||
if (!sites || !sites.length) return;
|
||||
const ret = [];
|
||||
// Do as a loop to convert away from Proxy instances
|
||||
for (let i = 0; i < sites.length; i++) {
|
||||
// Deal with irregular conversion from dcmjs
|
||||
const site = convertCode(codingValues, sites[i][0] || sites[i]);
|
||||
if (site) ret.push(site);
|
||||
}
|
||||
return (ret.length && ret) || undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Hydrates a structured report, for default viewports.
|
||||
*
|
||||
@@ -20,8 +39,16 @@ export default function hydrateStructuredReport(
|
||||
displaySetInstanceUID
|
||||
) {
|
||||
const dataSource = extensionManager.getActiveDataSource()[0];
|
||||
const { measurementService, displaySetService } = servicesManager.services;
|
||||
const {
|
||||
measurementService,
|
||||
displaySetService,
|
||||
customizationService,
|
||||
} = servicesManager.services;
|
||||
|
||||
const codingValues = customizationService.getCustomization(
|
||||
'codingValues',
|
||||
{}
|
||||
);
|
||||
const displaySet = displaySetService.getDisplaySetByUID(
|
||||
displaySetInstanceUID
|
||||
);
|
||||
@@ -171,6 +198,15 @@ export default function hydrateStructuredReport(
|
||||
CORNERSTONE_3D_TOOLS_SOURCE_VERSION
|
||||
);
|
||||
annotation.data.label = getLabelFromDCMJSImportedToolData(toolData);
|
||||
annotation.data.finding = convertCode(
|
||||
codingValues,
|
||||
toolData.finding?.[0]
|
||||
);
|
||||
annotation.data.findingSites = convertSites(
|
||||
codingValues,
|
||||
toolData.findingSites
|
||||
);
|
||||
annotation.data.site = annotation.data.findingSites?.[0];
|
||||
|
||||
const matchingMapping = mappings.find(
|
||||
m => m.annotationType === annotationType
|
||||
|
||||
Reference in new issue
Block a user