[vtkusers] VolumePro 1000

Madhusudhanan Balasubramanian madhu_lsu at yahoo.com
Mon Feb 14 21:34:14 EST 2005


Hi Stephan,

Thanks.  But you do not need this file as this comes
with the vtk installation.  However I found that its
simple to use vtk for volumepro 1000.  This is all you
have to do:

1. Recompile vtk (using cmake) with VTK_USE_VOLUMEPRO
turned on.

2. Instead of using vtkRayCastMapper use
vtkVolumeProMapper.  This will automatically create
vtkVolumeProVP1000Mapper / vtkVolumeProVP500Mapper
depending on the available hardware.

Rest is same as regular volume rendering.

Hope this helps.

Madhu.
--- Stephan Theisen <StephanTheisen at gmx.de> wrote:

> Hi Madhu!
> 
> I've attached the headerfile of the
> vtkVolumeProVP1000Mapper and the 
> source file. I hope these are the files you need.
> Have you an example that shows how to use the
> VolumeProVp1000Mapper 
> correctly? Because I have the class and so on but I
> don't know
> how I must use the Mapper. For example Input,
> etc.....
> 
> Bye Stephan
> >
/*=========================================================================
> 
>   Program:   Visualization Toolkit
>   Module:    $RCSfile:
> vtkVolumeProVP1000Mapper.cxx,v $
> 
>   Copyright (c) Ken Martin, Will Schroeder, Bill
> Lorensen
>   All rights reserved.
>   See Copyright.txt or
> http://www.kitware.com/Copyright.htm for details.
> 
>      This software is distributed WITHOUT ANY
> WARRANTY; without even
>      the implied warranty of MERCHANTABILITY or
> FITNESS FOR A PARTICULAR
>      PURPOSE.  See the above copyright notice for
> more information.
> 
>
=========================================================================*/
> #include "vtkVolumeProVP1000Mapper.h"
> 
> #include "vtkCamera.h"
> #include "vtkColorTransferFunction.h"
> #include "vtkDebugLeaks.h"
> #include "vtkGraphicsFactory.h"
> #include "vtkImageData.h"
> #include "vtkLight.h"
> #include "vtkLightCollection.h"
> #include "vtkObjectFactory.h"
> #include "vtkOpenGLVolumeProVP1000Mapper.h"
> #include "vtkPiecewiseFunction.h"
> #include "vtkPointData.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderer.h"
> #include "vtkToolkits.h"
> #include "vtkTransform.h"
> #include "vtkVolume.h"
> #include "vtkVolumeProperty.h"
> 
> #include <stdio.h>
> #include <math.h>
> 
> vtkCxxRevisionMacro(vtkVolumeProVP1000Mapper,
> "$Revision: 1.2 $");
> 
>
//----------------------------------------------------------------------------
> // Needed when we don't use the vtkStandardNewMacro.
> vtkInstantiatorNewMacro(vtkVolumeProVP1000Mapper);
>
//----------------------------------------------------------------------------
> 
> vtkVolumeProVP1000Mapper::vtkVolumeProVP1000Mapper()
> {
>   VLIStatus         status;
>   VLIConfiguration  *config;
> 
>   this->ImageBuffer = NULL;
>   this->DepthBuffer = NULL;
> 
>   // Establish a connection with vli
>   status = VLIOpen();
>   
>   if ( status != kVLIOK )
>     {
>     vtkDebugMacro( << "VLIOpen failed!" );
>     this->Context = NULL;
>     this->LookupTable = NULL;
> 
>     if ( status == kVLIErrNoHardware )
>       {
>       this->NoHardware = 1;
>       }
>     else if ( status == kVLIErrVersion )
>       {
>       this->WrongVLIVersion = 1;
>       }
>     return;
>     }
> 
>   // Gather some useful information
>   config = new VLIConfiguration;
>   this->NumberOfBoards =
> config->GetNumberOfBoards();
>   this->MajorBoardVersion =
> config->GetBoardMajorVersion();
>   this->MinorBoardVersion =
> config->GetBoardMinorVersion();
>   this->GradientTableSize =
> config->GetGradientTableLength();
>   delete config;
> 
>   // Create the context
>   this->Context = VLIContext::Create();
>   if (!this->Context)
>     {
>     vtkErrorMacro( << "Context could not be
> created!" );
>     return;
>     }
> 
>   this->LookupTable =
> VLILookupTable::Create(VLILookupTable::kSize4096);
> 
>   if ( !this->LookupTable )
>     {
>     vtkErrorMacro( << "Lookup table could not be
> created!" );
>     return;    
>     }
> 
>  
>
this->Context->GetClassifier().SetLookupTable(kVLITable0,
> this->LookupTable);
> 
>   this->Cut = VLICutPlane::Create( 1.0, 0.0, 0.0,
> 0.0, 0.0, 0.0 );
>   
>   if ( !this->Cut )
>     {
>     vtkErrorMacro( << "Cut plane could not be
> created!" );
>     return;    
>     }
>   
>   int i ;
>   for ( i =0; i < 4; i++)
>   {
> 	  this->Cuts[i] = VLICutPlane::Create( 1.0, 0.0,
> 0.0, 0.0, 0.0, 0.0 );
> 	  
> 	  if ( !this->Cuts[i] )
> 	  {
> 		  vtkErrorMacro( << "Cut plane could not be
> created!" );
> 		  return;    
> 	  }	  
>   }
>   
>   this->DrawBoundingBox = 0;
> }
> 
> 
> 
>
vtkVolumeProVP1000Mapper::~vtkVolumeProVP1000Mapper()
> {
>   int i;
> 
>   // free the lights
>   if (this->NumberOfLights > 0)
>     {      
>     for ( i = 0; i < this->NumberOfLights; i++ )
>       {
>       this->Context->RemoveLight( this->Lights[i] );
>       this->Lights[i]->Release();
>       }
>     if ( this->Lights )
>       {
>       delete [] this->Lights;
>       }
>     }
>   
>   if (this->Cut)
>     {
>     this->Cut->Release();
>     }
> 
>   // Free the lookup table if it was created
>   if ( this->LookupTable )
>     {
>     this->LookupTable->Release();
>     }
> 
>   // Free the volume if necessary
>   if ( this->Volume )
>     {
>     if (this->Volume->IsLocked() == VLItrue)
>       {
>       this->Volume->UnlockVolume();
>       }
>     this->Volume->Release();
>     }
> 
>   if (this->ImageBuffer)
>     {
>     this->ImageBuffer->Release();
>     this->ImageBuffer = NULL;
>     }
>   
>   if (this->DepthBuffer)
>     {
>     this->DepthBuffer->Release();
>     this->DepthBuffer = NULL;
>     }
> 
>   // Free the context if necessary
>   if (this->Context)
>     {
>     this->Context->Release();
>     }
>   
>   // Terminate connection to the hardware
> 
=== message truncated ===>
/*=========================================================================
> 
>   Program:   Visualization Toolkit
>   Module:    $RCSfile: vtkVolumeProVP1000Mapper.h,v
> $
> 
>   Copyright (c) Ken Martin, Will Schroeder, Bill
> Lorensen
>   All rights reserved.
>   See Copyright.txt or
> http://www.kitware.com/Copyright.htm for details.
> 
>      This software is distributed WITHOUT ANY
> WARRANTY; without even
>      the implied warranty of MERCHANTABILITY or
> FITNESS FOR A PARTICULAR
>      PURPOSE.  See the above copyright notice for
> more information.
> 
>
=========================================================================*/
> // .NAME vtkVolumeProVP1000Mapper - Superclass for
> VP1000 board
> //
> // .SECTION Description
> // vtkVolumeProVP1000Mapper is the superclass for
> VolumePRO volume rendering 
> // mappers based on the VP1000 chip. Subclasses are
> for underlying graphics 
> // languages. Users should not create subclasses
> directly - 
> // a vtkVolumeProMapper will automatically create
> the object of the right 
> // type.
> //
> // This class is not included in the Rendering
> CMakeLists by default. If you
> // want to add this class to your vtk build, you
> need to have the vli header
> // and library files, and you will need to perform
> the following steps:
> //
> // 1. Run cmake, and set the VTK_USE_VOLUMEPRO flag
> to true.
> // 2. If the libary file (VLI_LIBRARY_FOR_VP1000) is
> not found by cmake, set
> //    the path to that file, and rerun cmake.
> // 3. If the header file
> (VLI_INCLUDE_PATH_FOR_VP1000) is not found by cmake,
> //    set the path to that file, and rerun cmake.
> // 4. Rebuild VTK.
> //
> // For more information on the VolumePRO hardware,
> please see:
> //
> //  
>
http://www.terarecon.com/products/volumepro_prod.html
> //
> // If you encounter any problems with this class,
> please inform Kitware, Inc.
> // at kitware at kitware.com.
> //
> //
> // .SECTION See Also
> // vtkVolumeMapper vtkVolumeProMapper
> vtkOpenGLVolumeProVP1000Mapper
> //
> 
> #ifndef __vtkVolumeProVP1000Mapper_h
> #define __vtkVolumeProVP1000Mapper_h
> 
> #include "vtkVolumeProMapper.h"
> 
> #ifdef _WIN32
> #include "VolumePro1000/inc/vli.h" // Needed for VLI
> internal types
> #else
> #include "vli3/include/vli.h" // Needed for VLI
> internal types
> #endif
> 
> #define VTK_VOLUME_16BIT 3
> #define VTK_VOLUME_32BIT 4
> 
> class VTK_EXPORT vtkVolumeProVP1000Mapper : public
> vtkVolumeProMapper
> {
> public:
>  
>
vtkTypeRevisionMacro(vtkVolumeProVP1000Mapper,vtkVolumeProMapper);
>   static vtkVolumeProVP1000Mapper *New();
>   virtual void PrintSelf(ostream& os, vtkIndent
> indent);
> 
>   // Description:
>   // Render the image using the hardware and place
> it in the frame buffer
>   virtual void Render( vtkRenderer *, vtkVolume * );
>   virtual int GetAvailableBoardMemory();
>   virtual void GetLockSizesForBoardMemory(unsigned
> int type,
>                                           unsigned
> int *xSize,
>                                           unsigned
> int *ySize,
>                                           unsigned
> int *zSize);
>   virtual void SetCutPlaneEquation(int index, double
> cutA, double cutB, double cutC, double cutD);
>   virtual void GetCutPlaneEquation(int index, double
> &cutA, double &cutB, double &cutC, double &cutD);
> 
>   virtual void SetCutPlane(int index, int isOn);
>   virtual void GetCutPlane(int index, int &isOn);
> 
>   virtual void SetCutPlaneThickness(int index,
> double thickness);
>   virtual void GetCutPlaneThickness(int index,
> double &thickness);
> 
>   virtual void SetCutPlaneFallOffDistance(int index,
> double falloff);
>   virtual void GetCutPlaneFallOffDistance(int index,
> double &falloff);
>   
>   
> protected:
>   vtkVolumeProVP1000Mapper();
>   ~vtkVolumeProVP1000Mapper();
>   
>   // Update the camera - set the camera matrix
>   void UpdateCamera( vtkRenderer *, vtkVolume * );
> 
>   // Update the lights
>   void UpdateLights( vtkRenderer *, vtkVolume * );
> 
>   // Update the properties of the volume including
> transfer functions
>   // and material properties
>   void UpdateProperties( vtkRenderer *, vtkVolume *
> );
> 
>   // Update the volume - create it if necessary
>   // Set the volume matrix.
>   void UpdateVolume( vtkRenderer *, vtkVolume * );
> 
>   // Set the crop box (as defined in the
> vtkVolumeMapper superclass)
>   void UpdateCropping( vtkRenderer *, vtkVolume * );
> 
>   // Set the cursor
>   void UpdateCursor( vtkRenderer *, vtkVolume * );
> 
>   // Update the cut plane
>   void UpdateCutPlane( vtkRenderer *, vtkVolume * );
> 
>   // Render the image buffer to the screen
>   // Defined in the specific graphics
> implementation.
>   virtual void RenderImageBuffer( vtkRenderer  *
> vtkNotUsed(ren),
>                                   vtkVolume    *
> vol,
>                                   int         
> size[2],
>                                   unsigned int *
> outData )
>     {(void)vol; (void)size; (void)outData;}
> 
>   // Render a bounding box of the volume because the
> texture map would
>   // be too large.
>   virtual void RenderBoundingBox( vtkRenderer *
> vtkNotUsed(ren),
>                                   vtkVolume   * vol
> )
>     {(void)vol;}
> 
>   // Get the depth buffer values
>   virtual void GetDepthBufferValues( vtkRenderer
> *vtkNotUsed(ren),
>                                      int size[2],
>                                      unsigned int
> *outData )
>     { (void)outData; }
> 
> #if ((VTK_MAJOR_VERSION == 3)&&(VTK_MINOR_VERSION ==
> 2))
>   vtkGetVectorMacro( VoxelCroppingRegionPlanes,
> float, 6 );
>   void ConvertCroppingRegionPlanesToVoxels();
>   float                VoxelCroppingRegionPlanes[6];
> #endif
> 
>   
>   // Keep track of the size of the data loaded so we
> know if we can
>   // simply update when a change occurs or if we
> need to release and
>   // create again
>   int LoadedDataSize[3];
> 
> 
=== message truncated ===



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250



More information about the vtkusers mailing list