[vtkusers] Black renderwindow with vtkGPUVolumeRayCastMapper/MaximumIntensityProjection
Sophonet
vtk12af6bc42 at kant.sophonet.de
Sat Feb 3 05:37:12 EST 2018
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);
More information about the vtkusers
mailing list