[vtkusers] Volume rendering with ray casting

Madhusudhanan Balasubramanian madhu_lsu at yahoo.com
Wed Jun 30 11:58:32 EDT 2004


Hi all,
 
I've a volume data that I tried to volume render with ray casting(which I constructed from 5, 2D images).  I've a couple of questions at this time:
 
1. When I rotate the volume around, assuming that image slice 1 is visible, I expect the see the structures in other slices; say if I rotate it 180 degrees around I'm expecting to see structures from image slice 5; but I still see only the structures from slice 1.  Am I missing something while rendering?  (I've verified the dimensions of the volume dataset and it is correct).
 
2. Are there segmentation algorithms that are available with vtk that can used on 2D images before being volume rendered?
 
3. With the volume built from 5 image slices, when I rotate the volume around, the thickness of the volume (along z-axis) appears to be got just from a single image.  May be I'm doing something wrong in rendering.
 
Here are few fragments of my code that I used to volume render:
 
CVolRendererView::CVolRendererView()
{
 this->color = vtkPiecewiseFunction::New();
 this->color->AddPoint(0, 0.0);
 this->color->AddPoint(255, 1.0);
 
 this->opacity = vtkPiecewiseFunction::New();
 this->opacity->AddPoint(0, 0.0);
 this->opacity->AddPoint(130, 0.0);
 this->opacity->AddPoint(140, 1.0);
 this->opacity->AddPoint(255, 1.0);
 
 this->gradOpacity = vtkPiecewiseFunction::New();
 this->gradOpacity->AddPoint(0, 0.0);
 this->gradOpacity->AddPoint(3, 0.0);
 this->gradOpacity->AddPoint(6, 1.0);
 this->gradOpacity->AddPoint(255, 1.0);
 
 this->property = vtkVolumeProperty::New();
 this->property->SetColor(this->color);
 this->property->SetScalarOpacity(this->opacity);
 this->property->SetGradientOpacity(this->gradOpacity);
 this->property->ShadeOn();
 this->property->SetInterpolationTypeToLinear();
 
 this->composite = vtkVolumeRayCastCompositeFunction::New();
 this->composite->SetCompositeMethodToInterpolateFirst();
 
 this->mapper = vtkVolumeRayCastMapper::New();
 this->mapper->SetVolumeRayCastFunction(composite);
 
 this->volume = vtkVolume::New();
 this->volume->SetMapper(this->mapper);
 this->volume->SetProperty(this->property);
 
 this->ren = vtkRenderer::New();
 this->ren->AddVolume(volume);
 this->renWin = vtkWin32OpenGLRenderWindow::New();
 
 this->iren = vtkRenderWindowInteractor::New();

 this->imageAppend = vtkImageAppend::New();
 this->imageAppend->SetAppendAxis(2);
 
 this->renWin->AddRenderer(this->ren);
 this->iren->SetRenderWindow(this->renWin);
 this->iren->Start();
}
 
//Updating the volume with new image slices
this->imageAppend->AddInput(this->GetDocument()->reader->GetOutput());
this->imageAppend->UpdateWholeExtent();

//Rendering
this->mapper->SetInput((vtkImageData*)this->imageAppend->GetOutput());
this->ren->ResetCamera();
this->renWin->Render();

I would appreciate your inputs on this.
 
Thanks,
Madhu.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040630/55ef7aa6/attachment.htm>


More information about the vtkusers mailing list