fix(segmentation): segment bidirectional tool error and show toast notification when no segment is drawn (#5861)
This commit is contained in:
parent
6db0bc2d4c
commit
7e10830d58
@ -398,12 +398,31 @@ function commandsModule({
|
|||||||
|
|
||||||
const { segmentationId: targetId, segmentIndex: targetIndex } = targetSegmentation;
|
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
|
// Get bidirectional measurement data
|
||||||
const bidirectionalData = await cstUtils.segmentation.getSegmentLargestBidirectional({
|
const bidirectionalData = await cstUtils.segmentation.getSegmentLargestBidirectional({
|
||||||
segmentationId: targetId,
|
segmentationId: targetId,
|
||||||
segmentIndices: [targetIndex],
|
segmentIndices: [targetIndex],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!bidirectionalData.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const activeViewportId = viewportGridService.getActiveViewportId();
|
const activeViewportId = viewportGridService.getActiveViewportId();
|
||||||
|
|
||||||
// Process each bidirectional measurement
|
// Process each bidirectional measurement
|
||||||
|
|||||||
@ -42,8 +42,7 @@
|
|||||||
"Export": "Export",
|
"Export": "Export",
|
||||||
"CSV Report": "CSV Report",
|
"CSV Report": "CSV Report",
|
||||||
"DICOM SEG": "DICOM SEG",
|
"DICOM SEG": "DICOM SEG",
|
||||||
"DICOM RTSS": "DICOM RTSS"
|
"DICOM RTSS": "DICOM RTSS",
|
||||||
,
|
|
||||||
"Fill contour holes": "Fill contour holes",
|
"Fill contour holes": "Fill contour holes",
|
||||||
"Fill Holes": "Fill Holes",
|
"Fill Holes": "Fill Holes",
|
||||||
"Remove Small Contours": "Remove Small Contours",
|
"Remove Small Contours": "Remove Small Contours",
|
||||||
@ -63,5 +62,7 @@
|
|||||||
"New segment name": "New segment name",
|
"New segment name": "New segment name",
|
||||||
"No segmentations available": "No segmentations available",
|
"No segmentations available": "No segmentations available",
|
||||||
"Not available on the current viewport": "Not available on the current viewport",
|
"Not available on the current viewport": "Not available on the current viewport",
|
||||||
"Add segment to enable this tool": "Add segment to enable this tool"
|
"Add segment to enable this tool": "Add segment to enable this tool",
|
||||||
|
"Segment Bidirectional": "Segment Bidirectional",
|
||||||
|
"Draw a segment before using bidirectional measurement": "Draw a segment before using bidirectional measurement"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,5 +62,7 @@
|
|||||||
"New segment name": "Test New segment name",
|
"New segment name": "Test New segment name",
|
||||||
"No segmentations available": "Test No segmentations available",
|
"No segmentations available": "Test No segmentations available",
|
||||||
"Not available on the current viewport": "Test Not available on the current viewport",
|
"Not available on the current viewport": "Test Not available on the current viewport",
|
||||||
"Add segment to enable this tool": "Test Add segment to enable this tool"
|
"Add segment to enable this tool": "Test Add segment to enable this tool",
|
||||||
|
"Segment Bidirectional": "Test Segment Bidirectional",
|
||||||
|
"Draw a segment before using bidirectional measurement": "Test Draw a segment before using bidirectional measurement"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -246,6 +246,16 @@ export class RightPanelPageObject {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get segmentBidirectional() {
|
||||||
|
const button = page.getByTestId('SegmentBidirectional');
|
||||||
|
return {
|
||||||
|
button,
|
||||||
|
click: async () => {
|
||||||
|
await button.click();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user