fix(segmentation): List surface representations in the segmentation table for 3D views. (#5700)

This was done by using an array of representation types instead of a single type for a panel.
The first element of the array is the primary type of the panel, and the rest are secondary types
that can also be displayed in the panel.

PR feedback:
- added test to check number of segments in side panel for 3D only view
- fixed jumping to segment in 3D only view
- fixed exception when adding contour segment in 3D only view
This commit is contained in:
Joe Boccanfuso authored and GitHub committed 2026-01-13 15:57:44 -05:00
1 parent 83c9ce0f5f
commit 82e6a18735
27 files changed
+356 -293

No files matched your search

@@ -14,13 +14,13 @@ export const AddSegmentationRow: React.FC<{ children?: React.ReactNode }> = ({
disableEditing,
mode,
disabled,
segmentationRepresentationType,
segmentationRepresentationTypes,
} = useSegmentationTableContext('AddSegmentationRow');
// Check if we have at least one segmentation of the representation type for the panel this component is contained in.
const hasRepresentationType =
(!segmentationRepresentationType && data.length > 0) ||
data.some(info => segmentationRepresentationType === info.representation?.type);
(!segmentationRepresentationTypes && data.length > 0) ||
data.some(info => segmentationRepresentationTypes?.includes(info.representation?.type));
if (hasRepresentationType && mode === 'collapsed') {
return null;
@@ -35,7 +35,11 @@ export const AddSegmentationRow: React.FC<{ children?: React.ReactNode }> = ({
data-cy="addSegmentation"
className={`group ${disabled ? 'pointer-events-none cursor-not-allowed opacity-70' : ''}`}
onClick={() =>
!disabled && onSegmentationAdd({ segmentationId: '', segmentationRepresentationType })
!disabled &&
onSegmentationAdd({
segmentationId: '',
segmentationRepresentationType: segmentationRepresentationTypes?.[0],
})
}
>
{children}