Color display error on 3D Volume

Karuruychi
Fri, 06 Mar 2026 10:15:56 +0000
Support

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:
```

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()

3 posts - 2 participants