[vtkusers] Volume rendering problem
elvis.stansvik at orexplore.com
Thu Aug 11 05:24:33 EDT 2016
2016-08-11 11:18 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
> Hi all,
> I'm wrestling with a volume rendering problem.
> I've set up a very basic pipeline that just renders a volume.
> As source it uses a custom reader I wrote that loads a volume from a HDF5
> dataset (float).
> It seemed to be working fine with the volume I had been testing with (see
> attached works_fine.png), which was a 120x120x2000. In addition to the the
> rendering itself, the screenshot shows a histogram plot I was using for
> debugging, as well as some editor controls I use to modify the
> color/opacity transfer function.
> I then tested with another volume which is larger (300x300x5000), but
> apart from that has pretty much the same characteristic for its scalar
> values as the first one, and all of a sudden I don't see anything. See the
> attached not_working.png, which shows the setup using the problematic
> As you can in the histogram, there's a lot of voxel values roughly around
> 1, much like in the first volume, so I would expect that with the same
> transfer functions (black color, and an opacity ramp from 0.0,0.0 up to
> 5.0,1.0), I should see _something_.
> I'm pretty sure I'm missing something basic here, but does anyone have an
> idea why I get the expected rendering with my smaller volume, but not with
> the bigger one?
> Thanks a lot for any advice!
I can give some snippets from my code which shows how I set up rendering
and how I show the histogram:
The pipeline is basically just:
auto volumeMapper =
auto volumeProperty = vtkSmartPointer<vtkVolumeProperty>::New();
auto opacity = vtkSmartPointer<vtkPiecewiseFunction>::New();
auto volume = vtkSmartPointer<vtkVolume>::New();
where imageData is the vtkImageData as loaded by my custom reader.
The camera is configured with:
auto camera = renderer()->GetActiveCamera();
camera->SetPosition(3000.0, 0.0, 0.0);
camera->SetFocalPoint(0.0, 0.0, 0.0);
camera->SetViewUp(0, 0, 1);
And the histogram plot I use for debugging is set up with:
auto imageHistogramStatistics =
qDebug() << "Image Histogram Statistics:";
qDebug() << " min:" << imageHistogramStatistics->GetMinimum();
qDebug() << " max:" << imageHistogramStatistics->GetMaximum();
qDebug() << " mean:" << imageHistogramStatistics->GetMean();
qDebug() << " dev:" <<
auto imageAccumulate = vtkSmartPointer<vtkImageAccumulate>::New();
imageAccumulate->SetComponentSpacing(0.01, 0, 0);
imageAccumulate->SetComponentExtent(0, 499, 0, 0, 0, 0);
auto plot = vtkSmartPointer<vtkXYPlotActor>::New();
Where imageData is the rendered vtkImageData.
> PS. If you're confused by the range of the vtkAxisActor that you see in
> the screenshots, when comparing to the the volume sizes I stated above,
> it's because my custom render currently hardcodes the spacing to 0.2. DS.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers