VTK
vtkVolumeProMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVolumeProMapper.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
49 #ifndef __vtkVolumeProMapper_h
50 #define __vtkVolumeProMapper_h
51 
52 #include "vtkVolumeMapper.h"
53 #include "vtkToolkits.h" // Needed for VTK_USE_VOLUMEPRO_1000
54 #include "vtkVersion.h" // Needed for VTK_*_VERSION
55 
56 //BTX
57 #if defined (VTK_USE_VOLUMEPRO_1000) || defined (VTK_FORCE_COMPILE_VP1000)
58 namespace vli3 {
59 #endif
60 class VLIContext;
61 class VLIVolume;
62 class VLILookupTable;
63 class VLILight;
64 class VLICutPlane;
65 #if defined (VTK_USE_VOLUMEPRO_1000) || defined (VTK_FORCE_COMPILE_VP1000)
66 }
67 using namespace vli3;
68 
69 class vtkTimerLog;
70 
71 #endif
72 //ETX
73 
74 #define VTK_BLEND_MODE_COMPOSITE 0
75 #define VTK_BLEND_MODE_MAX_INTENSITY 1
76 #define VTK_BLEND_MODE_MIN_INTENSITY 2
77 
78 #define VTK_CURSOR_TYPE_CROSSHAIR 0
79 #define VTK_CURSOR_TYPE_PLANE 1
80 
81 #define VTK_VOLUME_8BIT 0
82 #define VTK_VOLUME_12BIT_UPPER 1
83 #define VTK_VOLUME_12BIT_LOWER 2
84 //BTX
85 #if ((VTK_MAJOR_VERSION == 3)&&(VTK_MINOR_VERSION == 2))
86 #define VTK_VOLUME_PRO_MAPPER_EXPORT VTK_EXPORT
87 #else
88 #define VTK_VOLUME_PRO_MAPPER_EXPORT VTK_VOLUMERENDERING_EXPORT
89 #endif
90 //ETX
91 
93 {
94 public:
96  void PrintSelf( ostream& os, vtkIndent indent );
97 
99  static vtkVolumeProMapper *New();
100 
102  virtual void Render( vtkRenderer *, vtkVolume * ) {}
103 
105 
106  vtkSetClampMacro( BlendMode, int,
108  vtkGetMacro(BlendMode,int);
110  {this->SetBlendMode(VTK_BLEND_MODE_COMPOSITE);};
112  {this->SetBlendMode(VTK_BLEND_MODE_MAX_INTENSITY);};
114  {this->SetBlendMode(VTK_BLEND_MODE_MIN_INTENSITY);};
115  const char *GetBlendModeAsString(void);
117 
119 
120  vtkSetVector6Macro( SubVolume, int );
121  vtkGetVectorMacro( SubVolume, int, 6 );
123 
125 
126  vtkSetClampMacro( Cursor, int, 0, 1 );
127  vtkGetMacro( Cursor, int );
128  vtkBooleanMacro( Cursor, int );
130 
132 
133  vtkSetClampMacro( CursorType, int,
135  vtkGetMacro( CursorType, int );
137  { this->SetCursorType( VTK_CURSOR_TYPE_CROSSHAIR ); };
139  { this->SetCursorType( VTK_CURSOR_TYPE_PLANE ); };
140  const char *GetCursorTypeAsString( void );
142 
144 
145  vtkSetVector3Macro( CursorPosition, double );
146  vtkGetVectorMacro( CursorPosition, double, 3 );
148 
150 
151  vtkSetVector3Macro( CursorXAxisColor, double );
152  vtkGetVectorMacro( CursorXAxisColor, double, 3 );
153  vtkSetVector3Macro( CursorYAxisColor, double );
154  vtkGetVectorMacro( CursorYAxisColor, double, 3 );
155  vtkSetVector3Macro( CursorZAxisColor, double );
156  vtkGetVectorMacro( CursorZAxisColor, double, 3 );
158 
160 
161  vtkSetClampMacro( SuperSampling, int, 0, 1 );
162  vtkGetMacro( SuperSampling, int );
163  vtkBooleanMacro( SuperSampling, int );
165 
167 
168  virtual void SetSuperSamplingFactor( double x, double y, double z );
169  void SetSuperSamplingFactor( double f[3] )
170  { this->SetSuperSamplingFactor( f[0], f[1], f[2] ); };
171  vtkGetVectorMacro( SuperSamplingFactor, double, 3 );
173 
175 
176  vtkSetClampMacro( CutPlane, int, 0, 1 );
177  vtkGetMacro( CutPlane, int );
178  vtkBooleanMacro( CutPlane, int );
180 
182 
183  vtkSetVector4Macro( CutPlaneEquation, double );
184  vtkGetVectorMacro( CutPlaneEquation, double, 4 );
186 
188 
189  vtkSetClampMacro( CutPlaneThickness, double, 0.0, 9.99e10 );
190  vtkGetMacro( CutPlaneThickness, double );
192 
194 
195  vtkSetClampMacro( CutPlaneFallOffDistance, int, 0, 16 );
196  vtkGetMacro( CutPlaneFallOffDistance, int );
198 
200 
201  vtkSetClampMacro( GradientOpacityModulation, int, 0, 1 );
202  vtkGetMacro( GradientOpacityModulation, int );
203  vtkBooleanMacro( GradientOpacityModulation, int );
205 
207 
208  vtkSetClampMacro( GradientDiffuseModulation, int, 0, 1 );
209  vtkGetMacro( GradientDiffuseModulation, int );
210  vtkBooleanMacro( GradientDiffuseModulation, int );
212 
214 
215  vtkSetClampMacro( GradientSpecularModulation, int, 0, 1 );
216  vtkGetMacro( GradientSpecularModulation, int );
217  vtkBooleanMacro( GradientSpecularModulation, int );
219 
221 
222  vtkGetMacro( NoHardware, int );
223  vtkGetMacro( WrongVLIVersion, int );
225 
227 
228  vtkGetMacro( NumberOfBoards, int );
229  vtkGetMacro( MajorBoardVersion, int );
230  vtkGetMacro( MinorBoardVersion, int );
231  virtual int GetAvailableBoardMemory() { return 0; }
232  virtual void GetLockSizesForBoardMemory( unsigned int vtkNotUsed(type),
233  unsigned int * vtkNotUsed(xSize),
234  unsigned int * vtkNotUsed(ySize),
235  unsigned int * vtkNotUsed(zSize)) {};
237 
239 
240  vtkSetClampMacro(IntermixIntersectingGeometry, int, 0, 1);
241  vtkGetMacro(IntermixIntersectingGeometry, int);
242  vtkBooleanMacro(IntermixIntersectingGeometry, int);
244 
246 
249  vtkSetClampMacro(AutoAdjustMipmapLevels, int, 0, 1);
250  vtkGetMacro(AutoAdjustMipmapLevels, int);
251  vtkBooleanMacro(AutoAdjustMipmapLevels, int);
253 
255 
258  vtkSetClampMacro(MinimumMipmapLevel, int, 0, 32);
259  vtkGetMacro(MinimumMipmapLevel, int);
261 
263 
267  vtkSetClampMacro(MaximumMipmapLevel, int, 0, 32);
268  vtkGetMacro(MaximumMipmapLevel, int);
270 
272 
276  vtkSetClampMacro(MipmapLevel, int, 0, 32);
277  vtkGetMacro(MipmapLevel, int);
279 
280 protected:
283  // Make sure everything is OK for rendering
284  int StatusOK();
285 
286  // The volume context - create it once and keep it around
287  VLIContext *Context;
288 
289  // The Volume, and the Input that was used to build the volume
290  // and the time at which it was last built.
291  VLIVolume *Volume;
294 
295  // The type of data in the volume - 8bit, 12bit upper, or 12bit lower
297 
298  // The lookup table for RGBA - create it once then modify it as
299  // necessary
300  VLILookupTable *LookupTable;
301 
302  // The blending mode to use
304 
305  // The lights, and how many of them there are. Not all of them
306  // are turned on or used.
307  VLILight **Lights;
309 
310  // The subvolume extent (xmin, xmax, ymin, ymax, zmin, zmax)
311  int SubVolume[6];
312 
313  // The cursor parameters
314  int Cursor;
316  double CursorPosition[3];
317  double CursorXAxisColor[3];
318  double CursorYAxisColor[3];
319  double CursorZAxisColor[3];
320 
321  // The cut plane parameters
322  int CutPlane;
323  VLICutPlane *Cut;
324  double CutPlaneEquation[4];
327 
328  // The supersampling parameters
330  double SuperSamplingFactor[3];
331 
332  // The gradient modulation flags
336 
337  // Some board properties
342 
343  // Some error conditions that may occur during initialization
347 
353 
355 
356  void StoreRenderTime( vtkRenderer *ren, vtkVolume *vol, float t );
357  float RetrieveRenderTime( vtkRenderer *ren, vtkVolume *vol );
358 
359  // The embedded geometry flag
361 
366 
367 //BTX
368 #if ((VTK_MAJOR_VERSION == 3)&&(VTK_MINOR_VERSION == 2))
369  // WARNING: INTERNAL METHOD - NOT FOR GENERAL USE
370  virtual int GetMapperType() {return VTK_FRAMEBUFFER_VOLUME_MAPPER;};
371 #endif
372 //ETX
373 
374 private:
375  vtkVolumeProMapper(const vtkVolumeProMapper&); // Not implemented.
376  void operator=(const vtkVolumeProMapper&); // Not implemented.
377 };
378 
380 
382 {
383  switch ( this->BlendMode )
384  {
386  return "Composite";
388  return "Maximum Intensity";
390  return "Minimum Intensity";
391  default:
392  return "Unknown Blend Mode";
393  }
394 }
396 
398 
400 {
401  switch ( this->CursorType )
402  {
404  return "Crosshair";
406  return "Plane";
407  default:
408  return "Unknown Cursor Type";
409  }
410 }
412 
413 #endif
414