[vtkusers] volume rendering help

Pedro Sá peternomak at hotmail.com
Fri Feb 5 10:16:41 EST 2010


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 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100205/585be17a/attachment.htm>


More information about the vtkusers mailing list