fix(markerlabelmap): accept preview/reject preview not working when the marker annotation tools are active (#5101)

Co-authored-by: Bill Wallace <wayfarer3130@gmail.com>
This commit is contained in:
Ibrahim 2025-06-10 11:47:20 -04:00 committed by GitHub
parent 10ef509ff1
commit 26fd51f535
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,6 +65,14 @@ const getLabelmapTools = ({ toolGroupService }) => {
return labelmapTools; return labelmapTools;
}; };
const getPreviewTools = ({ toolGroupService }) => {
const labelmapTools = getLabelmapTools({ toolGroupService });
const previewTools = labelmapTools.filter(tool => tool.acceptPreview || tool.rejectPreview);
return previewTools;
};
const segmentAI = new ONNXSegmentationController({ const segmentAI = new ONNXSegmentationController({
autoSegmentMode: true, autoSegmentMode: true,
models: { models: {
@ -1709,14 +1717,15 @@ function commandsModule({
}); });
}, },
_handlePreviewAction: action => { _handlePreviewAction: action => {
const labelmapTools = getLabelmapTools({ toolGroupService });
const { viewport } = _getActiveViewportEnabledElement(); const { viewport } = _getActiveViewportEnabledElement();
const activeTools = labelmapTools.filter( const previewTools = getPreviewTools({ toolGroupService });
tool => tool.mode === 'Active' || tool.mode === 'Enabled'
);
activeTools.forEach(tool => { previewTools.forEach(tool => {
try {
tool[`${action}Preview`](); tool[`${action}Preview`]();
} catch (error) {
console.debug('Error accepting preview for tool', tool.toolName);
}
}); });
if (segmentAI.enabled) { if (segmentAI.enabled) {