[vtkusers] about volume rendering

amal / foodofheart_looly at hotmail.com
Mon Jul 7 20:09:10 EDT 2008


hi:
i have a problem while using the volume rendering algorithm.
i need to learn how i can reconstruct only a single object in the image set
(for example my set is for segmented liver so i want only the liver to be appear in 3d but what actualy happen is that the whole image is being accumulated and the result is a box containing the first slice on one side and the last on the other even when i set the pixels that i don't need to transparent)
plz if there is a solution for this i need it clear.
my code is
 
vtkPNGReader pngreader = new vtkPNGReader();
pngreader.SetFilePrefix(standardStr+"\\");
pngreader.SetFilePattern("%s%d.png");
pngreader.SetFileNameSliceOffset(1);
pngreader.SetFileNameSliceSpacing(1);
pngreader.SetDataSpacing(0.35,0.35,1);
pngreader.SetDataOrigin(0,0,0);
pngreader.SetDataExtent(0,511,0,511,3,7);
pngreader.Update();
vtkPiecewiseFunction opacitytransfer = new vtkPiecewiseFunction();



opacitytransfer.AddPoint(0,0.0);
opacitytransfer.AddPoint(150,0.0);

vtkColorTransferFunction colorTransferFunction =new vtkColorTransferFunction();
colorTransferFunction.AddRGBPoint(0.0,0.0,0.0,0.0);
colorTransferFunction.AddRGBPoint(255.0, 1.0, 1.0, 1.0);






 
vtkVolumeProperty volumeproperty = new vtkVolumeProperty();
volumeproperty.SetScalarOpacity(opacitytransfer);
volumeproperty.SetColor(colorTransferFunction);
volumeproperty.ShadeOn();
vtkFixedPointVolumeRayCastMapper volumemapper = new vtkFixedPointVolumeRayCastMapper();



vtkVolumeRayCastCompositeFunction raycastfunction = new vtkVolumeRayCastCompositeFunction();
raycastfunction.SetCompositeMethodToClassifyFirst();

volumemapper.SetInput(pngreader.GetOutput());

vtkVolume volume = new vtkVolume();

volume.SetMapper(volumemapper);
vtkCamera acamera = new vtkCamera();
acamera.SetViewUp(0,0,-1);
acamera.SetPosition(0,1,0);
acamera.SetFocalPoint(0,0,0);
acamera.ComputeViewPlaneNormal();
 
renwin.AddRenderer(render);
iren.SetRenderWindow(renwin);
render.AddActor(volume);
render.SetActiveCamera(acamera);
render.ResetCamera();
acamera.UpdateViewport(render);
render.SetBackground(1,1,1);
render.GetRenderWindow().Render();
 
 
thanks alot.

اللهم قدرني علي من ظلمني.....لأجعل عفوى عنه
شكرا لك علي قدرتي عليه
_________________________________________________________________
Making the world a better place one message at a time.
http://www.imtalkathon.com/?source=EML_WLH_Talkathon_BetterPlace
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080708/7fdc770c/attachment.htm>


More information about the vtkusers mailing list