[Insight-users] problems with rendering using ray casting

Prathamesh Kulkarni prathameshmkulkarni at gmail.com
Wed Sep 21 10:04:53 EDT 2011


I am using Nvidia 6000 Quadro card which supposedly has support for OpenGL.

Prathamesh

On Wed, Sep 21, 2011 at 12:38 AM, alex Dowson <alexdowson at hotmail.com>wrote:

>   Hi
>
> I think you’r graphic card doesnot have this extension supported. Do you
> have any GPU based card ? like ATI Radeon or Nvidia ?
>
> Alex
>
>  *From:* Prathamesh Kulkarni <prathameshmkulkarni at gmail.com>
> *Sent:* Wednesday, September 21, 2011 9:32 AM
> *To:* VTK Mailing List <vtkusers at vtk.org> ; insight-users at itk.org
> *Cc:* Luisi, Jonathan D <jdluisi at central.uh.edu>
> *Subject:* [Insight-users] problems with rendering using ray casting
>
>
> Hello,
>
> I am trying to render a volume (mhd file read as ITKImage<float, 3>) using
> VTK ray casting. I have tried to use the different available mappers, but
> the output is always only background. For the mappers using OpenGL, I get
> the error:  line 100 vtkOpenGLVolumeTextureMapper3D (0000000003270440):
> required extensions not supported. Below is my code. Any help would be very
> useful.
>
>
>          typedef itk::ImageToVTKImageFilter<ImageType3D>
> ITKToVTKConnectorType;
> ITKToVTKConnectorType::Pointer ITK_to_VTK_connector =
> ITKToVTKConnectorType::New();
>
> ITK_to_VTK_connector->SetInput(data_ptr);
> ITK_to_VTK_connector->Update();
>
> vtkSmartPointer<vtkImageData> vtk_image =
> ITK_to_VTK_connector->GetOutput();
>
> // Testing vtk image
> vtk_image->PrintSelf(std::cout, vtkIndent(0));
>
> vtkSmartPointer<vtkRenderer> renderer =
> vtkSmartPointer<vtkRenderer>::New();
> renderer->SetBackground(1.0, 1.0, 1.0);
>          vtkSmartPointer<vtkRenderWindow> render_window =
> vtkSmartPointer<vtkRenderWindow>::New();
> render_window->AddRenderer(renderer);
>  vtkSmartPointer<vtkRenderWindowInteractor> render_window_interactor =
> vtkSmartPointer<vtkRenderWindowInteractor>::New();
> render_window_interactor->SetRenderWindow(render_window);
>  vtkSmartPointer<vtkPiecewiseFunction> opacity_transfer_function =
> vtkSmartPointer<vtkPiecewiseFunction>::New();
> /*opacity_transfer_function->AddPoint(20, 0.0);
> opacity_transfer_function->AddPoint(25, 0.2);
> */
>
> vtkSmartPointer<vtkColorTransferFunction> color_transfer_function =
> vtkSmartPointer<vtkColorTransferFunction>::New();
> /*color_transfer_function->AddRGBPoint(0.0, 0.0, 0.0, 0.0);
> color_transfer_function->AddRGBPoint(64.0, 1.0, 0.0, 0.0);
> color_transfer_function->AddRGBPoint(128.0, 0.0, 0.0, 1.0);
> color_transfer_function->AddRGBPoint(192.0, 0.0, 1.0, 0.0);
> color_transfer_function->AddRGBPoint(255.0, 0.0, 0.2, 0.0);
> */
>
> vtkSmartPointer<vtkVolumeProperty> volume_property =
> vtkSmartPointer<vtkVolumeProperty>::New();
> volume_property->SetColor(color_transfer_function);
> volume_property->SetScalarOpacity(opacity_transfer_function);
> volume_property->ShadeOn();
> volume_property->SetInterpolationTypeToLinear();
> volume_property->SetIndependentComponents(1);
>
> vtkSmartPointer<vtkVolumeRayCastCompositeFunction> composite_function =
> vtkSmartPointer<vtkVolumeRayCastCompositeFunction>::New();
>  //vtkSmartPointer<vtkVolumeRayCastMapper> volume_mapper =
> vtkSmartPointer<vtkVolumeRayCastMapper>::New();
> //vtkSmartPointer<vtkFixedPointVolumeRayCastMapper> volume_mapper =
> vtkSmartPointer<vtkFixedPointVolumeRayCastMapper>::New();
>          vtkSmartPointer<vtkOpenGLVolumeTextureMapper3D> volume_mapper =
> vtkSmartPointer<vtkOpenGLVolumeTextureMapper3D>::New();
> //vtkSmartPointer<vtkGPUVolumeRayCastMapper> volume_mapper =
> vtkSmartPointer<vtkGPUVolumeRayCastMapper>::New();
> //vtkSmartPointer<vtkOpenGLGPUVolumeRayCastMapper> volume_mapper =
> vtkSmartPointer<vtkOpenGLGPUVolumeRayCastMapper>::New();
>
> //volume_mapper->SetVolumeRayCastFunction(composite_function);
> volume_mapper->SetInput(vtk_image);
> volume_mapper->SetBlendModeToComposite();
> //volume_mapper->SetBlendModeToMaximumIntensity();
> //volume_mapper->SetScalarMode(1);
> volume_mapper->SetSampleDistance(0.2);
>
> vtkSmartPointer<vtkVolume> volume = vtkSmartPointer<vtkVolume>::New();
> volume->SetMapper(volume_mapper);
> volume->SetProperty(volume_property);
> volume->Update();
>  render_window->Render();
> renderer->AddVolume(volume);
> renderer->ResetCamera();
>  render_window_interactor->Initialize();
> render_window->Render();
> render_window_interactor->Start();
>
>
> Thanks,
> Prathamesh
>
> ------------------------------
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110921/2a4fa226/attachment.htm>


More information about the Insight-users mailing list