<div dir="ltr"><br><div>Hello, </div><div><br></div><div>I am trying to render a volume (mhd file read as ITKImage&lt;float, 3&gt;) 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.</div>
<div><br></div><div><br></div><div><div>        typedef itk::ImageToVTKImageFilter&lt;ImageType3D&gt; ITKToVTKConnectorType;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>ITKToVTKConnectorType::Pointer ITK_to_VTK_connector = ITKToVTKConnectorType::New();</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>ITK_to_VTK_connector-&gt;SetInput(data_ptr);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>ITK_to_VTK_connector-&gt;Update();</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkImageData&gt; vtk_image = ITK_to_VTK_connector-&gt;GetOutput();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>// Testing vtk image</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>vtk_image-&gt;PrintSelf(std::cout, vtkIndent(0));</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkRenderer&gt; renderer = vtkSmartPointer&lt;vtkRenderer&gt;::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>renderer-&gt;SetBackground(1.0, 1.0, 1.0);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div>        vtkSmartPointer&lt;vtkRenderWindow&gt; render_window = vtkSmartPointer&lt;vtkRenderWindow&gt;::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>render_window-&gt;AddRenderer(renderer);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkRenderWindowInteractor&gt; render_window_interactor = vtkSmartPointer&lt;vtkRenderWindowInteractor&gt;::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>render_window_interactor-&gt;SetRenderWindow(render_window);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkPiecewiseFunction&gt; opacity_transfer_function = vtkSmartPointer&lt;vtkPiecewiseFunction&gt;::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>/*opacity_transfer_function-&gt;AddPoint(20, 0.0);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>opacity_transfer_function-&gt;AddPoint(25, 0.2);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>*/</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkColorTransferFunction&gt; color_transfer_function = vtkSmartPointer&lt;vtkColorTransferFunction&gt;::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>/*color_transfer_function-&gt;AddRGBPoint(0.0, 0.0, 0.0, 0.0);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>color_transfer_function-&gt;AddRGBPoint(64.0, 1.0, 0.0, 0.0);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>color_transfer_function-&gt;AddRGBPoint(128.0, 0.0, 0.0, 1.0);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>color_transfer_function-&gt;AddRGBPoint(192.0, 0.0, 1.0, 0.0);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>color_transfer_function-&gt;AddRGBPoint(255.0, 0.0, 0.2, 0.0);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>*/</div><div><br></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkVolumeProperty&gt; volume_property = vtkSmartPointer&lt;vtkVolumeProperty&gt;::New();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>volume_property-&gt;SetColor(color_transfer_function);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>volume_property-&gt;SetScalarOpacity(opacity_transfer_function);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>volume_property-&gt;ShadeOn();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>volume_property-&gt;SetInterpolationTypeToLinear();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>volume_property-&gt;SetIndependentComponents(1);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkVolumeRayCastCompositeFunction&gt; composite_function = vtkSmartPointer&lt;vtkVolumeRayCastCompositeFunction&gt;::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//vtkSmartPointer&lt;vtkVolumeRayCastMapper&gt; volume_mapper = vtkSmartPointer&lt;vtkVolumeRayCastMapper&gt;::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>//vtkSmartPointer&lt;vtkFixedPointVolumeRayCastMapper&gt; volume_mapper = vtkSmartPointer&lt;vtkFixedPointVolumeRayCastMapper&gt;::New();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div>        vtkSmartPointer&lt;vtkOpenGLVolumeTextureMapper3D&gt; volume_mapper = vtkSmartPointer&lt;vtkOpenGLVolumeTextureMapper3D&gt;::New();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//vtkSmartPointer&lt;vtkGPUVolumeRayCastMapper&gt; volume_mapper = vtkSmartPointer&lt;vtkGPUVolumeRayCastMapper&gt;::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>//vtkSmartPointer&lt;vtkOpenGLGPUVolumeRayCastMapper&gt; volume_mapper = vtkSmartPointer&lt;vtkOpenGLGPUVolumeRayCastMapper&gt;::New();</div><div><br></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>//volume_mapper-&gt;SetVolumeRayCastFunction(composite_function);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>volume_mapper-&gt;SetInput(vtk_image);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>volume_mapper-&gt;SetBlendModeToComposite();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//volume_mapper-&gt;SetBlendModeToMaximumIntensity();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>//volume_mapper-&gt;SetScalarMode(1);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>volume_mapper-&gt;SetSampleDistance(0.2);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkSmartPointer&lt;vtkVolume&gt; volume = vtkSmartPointer&lt;vtkVolume&gt;::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>volume-&gt;SetMapper(volume_mapper);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>volume-&gt;SetProperty(volume_property);</div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span>volume-&gt;Update();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>render_window-&gt;Render();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>renderer-&gt;AddVolume(volume);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>renderer-&gt;ResetCamera();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>render_window_interactor-&gt;Initialize();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>render_window-&gt;Render();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>render_window_interactor-&gt;Start();</div>
</div><div><br></div><div><br></div><div>Thanks,</div><div>Prathamesh</div></div>