Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Rendering/vtkVolumeProMapper.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkVolumeProMapper.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00062 #ifndef __vtkVolumeProMapper_h
00063 #define __vtkVolumeProMapper_h
00064 
00065 #include "vtkVolumeMapper.h"
00066 #include "vtkToolkits.h" // Needed for VTK_HAVE_VP1000
00067 #include "vtkVersion.h" // Needed for VTK_*_VERSION
00068 
00069 //BTX
00070 #if defined (VTK_HAVE_VP1000) || defined (VTK_FORCE_COMPILE_VP1000)
00071 namespace vli3 {
00072 #endif
00073 class VLIContext;
00074 class VLIVolume;
00075 class VLILookupTable;
00076 class VLILight;
00077 class VLICutPlane;
00078 #if defined (VTK_HAVE_VP1000) || defined (VTK_FORCE_COMPILE_VP1000)
00079 }
00080 using namespace vli3;
00081 #endif
00082 //ETX
00083 
00084 #define VTK_BLEND_MODE_COMPOSITE        0
00085 #define VTK_BLEND_MODE_MAX_INTENSITY    1
00086 #define VTK_BLEND_MODE_MIN_INTENSITY    2
00087 
00088 #define VTK_CURSOR_TYPE_CROSSHAIR       0
00089 #define VTK_CURSOR_TYPE_PLANE           1
00090 
00091 #define VTK_VOLUME_8BIT                 0
00092 #define VTK_VOLUME_12BIT_UPPER          1
00093 #define VTK_VOLUME_12BIT_LOWER          2
00094 //BTX
00095 #if ((VTK_MAJOR_VERSION == 3)&&(VTK_MINOR_VERSION == 2))
00096 #define VTK_VOLUME_PRO_MAPPER_EXPORT VTK_EXPORT
00097 #else
00098 #define VTK_VOLUME_PRO_MAPPER_EXPORT VTK_RENDERING_EXPORT 
00099 #endif
00100 //ETX
00101 
00102 class VTK_VOLUME_PRO_MAPPER_EXPORT vtkVolumeProMapper : public vtkVolumeMapper
00103 {
00104 public:
00105   vtkTypeRevisionMacro(vtkVolumeProMapper,vtkVolumeMapper);
00106   void PrintSelf( ostream& os, vtkIndent indent );
00107 
00109   static vtkVolumeProMapper *New();
00110 
00112   virtual void Render( vtkRenderer *, vtkVolume * ) {}
00113   
00115 
00116   vtkSetClampMacro( BlendMode, int,
00117         VTK_BLEND_MODE_COMPOSITE, VTK_BLEND_MODE_MIN_INTENSITY );
00118   vtkGetMacro(BlendMode,int);
00119   void SetBlendModeToComposite() 
00120         {this->SetBlendMode(VTK_BLEND_MODE_COMPOSITE);};
00121   void SetBlendModeToMaximumIntensity() 
00122         {this->SetBlendMode(VTK_BLEND_MODE_MAX_INTENSITY);};
00123   void SetBlendModeToMinimumIntensity() 
00124         {this->SetBlendMode(VTK_BLEND_MODE_MIN_INTENSITY);};
00125   const char *GetBlendModeAsString(void);
00127 
00129 
00130   vtkSetVector6Macro( SubVolume, int );
00131   vtkGetVectorMacro( SubVolume, int, 6 );
00133 
00135 
00136   vtkSetClampMacro( Cursor, int, 0, 1 );
00137   vtkGetMacro( Cursor, int );
00138   vtkBooleanMacro( Cursor, int );
00140 
00142 
00143   vtkSetClampMacro( CursorType, int, 
00144                     VTK_CURSOR_TYPE_CROSSHAIR, VTK_CURSOR_TYPE_PLANE );
00145   vtkGetMacro( CursorType, int );
00146   void SetCursorTypeToCrossHair()
00147     { this->SetCursorType( VTK_CURSOR_TYPE_CROSSHAIR ); };
00148   void SetCursorTypeToPlane()
00149     { this->SetCursorType( VTK_CURSOR_TYPE_PLANE ); };
00150   const char *GetCursorTypeAsString( void );
00152 
00154 
00155   vtkSetVector3Macro( CursorPosition, double );
00156   vtkGetVectorMacro( CursorPosition, double, 3 );
00158 
00160 
00161   vtkSetVector3Macro( CursorXAxisColor, double );
00162   vtkGetVectorMacro(  CursorXAxisColor, double, 3 );
00163   vtkSetVector3Macro( CursorYAxisColor, double );
00164   vtkGetVectorMacro(  CursorYAxisColor, double, 3 );
00165   vtkSetVector3Macro( CursorZAxisColor, double );
00166   vtkGetVectorMacro(  CursorZAxisColor, double, 3 );
00168 
00170 
00171   vtkSetClampMacro( SuperSampling, int, 0, 1 );
00172   vtkGetMacro( SuperSampling, int );
00173   vtkBooleanMacro( SuperSampling, int );
00175 
00177 
00178   void SetSuperSamplingFactor( double x, double y, double z );
00179   void SetSuperSamplingFactor( double f[3] )
00180     { this->SetSuperSamplingFactor( f[0], f[1], f[2] ); };
00181   vtkGetVectorMacro( SuperSamplingFactor, double, 3 );
00183 
00185 
00186   vtkSetClampMacro( CutPlane, int, 0, 1 );
00187   vtkGetMacro( CutPlane, int );
00188   vtkBooleanMacro( CutPlane, int );
00190 
00192 
00193   vtkSetVector4Macro( CutPlaneEquation, double );
00194   vtkGetVectorMacro( CutPlaneEquation, double, 4 );
00196   
00198 
00199   vtkSetClampMacro( CutPlaneThickness, double, 0.0, 9.99e10 );
00200   vtkGetMacro( CutPlaneThickness, double );
00202 
00204 
00205   vtkSetClampMacro( CutPlaneFallOffDistance, int, 0, 16 );
00206   vtkGetMacro( CutPlaneFallOffDistance, int );
00208 
00210 
00211   vtkSetClampMacro( GradientOpacityModulation, int, 0, 1 );
00212   vtkGetMacro( GradientOpacityModulation, int );
00213   vtkBooleanMacro( GradientOpacityModulation, int );
00215 
00217 
00218   vtkSetClampMacro( GradientDiffuseModulation, int, 0, 1 );
00219   vtkGetMacro( GradientDiffuseModulation, int );
00220   vtkBooleanMacro( GradientDiffuseModulation, int );
00222 
00224 
00225   vtkSetClampMacro( GradientSpecularModulation, int, 0, 1 );
00226   vtkGetMacro( GradientSpecularModulation, int );
00227   vtkBooleanMacro( GradientSpecularModulation, int );
00229 
00231 
00232   vtkGetMacro( NoHardware, int );
00233   vtkGetMacro( WrongVLIVersion, int );
00235   
00237 
00238   vtkGetMacro( NumberOfBoards, int );
00239   vtkGetMacro( MajorBoardVersion, int );
00240   vtkGetMacro( MinorBoardVersion, int );
00241   virtual int GetAvailableBoardMemory() { return 0; }
00242   virtual void GetLockSizesForBoardMemory( unsigned int vtkNotUsed(type),
00243                                            unsigned int * vtkNotUsed(xSize),
00244                                            unsigned int * vtkNotUsed(ySize),
00245                                            unsigned int * vtkNotUsed(zSize)) {};
00247 
00249 
00251   vtkSetClampMacro(IntermixIntersectingGeometry, int, 0, 1);
00252   vtkGetMacro(IntermixIntersectingGeometry, int);
00253   vtkBooleanMacro(IntermixIntersectingGeometry, int);
00255   
00256 protected:
00257   vtkVolumeProMapper();
00258   ~vtkVolumeProMapper();
00259  // Make sure everything is OK for rendering
00260   int StatusOK();
00261 
00262   // The volume context - create it once and keep it around
00263   VLIContext           *Context;
00264 
00265   // The Volume, and the Input that was used to build the volume
00266   // and the time at which it was last built.
00267   VLIVolume            *Volume;
00268   vtkImageData         *VolumeInput;
00269   vtkTimeStamp         *VolumeBuildTime;
00270 
00271   // The type of data in the volume - 8bit, 12bit upper, or 12bit lower
00272   int                  VolumeDataType;
00273 
00274   // The lookup table for RGBA - create it once then modify it as 
00275   // necessary
00276   VLILookupTable       *LookupTable;
00277 
00278   // The blending mode to use
00279   int                  BlendMode;
00280 
00281   // The lights, and how many of them there are. Not all of them
00282   // are turned on or used.
00283   VLILight             **Lights;
00284   int                  NumberOfLights;
00285 
00286   // The subvolume extent (xmin, xmax, ymin, ymax, zmin, zmax)
00287   int                  SubVolume[6];
00288 
00289   // The cursor parameters
00290   int                  Cursor;
00291   int                  CursorType;
00292   double               CursorPosition[3];
00293   double               CursorXAxisColor[3];
00294   double               CursorYAxisColor[3];
00295   double               CursorZAxisColor[3];
00296   
00297   // The cut plane parameters
00298   int                  CutPlane;
00299   VLICutPlane          *Cut;
00300   double               CutPlaneEquation[4];
00301   double               CutPlaneThickness;
00302   int                  CutPlaneFallOffDistance;
00303 
00304   // The supersampling parameters
00305   int                  SuperSampling;
00306   double               SuperSamplingFactor[3];
00307 
00308   // The gradient modulation flags
00309   int                  GradientOpacityModulation;
00310   int                  GradientDiffuseModulation;
00311   int                  GradientSpecularModulation;
00312 
00313   // Some board properties
00314   int                  NumberOfBoards;
00315   int                  MajorBoardVersion;
00316   int                  MinorBoardVersion;
00317   int                  GradientTableSize;
00318 
00319   // Some error conditions that may occur during initialization
00320   int                  NoHardware;
00321   int                  WrongVLIVersion;
00322   int                  DisplayedMessage;
00323 
00324   // The embedded geometry flag
00325   int IntermixIntersectingGeometry;
00326   
00327 //BTX
00328 #if ((VTK_MAJOR_VERSION == 3)&&(VTK_MINOR_VERSION == 2))
00329   // WARNING: INTERNAL METHOD - NOT FOR GENERAL USE
00330   virtual int GetMapperType() {return VTK_FRAMEBUFFER_VOLUME_MAPPER;};
00331 #endif
00332 //ETX
00333   
00334 private:
00335   vtkVolumeProMapper(const vtkVolumeProMapper&);  // Not implemented.
00336   void operator=(const vtkVolumeProMapper&);  // Not implemented.
00337 };
00338 
00340 inline const char *vtkVolumeProMapper::GetBlendModeAsString()
00341 {
00342   switch ( this->BlendMode )
00343     {
00344     case VTK_BLEND_MODE_COMPOSITE:
00345       return "Composite";
00346     case VTK_BLEND_MODE_MAX_INTENSITY:
00347       return "Maximum Intensity";
00348     case VTK_BLEND_MODE_MIN_INTENSITY:
00349       return "Minimum Intensity";
00350     default:
00351       return "Unknown Blend Mode";
00352     }
00353 }
00354 
00356 inline const char *vtkVolumeProMapper::GetCursorTypeAsString()
00357 {
00358   switch ( this->CursorType )
00359     {
00360     case VTK_CURSOR_TYPE_CROSSHAIR:
00361       return "Crosshair";
00362     case VTK_CURSOR_TYPE_PLANE:
00363       return "Plane";
00364     default:
00365       return "Unknown Cursor Type";
00366     }
00367 }
00368 
00369 #endif
00370