[vtkusers] 3d volume rendering

Shang Mu smu.email at gmail.com
Mon Aug 14 17:55:29 EDT 2006


Did you try to reduce the opacity value?


On 8/13/06, Walid Saad <walid.saad at yahoo.com> wrote:
> I'm just trying to visualise a 3D volume of a 83 dicom series loaded using
> ITK by using VTKvolume but the scene generated is just a 3d cube with the
> series diplayed on top an bottom sides of the cube, how can I view the whole
> series in all the dimensions ?
> ----------------------------------------------
> //configuiring VTk
>     vtkRenderer* renderer = vtkRenderer::New();
>
>     vtkRenderWindow* renWin = vtkRenderWindow::New();
>
>     renWin->AddRenderer(renderer);
>
>     vtkRenderWindowInteractor* iren =
> vtkRenderWindowInteractor::New();
>
>     iren->SetRenderWindow(renWin);
>
>
>
>     // Create transfer mapping scalar value to opacity
>
>     vtkPiecewiseFunction* opacityTransferFunction =
>     vtkPiecewiseFunction::New();
>
>     opacityTransferFunction->AddPoint(20.0, 0.0);
>
>     opacityTransferFunction->AddPoint(255.0, 0.2);
>
>     //Creating volume color
>     vtkColorTransferFunction * colorTransferFunction =
> vtkColorTransferFunction::New();
>     colorTransferFunction->AddRGBPoint(0.0, 0.0, 0.0, 0.0);
>     colorTransferFunction->AddRGBPoint(255.0, 1.0, 1.0,
> 1.0);
>
>     // The property describes how the data will look
>
>     vtkVolumeProperty* volumeProperty = vtkVolumeProperty::New();
>
>
> volumeProperty->SetScalarOpacity(opacityTransferFunction);
>     volumeProperty->SetColor(colorTransferFunction);
>
>
>     // The mapper / ray cast functions know how to render the data
>
>     vtkVolumeRayCastCompositeFunction* compositeFunction =
> vtkVolumeRayCastCompositeFunction::New();
>
>     vtkVolumeRayCastMapper* volumeMapper = vtkVolumeRayCastMapper::New();
>
>
> volumeMapper->SetVolumeRayCastFunction(compositeFunction);
>
>     volumeMapper->SetInput(connector->GetOutput());
>
>     //creating the camera
>     vtkCamera *aCamera = vtkCamera::New();
>     aCamera->SetViewUp (0, 0, -1);
>     aCamera->SetPosition (0, 1, 0);
>     aCamera->SetFocalPoint (0, 0, 0);
>     aCamera->ComputeViewPlaneNormal();
>     renderer->SetActiveCamera(aCamera);
>     aCamera->Dolly(1.5);
>     renderer->ResetCamera();
>     renderer->ResetCameraClippingRange();
>
>     // The volume holds the mapper and the property and can be used to
> position/orient the volume
>
>     vtkVolume* volume = vtkVolume::New();
>
>     volume->SetMapper(volumeMapper);
>
>     volume->SetProperty(volumeProperty);
>
>
>     renderer->AddVolume(volume);
>     renderer->SetBackground(1,1, 1);
>
>     iren->Start();
>
>
>
>
>  ________________________________
> Stay in the know. Pulse on the new Yahoo.com. Check it out.
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the 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