<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>Hi</DIV>
<DIV> </DIV>
<DIV>I think you’r graphic card doesnot have this extension supported. Do you
have any GPU based card ? like ATI Radeon or Nvidia ?<BR></DIV>
<DIV> </DIV>
<DIV>Alex</DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A
title=prathameshmkulkarni@gmail.com
href="mailto:prathameshmkulkarni@gmail.com">Prathamesh Kulkarni</A> </DIV>
<DIV><B>Sent:</B> Wednesday, September 21, 2011 9:32 AM</DIV>
<DIV><B>To:</B> <A title=vtkusers@vtk.org href="mailto:vtkusers@vtk.org">VTK
Mailing List</A> ; <A title=insight-users@itk.org
href="mailto:insight-users@itk.org">insight-users@itk.org</A> </DIV>
<DIV><B>Cc:</B> <A title=jdluisi@central.uh.edu
href="mailto:jdluisi@central.uh.edu">Luisi, Jonathan D</A> </DIV>
<DIV><B>Subject:</B> [Insight-users] problems with rendering using ray
casting</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV dir=ltr>
<DIV> </DIV>
<DIV>Hello, </DIV>
<DIV> </DIV>
<DIV>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.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>
<DIV> typedef
itk::ImageToVTKImageFilter<ImageType3D> ITKToVTKConnectorType;</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>ITKToVTKConnectorType::Pointer ITK_to_VTK_connector
= ITKToVTKConnectorType::New();</DIV>
<DIV> </DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>ITK_to_VTK_connector->SetInput(data_ptr);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>ITK_to_VTK_connector->Update();</DIV>
<DIV> </DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>vtkSmartPointer<vtkImageData> vtk_image =
ITK_to_VTK_connector->GetOutput();</DIV>
<DIV> </DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>// Testing vtk
image</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>vtk_image->PrintSelf(std::cout,
vtkIndent(0));</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN> </DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>renderer->SetBackground(1.0, 1.0, 1.0);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN></DIV>
<DIV>
vtkSmartPointer<vtkRenderWindow> render_window =
vtkSmartPointer<vtkRenderWindow>::New();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>render_window->AddRenderer(renderer);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN></DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>vtkSmartPointer<vtkRenderWindowInteractor>
render_window_interactor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>render_window_interactor->SetRenderWindow(render_window);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN></DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>vtkSmartPointer<vtkPiecewiseFunction>
opacity_transfer_function =
vtkSmartPointer<vtkPiecewiseFunction>::New();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>/*opacity_transfer_function->AddPoint(20,
0.0);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>opacity_transfer_function->AddPoint(25,
0.2);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>*/</DIV>
<DIV> </DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>vtkSmartPointer<vtkColorTransferFunction>
color_transfer_function =
vtkSmartPointer<vtkColorTransferFunction>::New();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>/*color_transfer_function->AddRGBPoint(0.0, 0.0,
0.0, 0.0);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>color_transfer_function->AddRGBPoint(64.0, 1.0,
0.0, 0.0);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>color_transfer_function->AddRGBPoint(128.0, 0.0,
0.0, 1.0);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>color_transfer_function->AddRGBPoint(192.0, 0.0,
1.0, 0.0);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>color_transfer_function->AddRGBPoint(255.0, 0.0,
0.2, 0.0);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>*/</DIV>
<DIV> </DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>vtkSmartPointer<vtkVolumeProperty>
volume_property = vtkSmartPointer<vtkVolumeProperty>::New();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>volume_property->SetColor(color_transfer_function);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>volume_property->SetScalarOpacity(opacity_transfer_function);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>volume_property->ShadeOn();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>volume_property->SetInterpolationTypeToLinear();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>volume_property->SetIndependentComponents(1);</DIV>
<DIV> </DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>vtkSmartPointer<vtkVolumeRayCastCompositeFunction>
composite_function =
vtkSmartPointer<vtkVolumeRayCastCompositeFunction>::New();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN></DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>//vtkSmartPointer<vtkVolumeRayCastMapper>
volume_mapper = vtkSmartPointer<vtkVolumeRayCastMapper>::New();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>//vtkSmartPointer<vtkFixedPointVolumeRayCastMapper>
volume_mapper =
vtkSmartPointer<vtkFixedPointVolumeRayCastMapper>::New();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN></DIV>
<DIV>
vtkSmartPointer<vtkOpenGLVolumeTextureMapper3D> volume_mapper =
vtkSmartPointer<vtkOpenGLVolumeTextureMapper3D>::New();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>//vtkSmartPointer<vtkGPUVolumeRayCastMapper>
volume_mapper = vtkSmartPointer<vtkGPUVolumeRayCastMapper>::New();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>//vtkSmartPointer<vtkOpenGLGPUVolumeRayCastMapper>
volume_mapper =
vtkSmartPointer<vtkOpenGLGPUVolumeRayCastMapper>::New();</DIV>
<DIV> </DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>//volume_mapper->SetVolumeRayCastFunction(composite_function);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>volume_mapper->SetInput(vtk_image);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>volume_mapper->SetBlendModeToComposite();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>//volume_mapper->SetBlendModeToMaximumIntensity();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>//volume_mapper->SetScalarMode(1);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>volume_mapper->SetSampleDistance(0.2);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>vtkSmartPointer<vtkVolume> volume =
vtkSmartPointer<vtkVolume>::New();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>volume->SetMapper(volume_mapper);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>volume->SetProperty(volume_property);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>volume->Update();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN></DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>render_window->Render();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>renderer->AddVolume(volume);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>renderer->ResetCamera();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN></DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>render_window_interactor->Initialize();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>render_window->Render();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>render_window_interactor->Start();</DIV></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV>Prathamesh</DIV></DIV>
<P>
<HR>
_____________________________________<BR>Powered by www.kitware.com<BR><BR>Visit
other Kitware open-source projects
at<BR>http://www.kitware.com/opensource/opensource.html<BR><BR>Kitware offers
ITK Training Courses, for more information
visit:<BR>http://www.kitware.com/products/protraining.html<BR><BR>Please keep
messages on-topic and check the ITK FAQ
at:<BR>http://www.itk.org/Wiki/ITK_FAQ<BR><BR>Follow this link to
subscribe/unsubscribe:<BR>http://www.itk.org/mailman/listinfo/insight-users<BR></DIV></DIV></DIV></BODY></HTML>