# 3D view of segmentation node is broken when loading from a file

**URL:** <https://discourse.slicer.org/t/3d-view-of-segmentation-node-is-broken-when-loading-from-a-file/44781>\
**Category:** Development\
**Created:** [October 16, 2025, 10:30am UTC](https://discourse.slicer.org/t/3d-view-of-segmentation-node-is-broken-when-loading-from-a-file/44781 "2025-10-16T10:30:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Victor\_Wayne](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/victor_wayne/32/80778_2.png) [@Victor\_Wayne](https://discourse.slicer.org/u/Victor_Wayne)\
**Post date:** [October 16, 2025, 10:30am UTC](https://discourse.slicer.org/t/3d-view-of-segmentation-node-is-broken-when-loading-from-a-file/44781/1 "2025-10-16T10:30:54Z")

</div>

Hello,

I am facing an issue of segmentation node being broken when loading from a file. When I segment it and work with it, it is being displayed pretty accurately. But when I load it from a mrml file it has some extra pieces in the parts where it should be an empty pit.

Setting the segmentation node’s master representation to a closed surface representation fixes that, but it messes up the 2d view. I used the function `SetSourceRepresentationToClosedSurface()` to change the master/source representation.

I found two functions in the in the vtkMRMLSegmentationDisplayNode. That functions are  
`void SetPreferredDisplayRepresentation2D(const char*`_`)`  
 `void SetPreferredDisplayRepresentation3D(const char`_`*)`

But I can’t seem to find what string I should pass in this function. There is no additional docstring in the .h file. In fact, there is no declarationg of this function in the .h file.

Is there any way to fix it?

Thanks for your help in advance.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 16, 2025, 12:28pm UTC](https://discourse.slicer.org/t/3d-view-of-segmentation-node-is-broken-when-loading-from-a-file/44781/2 "2025-10-16T12:28:29Z")

</div>

Rendering of the closed surface representation in slice views may have rendering artifacts if the surface is too complex. You can try to smooth and simplify the surface to avoid this.

Alternatively, you can use binary labelmap as source representation. In that case, 2D views are always correct. However, you may need to set higher resolution to preserve more details.

> [@Victor\_Wayne](#):
>
> I found two functions in the in the vtkMRMLSegmentationDisplayNode. That functions are  
> `void SetPreferredDisplayRepresentation2D(const char*` _`)`  
> `void SetPreferredDisplayRepresentation3D(const char`_ `*)`
> 
> But I can’t seem to find what string I should pass in this function.

There is no fixed set of representation names, because any extension can specify additional representations. However, for convenience, the most commonly used representation names are available from the `vtkSegmentationConverter` class. For example:

```auto
>>> slicer.vtkSegmentationConverter.GetBinaryLabelmapRepresentationName()
'Binary labelmap'
>>> slicer.vtkSegmentationConverter.GetClosedSurfaceRepresentationName()
'Closed surface'

```

---

<div class="post-metadata">

**Author:** ![Victor\_Wayne](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/victor_wayne/32/80778_2.png) [@Victor\_Wayne](https://discourse.slicer.org/u/Victor_Wayne)\
**Post date:** [October 17, 2025, 5:28am UTC](https://discourse.slicer.org/t/3d-view-of-segmentation-node-is-broken-when-loading-from-a-file/44781/3 "2025-10-17T05:28:02Z")

</div>

Can you pleas explain about setting higher resolution? you want me to set it to the mesh? how do I do it programmatically?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 17, 2025, 6:58pm UTC](https://discourse.slicer.org/t/3d-view-of-segmentation-node-is-broken-when-loading-from-a-file/44781/4 "2025-10-17T18:58:24Z")

</div>

You can set the segmentation higher resolution labelmap when importing a model as described [here](https://slicer.readthedocs.io/en/latest/user_guide/modules/segmentations.html#import-an-existing-segmentation-from-model-surface-mesh-file). If you confirm that this solves your problems and you cannot figure out how to achieve it using Python scripting then let us know.
