<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-08-11 11:18 GMT+02:00 Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>Hi all,<br><br></div>I'm wrestling with a volume rendering problem.<br><br></div>I've set up a very basic pipeline that just renders a volume.<br><br></div><div>As source it uses a custom reader I wrote that loads a volume from a HDF5 dataset (float).<br><br>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.<br><br></div><div>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 volume.<br><br></div><div>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_.<br><br></div><div>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?<br><br></div><div>Thanks a lot for any advice!<span class=""><font color="#888888"><br></font></span></div></div></blockquote><div><br></div><div>I can give some snippets from my code which shows how I set up rendering and how I show the histogram:<br><br></div><div>The pipeline is basically just:<br><br>        auto volumeMapper = vtkSmartPointer<vtkGPUVolumeRayCastMapper>::New();<br>        volumeMapper->SetInputData(imageData);<br><br>        auto volumeProperty = vtkSmartPointer<vtkVolumeProperty>::New();<br>        volumeProperty->SetInterpolationTypeToLinear();<br>        volumeProperty->ShadeOff();<br><br>        auto opacity = vtkSmartPointer<vtkPiecewiseFunction>::New();<br>        opacity->AddPoint(0.0, 0.0);<br>        opacity->AddPoint(5.0, 1.0);<br><br>        auto volume = vtkSmartPointer<vtkVolume>::New();<br>        volume->SetMapper(volumeMapper);<br>        volume->SetProperty(volumeProperty);<br>        renderer()->AddVolume(volume);<br><br></div><div>where imageData is the vtkImageData as loaded by my custom reader.<br><br>The camera is configured with:<br><br>        auto camera = renderer()->GetActiveCamera();<br>        camera->SetParallelProjection(true);<br>        camera->SetPosition(3000.0, 0.0, 0.0);<br>        camera->SetFocalPoint(0.0, 0.0, 0.0);<br>        camera->SetViewUp(0, 0, 1);<br><br></div><div>And the histogram plot I use for debugging is set up with:<br><br>    auto imageHistogramStatistics = vtkSmartPointer<vtkImageHistogramStatistics>::New();<br>    imageHistogramStatistics->SetInputData(imageData);<br>    imageHistogramStatistics->Update();<br><br>    qDebug() << "Image Histogram Statistics:";<br>    qDebug() << "  min:" << imageHistogramStatistics->GetMinimum();<br>    qDebug() << "  max:" << imageHistogramStatistics->GetMaximum();<br>    qDebug() << "  mean:" << imageHistogramStatistics->GetMean();<br>    qDebug() << "  dev:" << imageHistogramStatistics->GetStandardDeviation();<br><br>    auto imageAccumulate = vtkSmartPointer<vtkImageAccumulate>::New();<br>    imageAccumulate->SetComponentSpacing(0.01, 0, 0);<br>    imageAccumulate->SetComponentExtent(0, 499, 0, 0, 0, 0);<br>    imageAccumulate->SetInputData(imageData);<br>    imageAccumulate->Update();<br><br>    auto plot = vtkSmartPointer<vtkXYPlotActor>::New();<br>    plot->ExchangeAxesOff();<br>    plot->SetXTitle("");<br>    plot->SetYTitle("");<br>    plot->SetLabelFormat("%g");<br>    plot->SetXValuesToValue();<br>    plot->AddDataSetInputConnection(imageAccumulate->GetOutputPort());<br><br>    renderer()->AddActor(plot);<br><br></div><div>Where imageData is the rendered vtkImageData.<br><br></div><div>Elvis<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><span class=""><font color="#888888"><br></font></span></div><span class=""><font color="#888888"><div>Elvis<br></div></font></span><div><br></div><div>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.<br></div></div>
</blockquote></div><br></div></div>