fix(segmentation): segment bidirectional tool error and show toast notification when no segment is drawn (#5861)

This commit is contained in:
Ghadeer Albattarni authored and GitHub committed 2026-03-04 15:22:10 -05:00
1 parent 6db0bc2d4c
commit 7e10830d58
4 files changed
+36 -4

No files matched your search

@@ -398,12 +398,31 @@ function commandsModule({
const { segmentationId: targetId, segmentIndex: targetIndex } = targetSegmentation;
// Check if the segment has voxels before computing bidirectional measurement
const uniqueSegmentIndices = cstUtils.segmentation.getUniqueSegmentIndices(targetId);
const hasVoxels = uniqueSegmentIndices.includes(targetIndex);
if (!hasVoxels) {
uiNotificationService.show({
title: i18n.t('SegmentationPanel:Segment Bidirectional'),
message: i18n.t(
'SegmentationPanel:Draw a segment before using bidirectional measurement'
),
type: 'warning',
});
return;
}
// Get bidirectional measurement data
const bidirectionalData = await cstUtils.segmentation.getSegmentLargestBidirectional({
segmentationId: targetId,
segmentIndices: [targetIndex],
});
if (!bidirectionalData.length) {
return;
}
const activeViewportId = viewportGridService.getActiveViewportId();
// Process each bidirectional measurement