Finish render tool other than rotated ellipse and clean up.

This commit is contained in:
James A. Petts 2020-06-05 17:59:07 +01:00
parent f4470c9625
commit 83497795ca
3 changed files with 39 additions and 13 deletions

View File

@ -6,6 +6,11 @@ const { ImageSet } = classes;
const sopClassHandlerName = 'dicom-sr';
// TODO ->
// Add SR thumbnail
// Make viewport
// Get stacks from referenced displayInstanceUID and load into wrapped CornerStone viewport.
const sopClassUids = [
'1.2.840.10008.5.1.4.1.1.88.11', //BASIC_TEXT_SR:
'1.2.840.10008.5.1.4.1.1.88.22', //ENHANCED_SR:
@ -327,6 +332,10 @@ function _processTID1410Measurement(mergedContentSequence) {
group => group.ValueType === 'SCOORD'
);
const UIDREFContentItem = mergedContentSequence.find(
group => group.ValueType === 'UIDREF'
);
if (!graphicItem) {
console.warn(
`graphic ValueType ${graphicItem.ValueType} not currently supported, skipping annotation.`
@ -342,6 +351,7 @@ function _processTID1410Measurement(mergedContentSequence) {
loaded: false,
labels: [],
coords: [_getCoordsFromSCOORDOrSCOORD3D(graphicItem)],
TrackingUniqueIdentifier: UIDREFContentItem.UID,
};
NUMContentItems.forEach(item => {
@ -365,12 +375,19 @@ function _processNonGeometricallyDefinedMeasurement(mergedContentSequence) {
group => group.ValueType === 'NUM'
);
const UIDREFContentItem = mergedContentSequence.find(
group => group.ValueType === 'UIDREF'
);
const measurement = {
loaded: false,
labels: [],
coords: [],
TrackingUniqueIdentifier: UIDREFContentItem.UID,
};
debugger;
NUMContentItems.forEach(item => {
const {
ConceptNameCodeSequence,

View File

@ -45,23 +45,28 @@ export default class DICOMSRDisplayTool extends BaseTool {
for (let i = 0; i < toolState.data.length; i++) {
const data = toolState.data[i];
const { renderableData } = data;
Object.keys(data).forEach(GraphicType => {
const renderableData = data[GraphicType];
Object.keys(renderableData).forEach(GraphicType => {
const renderableDataForGraphicType = renderableData[GraphicType];
switch (GraphicType) {
case SCOORD_TYPES.POINT:
case SCOORD_TYPES.MULTIPOINT:
renderPointOrMultipoint(renderableData, eventData, options);
renderPointOrMultipoint(
renderableDataForGraphicType,
eventData,
options
);
break;
case SCOORD_TYPES.POLYLINE:
renderPolyLine(renderableData, eventData, options);
renderPolyLine(renderableDataForGraphicType, eventData, options);
break;
case SCOORD_TYPES.CIRCLE:
renderCircle(renderableData, eventData, options);
renderCircle(renderableDataForGraphicType, eventData, options);
break;
case SCOORD_TYPES.ELLIPSE:
renderEllipse(renderableData, eventData, options);
renderEllipse(renderableDataForGraphicType, eventData, options);
break;
}
});

View File

@ -16,25 +16,27 @@ export default function addMeasurement(
console.log(imageId);
console.log('============================');
// TODO -> GET TRACKING UID AND ADD IT TO TOOL DATA AND ALSO THE MEASUREMENT ENTRY.
// TODO -> Render rotated ellipse .
debugger;
const toolName = TOOL_NAMES.DICOM_SR_DISPLAY_TOOL;
const measurementData = {};
const measurementData = {
TrackingUniqueIdentifier: measurement.TrackingUniqueIdentifier,
renderableData: {},
};
measurement.coords.forEach(coord => {
const { GraphicType, GraphicData } = coord;
if (measurementData[GraphicType] === undefined) {
measurementData[GraphicType] = [];
if (measurementData.renderableData[GraphicType] === undefined) {
measurementData.renderableData[GraphicType] = [];
}
const renderableData = _getRenderableData(GraphicType, GraphicData);
measurementData[GraphicType].push(renderableData);
measurementData.renderableData[GraphicType].push(
_getRenderableData(GraphicType, GraphicData)
);
});
const toolState = globalImageIdSpecificToolStateManager.saveToolState();
@ -59,6 +61,8 @@ export default function addMeasurement(
measurement.loaded = true;
measurement.imageId = imageId;
measurement.displaySetInstanceUID = displaySetInstanceUID;
delete measurement.coords;
debugger;
}