This commit is contained in:
Davide Punzo committed 2021-04-20 16:39:04 +02:00
1 parent e41ba2bfde
commit e421bc7df9
7 files changed
+237 -159

No files matched your search

@@ -155,7 +155,9 @@ const SegmentationPanel = ({
const brushStackState = getBrushStackState();
brushStackState.activeLabelmapIndex = newLabelmapIndex;
setState(state => ({ ...state, selectedSegmentation }));
if (selectedSegmentation) {
setState(state => ({ ...state, selectedSegmentation }));
}
refreshViewports();
@@ -189,10 +191,9 @@ const SegmentationPanel = ({
'extensiondicomsegmentationsegloaded',
refreshSegmentations
);
document.addEventListener(
'extensiondicomsegmentationsegloadingfailed',
cleanSegmentationComboBox
'extensiondicomsegmentationsegselected',
updateSegmentationComboBox
);
/*
@@ -213,8 +214,8 @@ const SegmentationPanel = ({
refreshSegmentations
);
document.removeEventListener(
'extensiondicomsegmentationsegloadingfailed',
cleanSegmentationComboBox
'extensiondicomsegmentationsegselected',
updateSegmentationComboBox
);
cornerstoneTools.store.state.enabledElements.forEach(enabledElement =>
enabledElement.removeEventListener(
@@ -225,6 +226,15 @@ const SegmentationPanel = ({
};
}, [activeIndex, viewports]);
const updateSegmentationComboBox = (e) => {
const index = e.detail.activatedLabelmapIndex;
if (index !== -1) {
setState(state => ({ ...state, selectedSegmentation: index }));
} else {
cleanSegmentationComboBox();
}
}
const cleanSegmentationComboBox = () => {
setState(state => ({
...state,