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 
32 #ifndef vtkVolumeRayCastFunction_h
33 #define vtkVolumeRayCastFunction_h
34 
35 #include "vtkRenderingVolumeModule.h" // For export macro
36 #include "vtkObject.h"
37 
38 class vtkRenderer;
39 class vtkVolume;
41 
42 #if !defined(VTK_LEGACY_REMOVE)
43 // Define a couple of structures we need to hold all the important information
44 // This first structure hold the dynamic information - stuff that changes per
45 // ray
46 typedef struct
47 {
48  // These are the return values - RGBA
49  float Color[4];
50  float ScalarValue;
51 
52  // Ray information transformed into local coordinates
53  float TransformedStart[4];
54  float TransformedEnd[4];
55  float TransformedDirection[4];
56  float TransformedIncrement[3];
57 
58  // The number of steps we want to take if this is
59  // a ray caster that takes steps
61 
62  // The number of steps we actually take if this is
63  // a ray caster that takes steps
65 
67 
68 // This second structure hold the static information - things that don't
69 // change over the whole image
70 typedef struct
71 {
72  // A pointer to the volume
74 
75  // A pointer to the renderer
77 
78  // Matrices for switching from view to volume coordinate, and back
81  float ViewToVoxelsMatrix[16];
82 
83  float *ClippingPlane;
85 
86  // The camera thickness (distance between near and far) is necessary
87  // for computing sampling distance
89 
90  // The type of the data and a pointer to it, and the information
91  // about its size, spacing, origin and precomputed increment
94  vtkIdType DataIncrement[3];
95  int DataSize[3];
96  double DataSpacing[3];
97  double DataOrigin[3];
98 
99  // Information from the vtkVolumeProperty
100  int Shading;
102  float Color[3];
104 
105  // The shading tables from the vtkEncodedGradientShader
106  // that will be used for shading the volume.
113 
114  // Info needed from the gradient estimator
115  unsigned short *EncodedNormals;
116  unsigned char *GradientMagnitudes;
117 
118  // Image information
122  int ImageOrigin[2];
123  unsigned char *Image;
124 
125  int *RowBounds;
126 
127  // Is a MIP ray cast function in use? This will control
128  // how subsegments of the ray are combined when non-subvolume
129  // cropping is used. If maximize opacity is used, the color[3]
130  // value is used to find the max othersize the dynamicInfo->ScalarValue
131  // value is used
135 
136 class VTKRENDERINGVOLUME_EXPORT vtkVolumeRayCastFunction : public vtkObject
137 {
138 public:
140  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
141 
149  void FunctionInitialize( vtkRenderer *ren,
150  vtkVolume *vol,
151  vtkVolumeRayCastStaticInfo *staticInfo );
152 
153  virtual void CastRay( vtkVolumeRayCastDynamicInfo *dynamicInfo,
154  vtkVolumeRayCastStaticInfo *staticInfo )=0;
155 
160  virtual float GetZeroOpacityThreshold( vtkVolume *vol )=0;
161 
162 protected:
164  {
165  VTK_LEGACY_BODY(vtkVolumeRayCastMapper::vtkVolumeRayCastMapper,"VTK 7.0");
166  }
168 
173  virtual void SpecificFunctionInitialize( vtkRenderer *ren,
174  vtkVolume *vol,
175  vtkVolumeRayCastStaticInfo *staticInfo,
176  vtkVolumeRayCastMapper *mapper )=0;
177 
178 private:
179  vtkVolumeRayCastFunction(const vtkVolumeRayCastFunction&) VTK_DELETE_FUNCTION;
180  void operator=(const vtkVolumeRayCastFunction&) VTK_DELETE_FUNCTION;
181 };
182 #endif // VTK_LEGACY_REMOVE
183 #endif
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
abstract specification for renderers
Definition: vtkRenderer.h:63
int vtkIdType
Definition: vtkType.h:287
a simple class to control print indentation
Definition: vtkIndent.h:39
a superclass for ray casting functions
A slow but accurate mapper for rendering volumes.