[vtkusers] 3d volume rendering

Walid Saad walid.saad at yahoo.com
Sun Aug 13 18:54:20 EDT 2006


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


More information about the vtkusers mailing list