[OHIF-261 & OHIF-262] (#1862)
* WIP * Reset viewport grid on mode switch. * Make lifecyclehooks distinct from modules. Add needed SR hydration state on creation. * Update extensions/cornerstone/src/init.js * Remove unused REMOVE_MEASUREMENT listener. Co-authored-by: Danny Brown <danny.ri.brown@gmail.com>
This commit is contained in:
1 parent
4dfe144bf8
commit
14797a8973
13 files changed
+156
-25
No files matched your search
@@ -5,7 +5,6 @@ const displaySetCache = [];
|
||||
|
||||
export default class DisplaySetService {
|
||||
constructor() {
|
||||
this.displaySets = {};
|
||||
this.activeDisplaySets = [];
|
||||
this.listeners = {};
|
||||
this.EVENTS = EVENTS;
|
||||
@@ -33,6 +32,10 @@ export default class DisplaySetService {
|
||||
});
|
||||
}
|
||||
|
||||
getDisplaySetCache() {
|
||||
return displaySetCache;
|
||||
}
|
||||
|
||||
getActiveDisplaySets() {
|
||||
return this.activeDisplaySets;
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ class MeasurementService {
|
||||
if (this.measurements[id]) {
|
||||
const updatedMeasurement = {
|
||||
...measurement,
|
||||
modifiedTimestamp: Math.floor(Date.now() / 1000)
|
||||
modifiedTimestamp: Math.floor(Date.now() / 1000),
|
||||
};
|
||||
|
||||
log.info(`Updating measurement...`, updatedMeasurement);
|
||||
@@ -492,6 +492,12 @@ class MeasurementService {
|
||||
this._broadcastChange(this.EVENTS.MEASUREMENT_REMOVED, source, id);
|
||||
}
|
||||
|
||||
clearMeasurements() {
|
||||
this.measurements = {};
|
||||
|
||||
this._broadcastChange(this.EVENTS.MEASUREMENTS_CLEARED);
|
||||
}
|
||||
|
||||
_getMappingByMeasurementSource(measurementId, definition) {
|
||||
const measurement = this.getMeasurement(measurementId);
|
||||
if (this._isValidSource(measurement.source)) {
|
||||
|
||||
@@ -8,6 +8,7 @@ const publicAPI = {
|
||||
setLayout: _setLayout,
|
||||
setCachedLayout: _setCachedLayout,
|
||||
setServiceImplementation,
|
||||
reset: _reset,
|
||||
};
|
||||
|
||||
const serviceImplementation = {
|
||||
@@ -17,6 +18,7 @@ const serviceImplementation = {
|
||||
_setDisplaysetForViewport: () =>
|
||||
console.warn('setDisplaysetForViewport() NOT IMPLEMENTED'),
|
||||
_setLayout: () => console.warn('setLayout() NOT IMPLEMENTED'),
|
||||
_reset: () => console.warn('reset() NOT IMPLEMENTED'),
|
||||
_setCachedLayout: () => console.warn('setCachedLayout() NOT IMPLEMENTED'),
|
||||
};
|
||||
|
||||
@@ -39,6 +41,9 @@ function _setLayout({ numCols, numRows }) {
|
||||
return serviceImplementation._setLayout({ numCols, numRows });
|
||||
}
|
||||
|
||||
function _reset() {
|
||||
return serviceImplementation._reset({});
|
||||
}
|
||||
function _setCachedLayout({ numCols, numRows, viewports }) {
|
||||
return serviceImplementation._setLayout({ numCols, numRows, viewports });
|
||||
}
|
||||
@@ -49,6 +54,7 @@ function setServiceImplementation({
|
||||
setDisplaysetForViewport: setDisplaysetForViewportImplementation,
|
||||
setCachedLayout: setCachedLayoutImplementation,
|
||||
setLayout: setLayoutImplementation,
|
||||
reset: resetImplementation,
|
||||
}) {
|
||||
if (getStateImplementation) {
|
||||
serviceImplementation._getState = getStateImplementation;
|
||||
@@ -62,6 +68,9 @@ function setServiceImplementation({
|
||||
if (setLayoutImplementation) {
|
||||
serviceImplementation._setLayout = setLayoutImplementation;
|
||||
}
|
||||
if (resetImplementation) {
|
||||
serviceImplementation._reset = resetImplementation;
|
||||
}
|
||||
if (setCachedLayoutImplementation) {
|
||||
serviceImplementation._setCachedLayout = setCachedLayoutImplementation;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user