[vtkusers] Volume Rendering save as vtkData

Yusuf OEZBEK nasil122002 at yahoo.de
Tue Apr 6 21:17:00 EDT 2010


Hello all,


How can I save an image 3D as vtkData (.vtk), that I did with Volume Rendering (vtkFixedPointVolumeRayCastMapper)? With vtkDataSetWriter it does not work. My code is shown below:

Thank you.


levelForVolumeRendering = (int)this->sliderRangeMin->value()-(int)this->sliderRangeMax->value()/2;
widhtForVolumeRendering = (int)this->sliderRangeMin->value()+(int)this->sliderRangeMax->value()/2;

mode3D = vtkInteractorStyleTrackballCamera::New();


renderer3D = vtkRenderer::New();
renderWindow3D = vtkRenderWindow::New();
renderWindow3D->AddRenderer(renderer3D);

displayImage3D->SetRenderWindow(renderWindow3D);
displayImage3D->SetInteractorStyle(mode3D);
displayImage3D->Initialize();

 piecewiseVolumeRendering = vtkPiecewiseFunction::New();
piecewiseVolumeRendering->AddPoint((double)levelForVolumeRendering, 0);
piecewiseVolumeRendering->AddPoint((double)widhtForVolumeRendering, 1.0);

colorVolumeRendering = vtkColorTransferFunction::New();
colorVolumeRendering->AddRGBPoint((double)levelForVolumeRendering, .62, .36, .18 );
colorVolumeRendering->AddRGBPoint((double)widhtForVolumeRendering, .83, .66, 1);

propertyVolumeRendering = vtkVolumeProperty::New();
propertyVolumeRendering->SetShade(0);
propertyVolumeRendering->SetAmbient(0.3);
propertyVolumeRendering->SetDiffuse(1.0);
propertyVolumeRendering->SetSpecular(0.2);
propertyVolumeRendering->SetSpecularPower(50.0);
propertyVolumeRendering->SetColor(colorVolumeRendering);
propertyVolumeRendering->SetScalarOpacity(piecewiseVolumeRendering);
propertyVolumeRendering->ShadeOn();
propertyVolumeRendering->SetInterpolationTypeToLinear();

volumeRayCastMapper = vtkFixedPointVolumeRayCastMapper::New();
volumeRayCastMapper->SetInputConnection(reader2D->GetOutputPort());

volumeVolumeRendering = vtkVolume::New();
 volumeVolumeRendering->SetProperty(propertyVolumeRendering);
volumeVolumeRendering->SetMapper(volumeRayCastMapper);

camera3D = vtkCamera::New();
camera3D->SetViewUp(0, 0, -1);
camera3D->SetPosition(0, 1, 0);
camera3D->SetFocalPoint(0, 0, 0);
camera3D->ComputeViewPlaneNormal();
camera3D->Azimuth(20);

renderer3D->AddViewProp(volumeVolumeRendering);
renderer3D->SetActiveCamera(camera3D);
renderer3D->ResetCamera();
camera3D->Dolly(1.3);
renderer3D->ResetCameraClippingRange();

__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100407/12f4fe2b/attachment.htm>


More information about the vtkusers mailing list