feat(tmtv-mode): Add Brush tools and move SUV peak calculation to web worker (#4053)
This commit is contained in:
1 parent
8c5ab942b9
commit
8192e348ec
27 files changed
+593
-212
No files matched your search
@@ -346,9 +346,9 @@ function commandsModule({
|
||||
}
|
||||
}
|
||||
},
|
||||
setToolActiveToolbar: ({ value, itemId, toolGroupIds = [] }) => {
|
||||
setToolActiveToolbar: ({ value, itemId, toolName, toolGroupIds = [] }) => {
|
||||
// Sometimes it is passed as value (tools with options), sometimes as itemId (toolbar buttons)
|
||||
const toolName = itemId || value;
|
||||
toolName = toolName || itemId || value;
|
||||
|
||||
toolGroupIds = toolGroupIds.length ? toolGroupIds : toolGroupService.getToolGroupIds();
|
||||
|
||||
|
||||
+8
-6
@@ -2,10 +2,12 @@ import { getWebWorkerManager } from '@cornerstonejs/core';
|
||||
|
||||
const workerManager = getWebWorkerManager();
|
||||
|
||||
const options = {
|
||||
// maxWorkerInstances: 1,
|
||||
// overwrite: false
|
||||
autoTerminationOnIdle: 1000,
|
||||
const WorkerOptions = {
|
||||
maxWorkerInstances: 1,
|
||||
autoTerminateOnIdle: {
|
||||
enabled: true,
|
||||
idleTimeThreshold: 1000,
|
||||
},
|
||||
};
|
||||
|
||||
// Register the task
|
||||
@@ -15,9 +17,9 @@ const workerFn = () => {
|
||||
});
|
||||
};
|
||||
|
||||
workerManager.registerWorker('histogram-worker', workerFn, options);
|
||||
|
||||
const getViewportVolumeHistogram = async (viewport, volume, options?) => {
|
||||
workerManager.registerWorker('histogram-worker', workerFn, WorkerOptions);
|
||||
|
||||
if (!volume?.loadStatus.loaded) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -279,19 +279,18 @@ export default async function init({
|
||||
eventTarget.addEventListener(EVENTS.ELEMENT_DISABLED, elementDisabledHandler.bind(null));
|
||||
colormaps.forEach(registerColormap);
|
||||
|
||||
// Create a debounced function that shows the notification
|
||||
const debouncedShowNotification = debounce(detail => {
|
||||
uiNotificationService.show({
|
||||
title: detail.type,
|
||||
message: detail.message,
|
||||
type: 'error',
|
||||
});
|
||||
}, 300);
|
||||
|
||||
// Event listener
|
||||
eventTarget.addEventListener(EVENTS.ERROR_EVENT, ({ detail }) => {
|
||||
debouncedShowNotification(detail);
|
||||
});
|
||||
eventTarget.addEventListenerDebounced(
|
||||
EVENTS.ERROR_EVENT,
|
||||
({ detail }) => {
|
||||
uiNotificationService.show({
|
||||
title: detail.type,
|
||||
message: detail.message,
|
||||
type: 'error',
|
||||
});
|
||||
},
|
||||
1000
|
||||
);
|
||||
}
|
||||
|
||||
function CPUModal() {
|
||||
|
||||
Reference in new issue
Block a user