[vtkusers] Black renderwindow with vtkGPUVolumeRayCastMapper/MaximumIntensityProjection

Sankhesh Jhaveri sankhesh.jhaveri at kitware.com
Fri Feb 9 11:57:30 EST 2018


Hi Sophonet,

Try setting the scalar opacity function over the whole range of scalar
values.

Something like:

double * range = data->GetScalarRange();
vtkNew<vtkPiecewiseFunction> f;
f->AddPoint(range[0], 0.1);
f->AddPoint(range[1], 1.0);
property->SetScalarOpacity(f);

Hope that helps,
Sankhesh
​

On Sat, Feb 3, 2018 at 5:37 AM Sophonet <vtk12af6bc42 at kant.sophonet.de>
wrote:

> Hi list,
>
> in an earlier version of my software using VTK7.x and the OpenGL
> backend, MIP rendering was working using vtkGPUVolumeRayCastMapper and
> MaximumIntensityProjection.
>
> However, in VTK 8.x (e.g. VTK 8.1.0), using the OpenGL2 backend, the
> renderwindow stays black/empty - VTK does not show an error message, and
> the IsRenderSupported (see below) does not seem to fail.
>
> Any hints what is wrong with the code below? By the way: I have added
> the volumeProperty (and the piecewise function) after following a
> current VTK test program
> (
> https://github.com/Kitware/VTK/blob/master/Rendering/Volume/Testing/Cxx/TestGPURayCastFourComponentsMIP.cxx
> ).
>
> vtkimagedata is a scalar medical image (unsigned short), so nothing
> special.
>
> Thanks,
>
>           Sophonet
>
>     vtkNew<vtkGPUVolumeRayCastMapper> mapper;
>     mapper->SetInputData(vtkimagedata);
>     mapper->SetBlendModeToMaximumIntensity();
>
>     vtkNew<vtkVolume> volume;
>     volume->SetMapper(mapper);
>     // ... connect to renderer etc.
>
>     //NOTE: The following lines from VTK's
> TestGPURayCastFourComponentsMIP.cxx did not solve the problem
>     //vtkNew<vtkVolumeProperty> volumeProperty;
>     //volumeProperty->IndependentComponentsOn();
>     //volumeProperty->SetInterpolationType(VTK_LINEAR_INTERPOLATION);
>     //volumeProperty->SetShade(1);
>
>     //vtkNew<vtkPiecewiseFunction> f;
>     //f->AddPoint(0, 0.0);
>     //f->AddPoint(255, 1.0);
>     //volumeProperty->SetScalarOpacity(f);
>
>     //int valid =
> mapper->IsRenderSupported(vtkrenderer_->GetRenderWindow(),
> volumeProperty);
>
>     // NOTE: No exception was thrown on my system
>     //if (valid == 0)
>     //  throw std::runtime_error("MIP rendering is not supported");
>     //volume->SetProperty(volumeProperty);
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://vtk.org/mailman/listinfo/vtkusers
>
-- 
Sankhesh Jhaveri *Sr. Research & Development Engineer* | Kitware
<http://www.kitware.com/> | (518) 881-4417
​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180209/46e8073a/attachment.html>


More information about the vtkusers mailing list