# Color display error on 3D Volume

**URL:** <https://discourse.slicer.org/t/color-display-error-on-3d-volume/46390>\
**Category:** Support\
**Tags:** python\
**Created:** [March 6, 2026, 10:15am UTC](https://discourse.slicer.org/t/color-display-error-on-3d-volume/46390 "2026-03-06T10:15:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karuruychi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/karuruychi/32/81758_2.png) [@Karuruychi](https://discourse.slicer.org/u/Karuruychi)\
**Post date:** [March 6, 2026, 10:15am UTC](https://discourse.slicer.org/t/color-display-error-on-3d-volume/46390/1 "2026-03-06T10:15:56Z")

</div>

Hello everyone

I’m developing an application based on Trame-Slicer, specifically a 3D ROI Cropping feature. Trame-Slicer already supports displaying the ROI box, but when I enable it, my 3D block displays incorrect colors. I’m not sure why; it might be due to a mistake or something missing in my setup code. Please give me your opinion.  
Here is my setup code:  
```

```python
def cropVolume(self) -> None:
        if not self.volume_node:
            logging.warning("[Volume] No volume node found for cropping")
            return

        # 1. Get Display node
        display_node = self.slicer_app.volume_rendering.get_vr_display_node(self.volume_node)
        if not display_node:
            logging.warning("[Volume] No VR display node found")
            return

        # 2. Get ROI node and toggle logic
        is_enabled = not display_node.GetCroppingEnabled()
        roi_node = self.slicer_app.volume_rendering.get_cropping_roi_node(self.volume_node)

        self.slicer_app.volume_rendering.set_cropping_enabled(
            self.volume_node, 
            roi_node, 
            is_enabled
        )

        self.slicer_app.volume_rendering.set_cropping_roi_node_visibile(self.volume_node, is_enabled)

        # 3. Update
        self.view3D.render()
        if self.controller:
            self.controller.volume_update()

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/2/52a6fb1ef7ab967fa583d5257b37efcfa8435a2d.jpeg)

---

<div class="post-metadata">

**Author:** ![drnoorfatima](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/drnoorfatima/32/81980_2.png) [@drnoorfatima](https://discourse.slicer.org/u/drnoorfatima)\
**Post date:** [March 6, 2026, 10:25am UTC](https://discourse.slicer.org/t/color-display-error-on-3d-volume/46390/2 "2026-03-06T10:25:34Z")

</div>

**The corrupted colors are a transfer function reset issue.** When cropping is toggled, Trame-Slicer internally touches the display node and wipes your color/opacity mapping.

Quick thing to check first: are you saving the `VolumePropertyNode` before calling `set_cropping_enabled`? If not, that is almost certainly your problem. The fix involves reapplying it after the toggle fires.

The full solution also depends on your Trame-Slicer version and how your volume rendering pipeline is initialized, because there are a couple of different ways this can break depending on the setup.  
Rather than write a wall of code here that may or may not match your setup, feel free to DM me. I can take a quick look at your full pipeline and point you to the exact fix. Should not take long.

---

<div class="post-metadata">

**Author:** ![Karuruychi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/karuruychi/32/81758_2.png) [@Karuruychi](https://discourse.slicer.org/u/Karuruychi)\
**Post date:** [March 9, 2026, 3:35am UTC](https://discourse.slicer.org/t/color-display-error-on-3d-volume/46390/3 "2026-03-09T03:35:56Z")

</div>

After a few days, I tried switching to a different computer and coincidentally the volume cropping box was rendered correctly. So could it be a hardware issue?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/3/936c668f05f3f4c736930f6e6c4cf3d86c27a59b.jpeg)
