[OHIF-288] Rehydrating SRs is missing Labels (#1885)

* WIP

* Finish OHIF-288, need to update dcmjs.

* Remove unused copied resources.

* Cleaned up label import code.

* Update for dcmjs Findings -> Finding.

* Update dcmjs

* Remove debuggers

* Respond to reviewer comments.

* update dcmjs version

Co-authored-by: Danny Brown <danny.ri.brown@gmail.com>
This commit is contained in:
James PettsandDanny Brown authored and GitHub committed 2020-07-10 15:11:22 -04:00
1 parent ce40f04f2e
commit 3eba027003
19 files changed
+152 -46

No files matched your search

@@ -0,0 +1,23 @@
/**
* Extracts the label from the toolData imported from dcmjs. We need to do this
* as dcmjs does not depeend on OHIF/the MeasurementService, it just produces data for cornestoneTools.
* This optional data is available for the consumer to process if they wish to.
* @param {object} toolData The tooldata relating to the
*
* @returns {string} The extracted label.
*/
export default function getLabelFromDCMJSImportedToolData(toolData) {
const { findingSites = [], finding } = toolData;
let freeTextLabel = findingSites.find(
fs => fs.CodeValue === 'CORNERSTONEFREETEXT'
);
if (freeTextLabel) {
return freeTextLabel.CodeMeaning;
}
if (finding && finding.CodeValue === 'CORNERSTONEFREETEXT') {
return finding.CodeMeaning;
}
}
@@ -51,7 +51,7 @@ function Length(measurementData, imageId, _getValueTypeFromToolType) {
StudyInstanceUID,
} = instance;
const { handles } = measurementData;
const { handles, label } = measurementData;
const points = [];
Object.keys(handles).map(handle => {
@@ -75,6 +75,7 @@ function Length(measurementData, imageId, _getValueTypeFromToolType) {
length: measurementData.length,
type: _getValueTypeFromToolType(tool),
points,
label,
};
}
@@ -88,7 +89,7 @@ function Bidirectional(measurementData, imageId, _getValueTypeFromToolType) {
StudyInstanceUID,
} = instance;
const { handles } = measurementData;
const { handles, label } = measurementData;
const longAxis = [handles.start, handles.end];
const shortAxis = [handles.perpendicularStart, handles.perpendicularEnd];
@@ -106,6 +107,7 @@ function Bidirectional(measurementData, imageId, _getValueTypeFromToolType) {
longestDiameter: measurementData.longestDiameter,
type: _getValueTypeFromToolType(tool),
points: { longAxis, shortAxis },
label,
};
}
@@ -119,7 +121,8 @@ function EllipticalRoi(measurementData, imageId, _getValueTypeFromToolType) {
StudyInstanceUID,
} = instance;
const { start, end } = measurementData.handles;
const { handles, label } = measurementData;
const { start, end } = handles;
const halfXLength = Math.abs(start.x - end.x) / 2;
const halfYLength = Math.abs(start.y - end.y) / 2;
@@ -161,6 +164,7 @@ function EllipticalRoi(measurementData, imageId, _getValueTypeFromToolType) {
.area /* TODO: Add concept names instead (descriptor) */,
type: _getValueTypeFromToolType(tool),
points,
label,
};
}
@@ -198,5 +202,6 @@ function ArrowAnnotate(measurementData, imageId, _getValueTypeFromToolType) {
text: measurementData.text,
type: _getValueTypeFromToolType(tool),
points,
label,
};
}