# Volume rendering, VTK 9 and Qt5 - Crop doesn't work correctly in master

**URL:** <https://discourse.slicer.org/t/volume-rendering-vtk-9-and-qt5-crop-doesnt-work-correctly-in-master/2309>\
**Category:** Development\
**Created:** [March 14, 2018, 1:30am UTC](https://discourse.slicer.org/t/volume-rendering-vtk-9-and-qt5-crop-doesnt-work-correctly-in-master/2309 "2018-03-14T01:30:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [March 14, 2018, 1:30am UTC](https://discourse.slicer.org/t/volume-rendering-vtk-9-and-qt5-crop-doesnt-work-correctly-in-master/2309/1 "2018-03-14T01:30:32Z")

</div>

MacOS 10.12.6, AMD Radeon R9 M370X - crop doesn’t work properly - it appears to clip the view rather than cropping the volume. This is master, updated through @jcfr’s DriverScript pull of a couple hours ago.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [March 14, 2018, 3:27am UTC](https://discourse.slicer.org/t/volume-rendering-vtk-9-and-qt5-crop-doesnt-work-correctly-in-master/2309/2 "2018-03-14T03:27:14Z")

</div>

I think that @Sankhesh_Jhaveri is working on fixes related to cropping and volume rendering that should land in VTK master anytime. We will then update the version used in Slicer.

That said, we would need more details to know for sure. Could you give more details about the data, the volume rendering setting and may be include a screenshot ?

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [March 14, 2018, 11:11am UTC](https://discourse.slicer.org/t/volume-rendering-vtk-9-and-qt5-crop-doesnt-work-correctly-in-master/2309/3 "2018-03-14T11:11:34Z")

</div>

Yeah, sorry about that - I’ve been trying to get some representative images. It’s a lot easier to see in motion…

These are from CTACardio using the chest vessels preset. First is 4.8.1:

 ![1](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/a/4ad5cb7d015a1eff2031659abc6e4c85da41a248.jpeg)

You can see at the edges of the ROI, it crops the volume and you see internals.

This is master, built March 13:

 ![0%203-13-2018%20](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/6/5661d4ff58e4432f19ebddc071a70d81ea908c08.jpeg)

If you look carefully, you can see the top of the crop volume at the top of the chest volume. The crop ROI doesn’t crop any volume data - it just seems to clip the view.

I put a quick video in: [Slicer - Google Drive](https://drive.google.com/open?id=1__al9fj6B17e1xDKWW7zvunC3Ks1qOkB)

Hopefully that will give you an idea.

Thanks!

-Hollister

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [March 14, 2018, 12:35pm UTC](https://discourse.slicer.org/t/volume-rendering-vtk-9-and-qt5-crop-doesnt-work-correctly-in-master/2309/4 "2018-03-14T12:35:05Z")

</div>

I also get these on the console:

```
Switch to module: "VolumeRendering"
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints
```

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [March 14, 2018, 1:39pm UTC](https://discourse.slicer.org/t/volume-rendering-vtk-9-and-qt5-crop-doesnt-work-correctly-in-master/2309/5 "2018-03-14T13:39:43Z")

</div>

Hi Hollister! I tried it with the latest version and it seems to be working OK on Windows. I started 4.8.1 to see if there is any difference, and they look the same. Maybe this is an issue only on Mac?

That said the volume rendering cropping is not supposed to crop the actial volume data, only restrict the region volume rendering considers.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [March 14, 2018, 1:54pm UTC](https://discourse.slicer.org/t/volume-rendering-vtk-9-and-qt5-crop-doesnt-work-correctly-in-master/2309/6 "2018-03-14T13:54:03Z")

</div>

And I don’t get any errors either. I’m building a Slicer on Mac now.

---

<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:** [March 14, 2018, 2:08pm UTC](https://discourse.slicer.org/t/volume-rendering-vtk-9-and-qt5-crop-doesnt-work-correctly-in-master/2309/7 "2018-03-14T14:08:06Z")

</div>

@hherhold You seem to have the same issue as everybody else ([https://issues.slicer.org/view.php?id=4510](https://issues.slicer.org/view.php?id=4510)). A fix was promised to be integrated into VTK by tomorrow. From there Slicer should be able to get it quickly.

@cpinter The error only occurs if you enable depth peeling and use GPU volume rendering.

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [March 14, 2018, 2:50pm UTC](https://discourse.slicer.org/t/volume-rendering-vtk-9-and-qt5-crop-doesnt-work-correctly-in-master/2309/8 "2018-03-14T14:50:42Z")

</div>

@lassoan Hey Andras - ! I should have checked Mantis before posting - sorry about that!

Thanks!!!

-Hollister

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [March 14, 2018, 3:10pm UTC](https://discourse.slicer.org/t/volume-rendering-vtk-9-and-qt5-crop-doesnt-work-correctly-in-master/2309/9 "2018-03-14T15:10:00Z")

</div>

It just occurred to me that depth peeling makes rendering slower. As you had issues with performance, and it now turns out that you use depth peeling, maybe you can further improve performance by disabling that feature. Of course if you want to render surfaces inside the rendered volume, then you’ll need it, but otherwise it’s not essential.
