* Add scoord3d parse / display tool to v2 * Update measurement panel with sr measurements * Update measurement panel to display read only items * Cleanup debugger statement * Check for empty measurement * fix SCOORD3D coordinates * Update getRenderableData.js * fix scoord3d coordinate transformation * implement logic to detect the ReferencedSOPInstanceUID if missing in the measurement. Fix also world to IJ coordinates. * Fix broken unit test / import * fix comment style * Init tools only once * restore default config dcmjs server Co-authored-by: igoroctaviano <igoroctaviano@gmail.com>
62 lines
1.6 KiB
JavaScript
62 lines
1.6 KiB
JavaScript
import cornerstone from 'cornerstone-core';
|
|
|
|
const state = {
|
|
TrackingUniqueIdentifier: null,
|
|
trackingIdentifiersByEnabledElementUUID: {},
|
|
};
|
|
|
|
function setTrackingUniqueIdentifiersForElement(
|
|
element,
|
|
trackingUniqueIdentifiers,
|
|
activeIndex = 0
|
|
) {
|
|
const enabledElement = cornerstone.getEnabledElement(element);
|
|
const { uuid } = enabledElement;
|
|
|
|
state.trackingIdentifiersByEnabledElementUUID[uuid] = {
|
|
trackingUniqueIdentifiers,
|
|
activeIndex,
|
|
};
|
|
}
|
|
|
|
function setActiveTrackingUniqueIdentifierForElement(
|
|
element,
|
|
TrackingUniqueIdentifier
|
|
) {
|
|
const enabledElement = cornerstone.getEnabledElement(element);
|
|
const { uuid } = enabledElement;
|
|
|
|
const trackingIdentifiersForElement =
|
|
state.trackingIdentifiersByEnabledElementUUID[uuid];
|
|
|
|
if (trackingIdentifiersForElement) {
|
|
const activeIndex = trackingIdentifiersForElement.trackingUniqueIdentifiers.findIndex(
|
|
tuid => tuid === TrackingUniqueIdentifier
|
|
);
|
|
|
|
trackingIdentifiersForElement.activeIndex = activeIndex;
|
|
}
|
|
}
|
|
|
|
function getTrackingUniqueIdentifiersForElement(element) {
|
|
const enabledElement = cornerstone.getEnabledElement(element);
|
|
const { uuid } = enabledElement;
|
|
|
|
if (state.trackingIdentifiersByEnabledElementUUID[uuid]) {
|
|
return state.trackingIdentifiersByEnabledElementUUID[uuid];
|
|
}
|
|
|
|
return { trackingUniqueIdentifiers: [] };
|
|
}
|
|
|
|
export default {
|
|
state,
|
|
getters: {
|
|
trackingUniqueIdentifiersForElement: getTrackingUniqueIdentifiersForElement,
|
|
},
|
|
setters: {
|
|
trackingUniqueIdentifiersForElement: setTrackingUniqueIdentifiersForElement,
|
|
activeTrackingUniqueIdentifierForElement: setActiveTrackingUniqueIdentifierForElement,
|
|
},
|
|
};
|