<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 5.00.3315.2870" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=226312809-11122002>hi;</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=226312809-11122002>I use 
composite method in volume rendering .</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=226312809-11122002>for 
images with 400 slice </SPAN></FONT><FONT color=#0000ff face=Arial size=2><SPAN 
class=226312809-11122002>that is very slow so&nbsp; I had to use "Volumepro100 
board" for speeding up the process.&nbsp;</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=226312809-11122002>ta 
farshid</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<P><B><I><FONT color=#800080 
face="Monotype Corsiva">*******************************</FONT></I></B> 
<BR><B><I><FONT color=#800080 face="Monotype Corsiva">Farshid&nbsp; 
Dehmeshki</FONT></I></B><I></I> <BR><FONT face=Arial size=2>Software 
Engineer<BR>Medicsight Plc<BR>46 Berkeley Square<BR>London<BR>W1J 5AT<BR>Tel : 
020 7598 4074<BR>Fax: 020 7598 4071<BR>Email : 
farshid.dehmeshki@medicsight.com<BR>Web Site : www.medicsight.com</FONT> 
<BR><B><I><FONT color=#800080 
face="Monotype Corsiva">*******************************</FONT></I></B> <BR><FONT 
face=Arial>&nbsp;</FONT> <BR><FONT face=Arial size=1>The contents of this e-mail 
are intended for the named addressee only. It contains information which may be 
confidential and which may also be privileged. Unless you are the named 
addressee (or authorised to receive for the addressee) you may not copy or use 
it, or disclose it to anyone<BR>else. If you received it in error please notify 
us immediately and then destroy it. Further, we make every effort to keep our 
network free from viruses. However, you do need to verify that this email and 
any attachments are free of viruses as we can take no responsibility for any 
computer virus which might be transferred by way of this e-mail.</FONT></P>
<BLOCKQUOTE>
  <DIV align=left class=OutlookMessageHeader dir=ltr><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> cspl 
  [mailto:affable@hd2.dot.net.in]<BR><B>Sent:</B> Wednesday, December 11, 2002 
  6:00 AM<BR><B>To:</B> vtkusers@public.kitware.com<BR><B>Subject:</B> 
  [vtkusers] On volume rendering<BR><BR></DIV></FONT>
  <DIV><FONT face=Arial size=2>Dear&nbsp; Friends,</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>I am working on volume rendering.I am using 
  composite technique.It is working fine.But I want make it fast.<BR>It is too 
  slow&nbsp; when I rendered large volume(around 120 slices).I have written code 
  as follows.Please give me suggestion.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>void Composite(LPSTR FileName,HWND 
  m_hWnd)<BR>{</FONT></DIV>
  <DIV>&nbsp;</DIV><FONT face=Arial size=2>
  <DIV><BR>&nbsp;DICOMReader DCMReader;<BR>&nbsp;DCMReader.StaticVarInit(); 
  <BR>&nbsp;///Read the Dicom file<BR>&nbsp;BOOL 
  flag=DCMReader.ReadDicomImage(FileName); <BR>&nbsp;//samples per 
  pixel<BR>&nbsp;const char 
  *samples=DCMReader.GetDicomInfo(cs_samples_pixel);</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;float VoxelDepth = 1;<BR>&nbsp;double VoxelWidth = 1,VoxelHeight = 
  1;<BR>&nbsp;//dataspacing in x,y direction <BR>&nbsp;char *Spacing = 
  DCMReader.GetDicomInfo(cs_pixel_spacing);<BR>&nbsp;//dataspacing in z 
  direction<BR>&nbsp;char *ChrVDepth = 
  DCMReader.GetDicomInfo(cs_slice_thickness);<BR>&nbsp;<BR>&nbsp;if(strcmp(ChrVDepth," 
  ") != 0)<BR>&nbsp;&nbsp;VoxelDepth = atof(ChrVDepth);</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;if(strcmp(Spacing," ") != 
  0)<BR>&nbsp;&nbsp;GetVoxelSpacing(Spacing,VoxelWidth,VoxelHeight);<BR>&nbsp;<BR>&nbsp;///get 
  image data pointer<BR>&nbsp;unsigned char* Buffer = (unsigned char *) 
  DCMReader.GetAllImageData();&nbsp; <BR>&nbsp;int 
  spp=atoi(samples);<BR>&nbsp;///calculating the volume size<BR>&nbsp;long 
  ImageSz = DCMReader.width&nbsp; * DCMReader.height 
  *DCMReader.Slices;<BR>&nbsp;long in_max,in_min;<BR>&nbsp;<BR>&nbsp;renderer1 
  =vtkRenderer::New();<BR>&nbsp;renWin1=vtkRenderWindow::New();<BR>&nbsp;<BR>&nbsp;// 
  Vtk Class to import the Buffer for furthur operations on 
  volume.<BR>&nbsp;<BR>&nbsp;vtkImageImport *Importer = 
  vtkImageImport::New();<BR>&nbsp;<BR>&nbsp;Importer-&gt;SetDataExtent(0, 
  DCMReader.width - 1, 0, DCMReader.height- 1, 0, DCMReader.Slices - 
  1);<BR>&nbsp;Importer-&gt;SetWholeExtent(0, DCMReader.width - 1, 0, 
  DCMReader.height- 1, 0, DCMReader.Slices - 
  1);<BR>&nbsp;Importer-&gt;SetDataSpacing((float)VoxelWidth,(float)VoxelHeight,(float)VoxelDepth);<BR>&nbsp;Importer-&gt;SetNumberOfScalarComponents(spp);<BR>&nbsp;// 
  Set the Appropriate Data Type to the Importer 
  Object<BR>&nbsp;if(DCMReader.DataType==DCMUShort) 
  <BR>&nbsp;{<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;//Find the max,min values of Input 
  Images<BR>&nbsp;&nbsp;FindMinMax((unsigned 
  short*)Buffer,ImageSz,&amp;in_max,&amp;in_min);<BR>&nbsp;&nbsp;Importer-&gt;SetDataScalarTypeToUnsignedShort();<BR>&nbsp;&nbsp;<BR>&nbsp;}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;if(DCMReader.DataType==DCMShort) 
  <BR>&nbsp;{<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;//Find the max,min values of Input 
  Images<BR>&nbsp;&nbsp;FindMinMax((short 
  *)Buffer,ImageSz,&amp;in_max,&amp;in_min);<BR>&nbsp;&nbsp;Importer-&gt;SetDataScalarTypeToUnsignedShort();<BR>&nbsp;}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;if(DCMReader.DataType==DCMUChar) <BR>&nbsp;{<BR>&nbsp;&nbsp;//Find 
  the max,min values of Input Images<BR>&nbsp;&nbsp;FindMinMax((unsigned char 
  *)Buffer,ImageSz,&amp;in_max,&amp;in_min);<BR>&nbsp;&nbsp;Importer-&gt;SetDataScalarTypeToUnsignedChar();<BR>&nbsp;}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;if(DCMReader.DataType==DCMChar) <BR>&nbsp;{<BR>&nbsp;&nbsp;//Find 
  the max,min values of Input Images <BR>&nbsp;&nbsp;FindMinMax((char 
  *)Buffer,ImageSz,&amp;in_max,&amp;in_min);<BR>&nbsp;&nbsp;Importer-&gt;SetDataScalarTypeToUnsignedChar();<BR>&nbsp;}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><BR>&nbsp;Importer-&gt;SetImportVoidPointer(Buffer);&nbsp;&nbsp; // 
  Importing the Buffer<BR>&nbsp;<BR>&nbsp;//to get first image display once 
  again flip the image<BR>&nbsp;vtkImageFlip 
  *upsidedownflip=vtkImageFlip::New();<BR>&nbsp;upsidedownflip-&gt;SetInput(Importer-&gt;GetOutput());<BR>&nbsp;upsidedownflip-&gt;SetFilteredAxes(2);</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;vtkImageFlip 
  *fronttobackflip=vtkImageFlip::New();<BR>&nbsp;fronttobackflip-&gt;SetInput(upsidedownflip-&gt;GetOutput());<BR>&nbsp;fronttobackflip-&gt;SetFilteredAxes(1);</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;//Create a transfer function mapping scalar value to 
  opacity<BR>&nbsp;&nbsp;&nbsp; vtkPiecewiseFunction *oTFun = 
  vtkPiecewiseFunction::New();<BR>&nbsp; oTFun-&gt;AddSegment(0, 0.0, in_max, 
  1.0);<BR>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp; //Create a transfer function mapping scalar value to color 
  (grey)<BR>&nbsp;&nbsp;&nbsp; vtkPiecewiseFunction *cTFun = 
  vtkPiecewiseFunction::New();<BR>&nbsp;cTFun-&gt;AddSegment(0, 0.5, in_max, 
  1.0);<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp; // Create a property 
  for the volume and set the transfer functions.<BR>&nbsp;&nbsp; // Turn shading 
  on and use trilinear interpolation<BR>&nbsp;vtkVolumeProperty *volumeProperty 
  = 
  vtkVolumeProperty::New();<BR>&nbsp;volumeProperty-&gt;SetScalarOpacity(oTFun);<BR>&nbsp;volumeProperty-&gt;SetAmbient(0.10);<BR>&nbsp;volumeProperty-&gt;SetDiffuse(0.40);<BR>&nbsp;volumeProperty-&gt;SetSpecular(0.50);<BR>&nbsp;volumeProperty-&gt;SetSpecularPower(100);<BR>&nbsp;volumeProperty-&gt;SetInterpolationTypeToLinear();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  volumeProperty-&gt;ShadeOn();</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><BR>&nbsp;vtkVolumeRayCastMapper 
  *volumeMapper=vtkVolumeRayCastMapper::New();&nbsp;<BR>&nbsp;vtkVolumeRayCastCompositeFunction 
  *Composite=vtkVolumeRayCastCompositeFunction::New(); 
  <BR>&nbsp;Composite-&gt;SetCompositeMethodToClassifyFirst();<BR>&nbsp;volumeMapper-&gt;SetInput(fronttobackflip-&gt;GetOutput());<BR>&nbsp;volumeMapper-&gt;SetVolumeRayCastFunction(Composite);///for 
  Composite Technique</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;vtkLODProp3D 
  *lod=vtkLODProp3D::New();<BR>&nbsp;lod-&gt;AddLOD(volumeMapper,volumeProperty,0.0);<BR>&nbsp;lod-&gt;SetPosition(0,1,2);<BR>&nbsp;lod-&gt;SetScale(3,3,3);<BR>&nbsp;renderer1-&gt;AddProp(lod);</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;renWin1-&gt;AddRenderer(renderer1);<BR>&nbsp;///Client window 
  handle to vtk Render 
  window<BR>&nbsp;renWin1-&gt;SetParentId(m_hWnd);<BR>&nbsp;renderer1-&gt;GetActiveCamera()-&gt;Azimuth(20.0);<BR>&nbsp;renderer1-&gt;GetActiveCamera()-&gt;Dolly(1.60);<BR>&nbsp;renderer1-&gt;ResetCameraClippingRange();<BR>&nbsp;<BR>&nbsp;renWin1-&gt;SetSize(DCMReader.width-10,DCMReader.height-10); 
  <BR>&nbsp;float 
  rate=renWin1-&gt;GetDesiredUpdateRate();<BR>&nbsp;renWin1-&gt;SetDesiredUpdateRate(2.0);<BR>&nbsp;renWin1-&gt;Render();&nbsp; 
  <BR>&nbsp;<BR>&nbsp;iren1 =vtkRenderWindowInteractor::New();<BR>&nbsp; // 
  Interact with the data at 2 frames per 
  second<BR>&nbsp;iren1-&gt;SetRenderWindow(renWin1);<BR>&nbsp;iren1-&gt;SetDesiredUpdateRate(2.0);<BR>&nbsp;iren1-&gt;SetStillUpdateRate(0.001);<BR>&nbsp;iren1-&gt;Initialize();<BR>&nbsp;//clean 
  the vtk 
  objects<BR>&nbsp;Importer-&gt;Delete();<BR>&nbsp;fronttobackflip-&gt;Delete();<BR>&nbsp;upsidedownflip-&gt;Delete();<BR>&nbsp;Composite-&gt;Delete();<BR>&nbsp;oTFun-&gt;Delete();<BR>&nbsp;cTFun-&gt;Delete();<BR>&nbsp;volumeProperty-&gt;Delete();<BR>&nbsp;volumeMapper-&gt;Delete();<BR>&nbsp;volume1-&gt;Delete();<BR>}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>thanking you,</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Regards,<BR>Ramakrishna</FONT></DIV><BR>_____________________________________________________________________<BR>This 
  e-mail has been scanned for viruses by the WorldCom Internet Managed Scanning 
  Service - powered by MessageLabs. For further information visit 
  http://www.worldcom.com<BR></BLOCKQUOTE></BODY></HTML>