[vtkusers] volume rendering help
Wagner Sales
wsales at gmail.com
Fri Feb 5 11:08:24 EST 2010
Hi Pedro,
If you wants a real GPU accelerated mapper, go to www.vtkedge.org and
download VTKEdge. After compiling with examples enabled, you can run
the example GPURenderDemo against your series and see the results. The
code are simple and you can use them to base your own.
Regards,
Wagner Sales
2010/2/5 Pedro Sá <peternomak at hotmail.com>:
> hi there,
>
> i'm having some issues with volume rendering. my goal is to display a 3d
> model of 240 OCT slices with 511x427px. I've managed to create the 3d model
> using the vtkFixedPointVolumeRayCastMapper but the performance is just too
> slow. I read that this could be solved using the vtkVolumeTextureMapper2D
> that, if I understood correctly, would use GPU acceleration. Unfortunately,
> this renders nothing, only a black screen. Since i'm out of ideas I hope
> that someone could help me in this. I'm using the VTK .NET wrapper (hoping
> this is not whats causing the issue).
>
> System config:
> Intel Pentium Dual CPU T3200
> 4GB RAM
> NVIDIA GeForece 9300GS 256 MB
>
> C# Code:
>
> vtkRenderer renderer1 = new vtkRenderer();
> vtkRenderWindow renWin1 = new vtkRenderWindow();
> vtkOpenGLExtensionManager extensions = new
> vtkOpenGLExtensionManager();
> extensions.SetRenderWindow(renWin1);
> extensions.Update();
> extensions.LoadExtension("GL_VERSION_2_0");
> extensions.Dispose();
>
> renWin1.AddRenderer(renderer1);
>
> vtkRenderWindowInteractor iren1 = new
> vtkRenderWindowInteractor();
> iren1.SetRenderWindow(renWin1);
>
> vtkJPEGReader reader = new vtkJPEGReader();
> reader.SetFilePattern("C:\\Teste\\Crop\\%d.jpg");
>
> reader.SetDataExtent(0, 511, 0, 427, 0, 72);
> reader.SetDataSpacing(10.7, 8, 20); // mm
> reader.SetDataOrigin(0, 0, 0);
> //reader.SetNumberOfScalarComponents(1);
> reader.SetDataScalarTypeToUnsignedChar();
> reader.Update();
>
> vtkPiecewiseFunction opacityTransferFunction = new
> vtkPiecewiseFunction();
> opacityTransferFunction.AddPoint(180, 0.0);
> opacityTransferFunction.AddPoint(0, 1);
>
> vtkVolumeProperty volumeProperty = new vtkVolumeProperty();
> volumeProperty.SetScalarOpacity(opacityTransferFunction);
> volumeProperty.SetInterpolationTypeToNearest();
> //volumeProperty.ShadeOn();
>
> vtkVolumeTextureMapper2D textureMapper = new
> vtkVolumeTextureMapper2D();
> textureMapper.SetInputConnection(reader.GetOutputPort());
>
> //vtkFixedPointVolumeRayCastMapper volumeMapper = new
> vtkFixedPointVolumeRayCastMapper();
> //volumeMapper.SetInputConnection(reader.GetOutputPort());
>
> vtkVolume volume = new vtkVolume();
> volume.SetMapper(textureMapper);
> volume.SetProperty(volumeProperty);
> renderer1.AddVolume(volume);
> renderer1.ResetCamera();
>
> renWin1.Render();
>
> iren1.Initialize();
>
> Regards,
>
> Pedro
>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
More information about the vtkusers
mailing list