VTK
vtkVolumeRayCastFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVolumeRayCastFunction.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 =========================================================================*/
15 
30 #ifndef vtkVolumeRayCastFunction_h
31 #define vtkVolumeRayCastFunction_h
32 
33 #include "vtkRenderingVolumeModule.h" // For export macro
34 #include "vtkObject.h"
35 
36 class vtkRenderer;
37 class vtkVolume;
39 
40 // Define a couple of structures we need to hold all the important information
41 // This first structure hold the dynamic information - stuff that changes per
42 // ray
43 typedef struct
44 {
45  // These are the return values - RGBA
46  float Color[4];
47  float ScalarValue;
48 
49  // Ray information transformed into local coordinates
50  float TransformedStart[4];
51  float TransformedEnd[4];
52  float TransformedDirection[4];
53  float TransformedIncrement[3];
54 
55  // The number of steps we want to take if this is
56  // a ray caster that takes steps
58 
59  // The number of steps we actually take if this is
60  // a ray caster that takes steps
62 
64 
65 // This second structure hold the static information - things that don't
66 // change over the whole image
67 typedef struct
68 {
69  // A pointer to the volume
71 
72  // A pointer to the renderer
74 
75  // Matrices for switching from view to volume coordinate, and back
78  float ViewToVoxelsMatrix[16];
79 
80  float *ClippingPlane;
82 
83  // The camera thickness (distance between near and far) is necessary
84  // for computing sampling distance
86 
87  // The type of the data and a pointer to it, and the information
88  // about its size, spacing, origin and precomputed increment
91  vtkIdType DataIncrement[3];
92  int DataSize[3];
93  double DataSpacing[3];
94  double DataOrigin[3];
95 
96  // Information from the vtkVolumeProperty
97  int Shading;
99  float Color[3];
101 
102  // The shading tables from the vtkEncodedGradientShader
103  // that will be used for shading the volume.
110 
111  // Info needed from the gradient estimator
112  unsigned short *EncodedNormals;
113  unsigned char *GradientMagnitudes;
114 
115  // Image information
119  int ImageOrigin[2];
120  unsigned char *Image;
121 
122  int *RowBounds;
123 
124  // Is a MIP ray cast function in use? This will control
125  // how subsegments of the ray are combined when non-subvolume
126  // cropping is used. If maximize opacity is used, the color[3]
127  // value is used to find the max othersize the dynamicInfo->ScalarValue
128  // value is used
132 
134 {
135 public:
137  virtual void PrintSelf(ostream& os, vtkIndent indent);
138 
139 //BTX
141 
146  void FunctionInitialize( vtkRenderer *ren,
147  vtkVolume *vol,
148  vtkVolumeRayCastStaticInfo *staticInfo );
150 
151  virtual void CastRay( vtkVolumeRayCastDynamicInfo *dynamicInfo,
152  vtkVolumeRayCastStaticInfo *staticInfo )=0;
153 //ETX
154 
157  virtual float GetZeroOpacityThreshold( vtkVolume *vol )=0;
158 
159 protected:
162 
163 //BTX
165 
167  virtual void SpecificFunctionInitialize( vtkRenderer *ren,
168  vtkVolume *vol,
169  vtkVolumeRayCastStaticInfo *staticInfo,
170  vtkVolumeRayCastMapper *mapper )=0;
171 //ETX
172 private:
173  vtkVolumeRayCastFunction(const vtkVolumeRayCastFunction&); // Not implemented.
174  void operator=(const vtkVolumeRayCastFunction&); // Not implemented.
175 };
177 
178 #endif
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:49
abstract base class for most VTK objects
Definition: vtkObject.h:61
#define VTKRENDERINGVOLUME_EXPORT
abstract specification for renderers
Definition: vtkRenderer.h:63
int vtkIdType
Definition: vtkType.h:275
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
a superclass for ray casting functions
A slow but accurate mapper for rendering volumes.