<!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 I had to use "Volumepro100
board" for speeding up the process. </SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=226312809-11122002>ta
farshid</SPAN></FONT></DIV>
<DIV> </DIV>
<P><B><I><FONT color=#800080
face="Monotype Corsiva">*******************************</FONT></I></B>
<BR><B><I><FONT color=#800080 face="Monotype Corsiva">Farshid
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> </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 Friends,</FONT></DIV>
<DIV> </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 when I rendered large volume(around 120 slices).I have written code
as follows.Please give me suggestion.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>void Composite(LPSTR FileName,HWND
m_hWnd)<BR>{</FONT></DIV>
<DIV> </DIV><FONT face=Arial size=2>
<DIV><BR> DICOMReader DCMReader;<BR> DCMReader.StaticVarInit();
<BR> ///Read the Dicom file<BR> BOOL
flag=DCMReader.ReadDicomImage(FileName); <BR> //samples per
pixel<BR> const char
*samples=DCMReader.GetDicomInfo(cs_samples_pixel);</DIV>
<DIV> </DIV>
<DIV> float VoxelDepth = 1;<BR> double VoxelWidth = 1,VoxelHeight =
1;<BR> //dataspacing in x,y direction <BR> char *Spacing =
DCMReader.GetDicomInfo(cs_pixel_spacing);<BR> //dataspacing in z
direction<BR> char *ChrVDepth =
DCMReader.GetDicomInfo(cs_slice_thickness);<BR> <BR> if(strcmp(ChrVDepth,"
") != 0)<BR> VoxelDepth = atof(ChrVDepth);</DIV>
<DIV> </DIV>
<DIV> if(strcmp(Spacing," ") !=
0)<BR> GetVoxelSpacing(Spacing,VoxelWidth,VoxelHeight);<BR> <BR> ///get
image data pointer<BR> unsigned char* Buffer = (unsigned char *)
DCMReader.GetAllImageData(); <BR> int
spp=atoi(samples);<BR> ///calculating the volume size<BR> long
ImageSz = DCMReader.width * DCMReader.height
*DCMReader.Slices;<BR> long in_max,in_min;<BR> <BR> renderer1
=vtkRenderer::New();<BR> renWin1=vtkRenderWindow::New();<BR> <BR> //
Vtk Class to import the Buffer for furthur operations on
volume.<BR> <BR> vtkImageImport *Importer =
vtkImageImport::New();<BR> <BR> Importer->SetDataExtent(0,
DCMReader.width - 1, 0, DCMReader.height- 1, 0, DCMReader.Slices -
1);<BR> Importer->SetWholeExtent(0, DCMReader.width - 1, 0,
DCMReader.height- 1, 0, DCMReader.Slices -
1);<BR> Importer->SetDataSpacing((float)VoxelWidth,(float)VoxelHeight,(float)VoxelDepth);<BR> Importer->SetNumberOfScalarComponents(spp);<BR> //
Set the Appropriate Data Type to the Importer
Object<BR> if(DCMReader.DataType==DCMUShort)
<BR> {<BR> <BR> //Find the max,min values of Input
Images<BR> FindMinMax((unsigned
short*)Buffer,ImageSz,&in_max,&in_min);<BR> Importer->SetDataScalarTypeToUnsignedShort();<BR> <BR> }</DIV>
<DIV> </DIV>
<DIV> if(DCMReader.DataType==DCMShort)
<BR> {<BR> <BR> //Find the max,min values of Input
Images<BR> FindMinMax((short
*)Buffer,ImageSz,&in_max,&in_min);<BR> Importer->SetDataScalarTypeToUnsignedShort();<BR> }</DIV>
<DIV> </DIV>
<DIV> if(DCMReader.DataType==DCMUChar) <BR> {<BR> //Find
the max,min values of Input Images<BR> FindMinMax((unsigned char
*)Buffer,ImageSz,&in_max,&in_min);<BR> Importer->SetDataScalarTypeToUnsignedChar();<BR> }</DIV>
<DIV> </DIV>
<DIV> if(DCMReader.DataType==DCMChar) <BR> {<BR> //Find
the max,min values of Input Images <BR> FindMinMax((char
*)Buffer,ImageSz,&in_max,&in_min);<BR> Importer->SetDataScalarTypeToUnsignedChar();<BR> }</DIV>
<DIV> </DIV>
<DIV><BR> Importer->SetImportVoidPointer(Buffer); //
Importing the Buffer<BR> <BR> //to get first image display once
again flip the image<BR> vtkImageFlip
*upsidedownflip=vtkImageFlip::New();<BR> upsidedownflip->SetInput(Importer->GetOutput());<BR> upsidedownflip->SetFilteredAxes(2);</DIV>
<DIV> </DIV>
<DIV> vtkImageFlip
*fronttobackflip=vtkImageFlip::New();<BR> fronttobackflip->SetInput(upsidedownflip->GetOutput());<BR> fronttobackflip->SetFilteredAxes(1);</DIV>
<DIV> </DIV>
<DIV> //Create a transfer function mapping scalar value to
opacity<BR> vtkPiecewiseFunction *oTFun =
vtkPiecewiseFunction::New();<BR> oTFun->AddSegment(0, 0.0, in_max,
1.0);<BR> </DIV>
<DIV> </DIV>
<DIV> //Create a transfer function mapping scalar value to color
(grey)<BR> vtkPiecewiseFunction *cTFun =
vtkPiecewiseFunction::New();<BR> cTFun->AddSegment(0, 0.5, in_max,
1.0);<BR> <BR> <BR> // Create a property
for the volume and set the transfer functions.<BR> // Turn shading
on and use trilinear interpolation<BR> vtkVolumeProperty *volumeProperty
=
vtkVolumeProperty::New();<BR> volumeProperty->SetScalarOpacity(oTFun);<BR> volumeProperty->SetAmbient(0.10);<BR> volumeProperty->SetDiffuse(0.40);<BR> volumeProperty->SetSpecular(0.50);<BR> volumeProperty->SetSpecularPower(100);<BR> volumeProperty->SetInterpolationTypeToLinear();<BR>
volumeProperty->ShadeOn();</DIV>
<DIV> </DIV>
<DIV><BR> vtkVolumeRayCastMapper
*volumeMapper=vtkVolumeRayCastMapper::New(); <BR> vtkVolumeRayCastCompositeFunction
*Composite=vtkVolumeRayCastCompositeFunction::New();
<BR> Composite->SetCompositeMethodToClassifyFirst();<BR> volumeMapper->SetInput(fronttobackflip->GetOutput());<BR> volumeMapper->SetVolumeRayCastFunction(Composite);///for
Composite Technique</DIV>
<DIV> </DIV>
<DIV> vtkLODProp3D
*lod=vtkLODProp3D::New();<BR> lod->AddLOD(volumeMapper,volumeProperty,0.0);<BR> lod->SetPosition(0,1,2);<BR> lod->SetScale(3,3,3);<BR> renderer1->AddProp(lod);</DIV>
<DIV> </DIV>
<DIV> renWin1->AddRenderer(renderer1);<BR> ///Client window
handle to vtk Render
window<BR> renWin1->SetParentId(m_hWnd);<BR> renderer1->GetActiveCamera()->Azimuth(20.0);<BR> renderer1->GetActiveCamera()->Dolly(1.60);<BR> renderer1->ResetCameraClippingRange();<BR> <BR> renWin1->SetSize(DCMReader.width-10,DCMReader.height-10);
<BR> float
rate=renWin1->GetDesiredUpdateRate();<BR> renWin1->SetDesiredUpdateRate(2.0);<BR> renWin1->Render();
<BR> <BR> iren1 =vtkRenderWindowInteractor::New();<BR> //
Interact with the data at 2 frames per
second<BR> iren1->SetRenderWindow(renWin1);<BR> iren1->SetDesiredUpdateRate(2.0);<BR> iren1->SetStillUpdateRate(0.001);<BR> iren1->Initialize();<BR> //clean
the vtk
objects<BR> Importer->Delete();<BR> fronttobackflip->Delete();<BR> upsidedownflip->Delete();<BR> Composite->Delete();<BR> oTFun->Delete();<BR> cTFun->Delete();<BR> volumeProperty->Delete();<BR> volumeMapper->Delete();<BR> volume1->Delete();<BR>}</DIV>
<DIV> </DIV>
<DIV>thanking you,</DIV>
<DIV> </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>