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