[vtkusers] Could you give me your source code  using user defined data?
    Jung-Su Oh 
    koorye at bmsil.snu.ac.kr
       
    Tue Jan  7 01:44:51 EST 2003
    
    
  
Hi, I'm mailing again. I'm beginner of  VTK.
So I don't know how to do the volume rendering of the data in file or array in C language.
I think that your source contains them. (I saw it in user's digest.)
Could you give me the full volume rendering source code in Cpp with 
my data like those follows?
(The source code of me is not working properly)
Please complete the souce code as that can run.
 vtkRenderer +ACo-ren1 +AD0- vtkRenderer::New()+ADs-
 vtkRenderWindow +ACo-renWin +AD0- vtkRenderWindow::New()+ADs-
  renWin-+AD4-AddRenderer(ren1)+ADs-
 vtkRenderWindowInteractor +ACo-iren +AD0- vtkRenderWindowInteractor::New()+ADs-
  iren-+AD4-SetRenderWindow(renWin)+ADs-
 unsigned char+ACo- data+AD0-new unsigned char+AFs-1000000+AF0AOw-
 int i+ADs-
//Just making user defined data - sphere shape
 for(int x+AD0-0+ADs-x+ADw-100+ADs-x+-+-)+AHs-
  for(int y+AD0-0+ADs-y+ADw-100+ADs-y+-+-)+AHs-
   for(int z+AD0-0+ADs-z+ADw-100+ADs-z+-+-)+AHs-
    i +AD0- x+ACo-10000+-y+ACo-100+-z+ADs-
    if(x+AF4-2+-y+AF4-2+-z+AF4-2+ADw-10000)
     data+AFs-i+AF0APQ-200+ADs-
   +AH0-
  +AH0-
 +AH0-
 vtkImageImport +ACo-img+AD0-vtkImageImport::New()+ADs-
 img-+AD4-SetImportVoidPointer (data)+ADs-
 img-+AD4-SetDataScalarTypeToUnsignedChar ()+ADs-
 img-+AD4-SetWholeExtent (0, 100, 0, 100, 0, 100)+ADs-
 img-+AD4-SetDataExtentToWholeExtent()+ADs-
//
//
//Is there any other setting is needed?
//
//
 
 vtkPiecewiseFunction +ACo-oTFun +AD0- vtkPiecewiseFunction::New()+ADs-
  oTFun-+AD4-AddSegment(80,0.0,255,1.0)+ADs-
 vtkPiecewiseFunction +ACo-gTFun +AD0- vtkPiecewiseFunction::New()+ADs-
  gTFun-+AD4-AddSegment(0,1.0,255,1.0)+ADs-
 vtkVolumeProperty +ACo-volProperty +AD0- vtkVolumeProperty::New()+ADs-
  volProperty-+AD4-SetColor(gTFun)+ADs-
  volProperty-+AD4-SetGradientOpacity(oTFun)+ADs-
  volProperty-+AD4-SetInterpolationTypeToLinear()+ADs-
  volProperty-+AD4-ShadeOn()+ADs-
 vtkVolumeRayCastCompositeFunction +ACo-compositeFunction +AD0- 
  vtkVolumeRayCastCompositeFunction::New()+ADs-
 vtkVolumeRayCastMapper +ACo-volMapper +AD0- 
  vtkVolumeRayCastMapper::New()+ADs- 
 volMapper-+AD4-SetVolumeRayCastFunction(compositeFunction)+ADs-
 volMapper-+AD4-SetInput (img-+AD4-GetOutput())+ADs-
 vtkVolume +ACo-vol +AD0- vtkVolume::New()+ADs-
 vol-+AD4-SetMapper(volMapper)+ADs-
 vol-+AD4-SetProperty(volProperty)+ADs-
 ren1-+AD4-AddVolume(vol)+ADs-
 renWin-+AD4-Render()+ADs-
 ren1-+AD4-GetActiveCamera()-+AD4-Azimuth(20)+ADs-
 renWin-+AD4-Render()+ADs-
 ren1-+AD4-GetActiveCamera()-+AD4-Dolly(1.65)+ADs-
 renWin-+AD4-Render()+ADs-
 iren-+AD4-SetDesiredUpdateRate(3.0)+ADs-
 renWin-+AD4-Render()+ADs-
 iren-+AD4-Start()+ADs-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http:+AC8ALw-www.vtk.org+AC8-pipermail+AC8-vtkusers+AC8-attachments+AC8-20030107+AC8-640089f1+AC8-attachment.htm>
    
    
More information about the vtkusers
mailing list