VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkVolumeProMapper.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00049 #ifndef __vtkVolumeProMapper_h 00050 #define __vtkVolumeProMapper_h 00051 00052 #include "vtkVolumeMapper.h" 00053 #include "vtkToolkits.h" // Needed for VTK_USE_VOLUMEPRO_1000 00054 #include "vtkVersion.h" // Needed for VTK_*_VERSION 00055 00056 //BTX 00057 #if defined (VTK_USE_VOLUMEPRO_1000) || defined (VTK_FORCE_COMPILE_VP1000) 00058 namespace vli3 { 00059 #endif 00060 class VLIContext; 00061 class VLIVolume; 00062 class VLILookupTable; 00063 class VLILight; 00064 class VLICutPlane; 00065 #if defined (VTK_USE_VOLUMEPRO_1000) || defined (VTK_FORCE_COMPILE_VP1000) 00066 } 00067 using namespace vli3; 00068 00069 class vtkTimerLog; 00070 00071 #endif 00072 //ETX 00073 00074 #define VTK_BLEND_MODE_COMPOSITE 0 00075 #define VTK_BLEND_MODE_MAX_INTENSITY 1 00076 #define VTK_BLEND_MODE_MIN_INTENSITY 2 00077 00078 #define VTK_CURSOR_TYPE_CROSSHAIR 0 00079 #define VTK_CURSOR_TYPE_PLANE 1 00080 00081 #define VTK_VOLUME_8BIT 0 00082 #define VTK_VOLUME_12BIT_UPPER 1 00083 #define VTK_VOLUME_12BIT_LOWER 2 00084 //BTX 00085 #if ((VTK_MAJOR_VERSION == 3)&&(VTK_MINOR_VERSION == 2)) 00086 #define VTK_VOLUME_PRO_MAPPER_EXPORT VTK_EXPORT 00087 #else 00088 #define VTK_VOLUME_PRO_MAPPER_EXPORT VTK_VOLUMERENDERING_EXPORT 00089 #endif 00090 //ETX 00091 00092 class VTK_VOLUME_PRO_MAPPER_EXPORT vtkVolumeProMapper : public vtkVolumeMapper 00093 { 00094 public: 00095 vtkTypeMacro(vtkVolumeProMapper,vtkVolumeMapper); 00096 void PrintSelf( ostream& os, vtkIndent indent ); 00097 00099 static vtkVolumeProMapper *New(); 00100 00102 virtual void Render( vtkRenderer *, vtkVolume * ) {} 00103 00105 00106 vtkSetClampMacro( BlendMode, int, 00107 VTK_BLEND_MODE_COMPOSITE, VTK_BLEND_MODE_MIN_INTENSITY ); 00108 vtkGetMacro(BlendMode,int); 00109 void SetBlendModeToComposite() 00110 {this->SetBlendMode(VTK_BLEND_MODE_COMPOSITE);}; 00111 void SetBlendModeToMaximumIntensity() 00112 {this->SetBlendMode(VTK_BLEND_MODE_MAX_INTENSITY);}; 00113 void SetBlendModeToMinimumIntensity() 00114 {this->SetBlendMode(VTK_BLEND_MODE_MIN_INTENSITY);}; 00115 const char *GetBlendModeAsString(void); 00117 00119 00120 vtkSetVector6Macro( SubVolume, int ); 00121 vtkGetVectorMacro( SubVolume, int, 6 ); 00123 00125 00126 vtkSetClampMacro( Cursor, int, 0, 1 ); 00127 vtkGetMacro( Cursor, int ); 00128 vtkBooleanMacro( Cursor, int ); 00130 00132 00133 vtkSetClampMacro( CursorType, int, 00134 VTK_CURSOR_TYPE_CROSSHAIR, VTK_CURSOR_TYPE_PLANE ); 00135 vtkGetMacro( CursorType, int ); 00136 void SetCursorTypeToCrossHair() 00137 { this->SetCursorType( VTK_CURSOR_TYPE_CROSSHAIR ); }; 00138 void SetCursorTypeToPlane() 00139 { this->SetCursorType( VTK_CURSOR_TYPE_PLANE ); }; 00140 const char *GetCursorTypeAsString( void ); 00142 00144 00145 vtkSetVector3Macro( CursorPosition, double ); 00146 vtkGetVectorMacro( CursorPosition, double, 3 ); 00148 00150 00151 vtkSetVector3Macro( CursorXAxisColor, double ); 00152 vtkGetVectorMacro( CursorXAxisColor, double, 3 ); 00153 vtkSetVector3Macro( CursorYAxisColor, double ); 00154 vtkGetVectorMacro( CursorYAxisColor, double, 3 ); 00155 vtkSetVector3Macro( CursorZAxisColor, double ); 00156 vtkGetVectorMacro( CursorZAxisColor, double, 3 ); 00158 00160 00161 vtkSetClampMacro( SuperSampling, int, 0, 1 ); 00162 vtkGetMacro( SuperSampling, int ); 00163 vtkBooleanMacro( SuperSampling, int ); 00165 00167 00168 virtual void SetSuperSamplingFactor( double x, double y, double z ); 00169 void SetSuperSamplingFactor( double f[3] ) 00170 { this->SetSuperSamplingFactor( f[0], f[1], f[2] ); }; 00171 vtkGetVectorMacro( SuperSamplingFactor, double, 3 ); 00173 00175 00176 vtkSetClampMacro( CutPlane, int, 0, 1 ); 00177 vtkGetMacro( CutPlane, int ); 00178 vtkBooleanMacro( CutPlane, int ); 00180 00182 00183 vtkSetVector4Macro( CutPlaneEquation, double ); 00184 vtkGetVectorMacro( CutPlaneEquation, double, 4 ); 00186 00188 00189 vtkSetClampMacro( CutPlaneThickness, double, 0.0, 9.99e10 ); 00190 vtkGetMacro( CutPlaneThickness, double ); 00192 00194 00195 vtkSetClampMacro( CutPlaneFallOffDistance, int, 0, 16 ); 00196 vtkGetMacro( CutPlaneFallOffDistance, int ); 00198 00200 00201 vtkSetClampMacro( GradientOpacityModulation, int, 0, 1 ); 00202 vtkGetMacro( GradientOpacityModulation, int ); 00203 vtkBooleanMacro( GradientOpacityModulation, int ); 00205 00207 00208 vtkSetClampMacro( GradientDiffuseModulation, int, 0, 1 ); 00209 vtkGetMacro( GradientDiffuseModulation, int ); 00210 vtkBooleanMacro( GradientDiffuseModulation, int ); 00212 00214 00215 vtkSetClampMacro( GradientSpecularModulation, int, 0, 1 ); 00216 vtkGetMacro( GradientSpecularModulation, int ); 00217 vtkBooleanMacro( GradientSpecularModulation, int ); 00219 00221 00222 vtkGetMacro( NoHardware, int ); 00223 vtkGetMacro( WrongVLIVersion, int ); 00225 00227 00228 vtkGetMacro( NumberOfBoards, int ); 00229 vtkGetMacro( MajorBoardVersion, int ); 00230 vtkGetMacro( MinorBoardVersion, int ); 00231 virtual int GetAvailableBoardMemory() { return 0; } 00232 virtual void GetLockSizesForBoardMemory( unsigned int vtkNotUsed(type), 00233 unsigned int * vtkNotUsed(xSize), 00234 unsigned int * vtkNotUsed(ySize), 00235 unsigned int * vtkNotUsed(zSize)) {}; 00237 00239 00240 vtkSetClampMacro(IntermixIntersectingGeometry, int, 0, 1); 00241 vtkGetMacro(IntermixIntersectingGeometry, int); 00242 vtkBooleanMacro(IntermixIntersectingGeometry, int); 00244 00246 00249 vtkSetClampMacro(AutoAdjustMipmapLevels, int, 0, 1); 00250 vtkGetMacro(AutoAdjustMipmapLevels, int); 00251 vtkBooleanMacro(AutoAdjustMipmapLevels, int); 00253 00255 00258 vtkSetClampMacro(MinimumMipmapLevel, int, 0, 32); 00259 vtkGetMacro(MinimumMipmapLevel, int); 00261 00263 00267 vtkSetClampMacro(MaximumMipmapLevel, int, 0, 32); 00268 vtkGetMacro(MaximumMipmapLevel, int); 00270 00272 00276 vtkSetClampMacro(MipmapLevel, int, 0, 32); 00277 vtkGetMacro(MipmapLevel, int); 00279 00280 protected: 00281 vtkVolumeProMapper(); 00282 ~vtkVolumeProMapper(); 00283 // Make sure everything is OK for rendering 00284 int StatusOK(); 00285 00286 // The volume context - create it once and keep it around 00287 VLIContext *Context; 00288 00289 // The Volume, and the Input that was used to build the volume 00290 // and the time at which it was last built. 00291 VLIVolume *Volume; 00292 vtkImageData *VolumeInput; 00293 vtkTimeStamp *VolumeBuildTime; 00294 00295 // The type of data in the volume - 8bit, 12bit upper, or 12bit lower 00296 int VolumeDataType; 00297 00298 // The lookup table for RGBA - create it once then modify it as 00299 // necessary 00300 VLILookupTable *LookupTable; 00301 00302 // The blending mode to use 00303 int BlendMode; 00304 00305 // The lights, and how many of them there are. Not all of them 00306 // are turned on or used. 00307 VLILight **Lights; 00308 int NumberOfLights; 00309 00310 // The subvolume extent (xmin, xmax, ymin, ymax, zmin, zmax) 00311 int SubVolume[6]; 00312 00313 // The cursor parameters 00314 int Cursor; 00315 int CursorType; 00316 double CursorPosition[3]; 00317 double CursorXAxisColor[3]; 00318 double CursorYAxisColor[3]; 00319 double CursorZAxisColor[3]; 00320 00321 // The cut plane parameters 00322 int CutPlane; 00323 VLICutPlane *Cut; 00324 double CutPlaneEquation[4]; 00325 double CutPlaneThickness; 00326 int CutPlaneFallOffDistance; 00327 00328 // The supersampling parameters 00329 int SuperSampling; 00330 double SuperSamplingFactor[3]; 00331 00332 // The gradient modulation flags 00333 int GradientOpacityModulation; 00334 int GradientDiffuseModulation; 00335 int GradientSpecularModulation; 00336 00337 // Some board properties 00338 int NumberOfBoards; 00339 int MajorBoardVersion; 00340 int MinorBoardVersion; 00341 int GradientTableSize; 00342 00343 // Some error conditions that may occur during initialization 00344 int NoHardware; 00345 int WrongVLIVersion; 00346 int DisplayedMessage; 00347 00348 float *RenderTimeTable; 00349 vtkVolume **RenderVolumeTable; 00350 vtkRenderer **RenderRendererTable; 00351 int RenderTableSize; 00352 int RenderTableEntries; 00353 00354 vtkTimerLog *RenderTimer; 00355 00356 void StoreRenderTime( vtkRenderer *ren, vtkVolume *vol, float t ); 00357 float RetrieveRenderTime( vtkRenderer *ren, vtkVolume *vol ); 00358 00359 // The embedded geometry flag 00360 int IntermixIntersectingGeometry; 00361 00362 int AutoAdjustMipmapLevels; 00363 int MinimumMipmapLevel; 00364 int MaximumMipmapLevel; 00365 int MipmapLevel; 00366 00367 //BTX 00368 #if ((VTK_MAJOR_VERSION == 3)&&(VTK_MINOR_VERSION == 2)) 00369 // WARNING: INTERNAL METHOD - NOT FOR GENERAL USE 00370 virtual int GetMapperType() {return VTK_FRAMEBUFFER_VOLUME_MAPPER;}; 00371 #endif 00372 //ETX 00373 00374 private: 00375 vtkVolumeProMapper(const vtkVolumeProMapper&); // Not implemented. 00376 void operator=(const vtkVolumeProMapper&); // Not implemented. 00377 }; 00378 00380 00381 inline const char *vtkVolumeProMapper::GetBlendModeAsString() 00382 { 00383 switch ( this->BlendMode ) 00384 { 00385 case VTK_BLEND_MODE_COMPOSITE: 00386 return "Composite"; 00387 case VTK_BLEND_MODE_MAX_INTENSITY: 00388 return "Maximum Intensity"; 00389 case VTK_BLEND_MODE_MIN_INTENSITY: 00390 return "Minimum Intensity"; 00391 default: 00392 return "Unknown Blend Mode"; 00393 } 00394 } 00396 00398 00399 inline const char *vtkVolumeProMapper::GetCursorTypeAsString() 00400 { 00401 switch ( this->CursorType ) 00402 { 00403 case VTK_CURSOR_TYPE_CROSSHAIR: 00404 return "Crosshair"; 00405 case VTK_CURSOR_TYPE_PLANE: 00406 return "Plane"; 00407 default: 00408 return "Unknown Cursor Type"; 00409 } 00410 } 00412 00413 #endif 00414