fix: Segmentation not displayed and unable to draw segments in volume viewport after converting Labelmap to Surface (#5488)
* fix: unable to draw segment after 3d layout * comment update ---------
This commit is contained in:
parent
05ecdfe512
commit
faea09e7ef
@ -65,13 +65,11 @@ const segmentationRepresentationModifiedCallback = async (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// whatever type the source viewport has, we need to add that to the target viewport
|
// Ensure the segmentation representation aligns with the target viewport type.
|
||||||
const sourceViewportRepresentation = segmentationService.getSegmentationRepresentations(
|
const type: Enums.SegmentationRepresentations =
|
||||||
sourceViewport.viewportId,
|
viewport.type === CoreEnums.ViewportType.VOLUME_3D
|
||||||
{ segmentationId }
|
? Enums.SegmentationRepresentations.Surface
|
||||||
);
|
: Enums.SegmentationRepresentations.Labelmap;
|
||||||
|
|
||||||
const type = sourceViewportRepresentation[0].type;
|
|
||||||
|
|
||||||
await segmentationService.addSegmentationRepresentation(targetViewportId, {
|
await segmentationService.addSegmentationRepresentation(targetViewportId, {
|
||||||
segmentationId,
|
segmentationId,
|
||||||
|
|||||||
@ -1336,17 +1336,12 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
|
|||||||
const { segmentationId, type, hydrated } = presentationItem;
|
const { segmentationId, type, hydrated } = presentationItem;
|
||||||
|
|
||||||
const { Labelmap, Surface } = csToolsEnums.SegmentationRepresentations;
|
const { Labelmap, Surface } = csToolsEnums.SegmentationRepresentations;
|
||||||
const representationType = (() => {
|
const isVolume3D = viewport.type === csEnums.ViewportType.VOLUME_3D;
|
||||||
if (type === Surface) {
|
|
||||||
if (viewport.type === csEnums.ViewportType.VOLUME_3D) {
|
|
||||||
return Surface;
|
|
||||||
} else {
|
|
||||||
return Labelmap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return type;
|
// Determine the appropriate segmentation representation for the viewport.
|
||||||
})();
|
// If the current type is Surface but the viewport is not 3D, fallback to Labelmap.
|
||||||
|
// Otherwise, use the existing type.
|
||||||
|
const representationType = type === Surface && !isVolume3D ? Labelmap : type;
|
||||||
|
|
||||||
if (hydrated) {
|
if (hydrated) {
|
||||||
segmentationService.addSegmentationRepresentation(viewport.id, {
|
segmentationService.addSegmentationRepresentation(viewport.id, {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user