OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / include / vtk / vtkVolumeRayCastFunction.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkVolumeRayCastFunction.h,v $
5   Language:  C++
6   Date:      $Date: 2002/10/28 21:33:01 $
7   Version:   $Revision: 1.29 $
8
9   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
10   All rights reserved.
11   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12
13      This software is distributed WITHOUT ANY WARRANTY; without even 
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15      PURPOSE.  See the above copyright notice for more information.
16
17 =========================================================================*/
18
19 // .NAME vtkVolumeRayCastFunction - a superclass for ray casting functions
20
21 // .SECTION Description
22 // vtkVolumeRayCastFunction is a superclass for ray casting functions that 
23 // can be used within a vtkVolumeRayCastMapper. This includes for example,
24 // vtkVolumeRayCastCompositeFunction, vtkVolumeRayCastMIPFunction, and
25 // vtkVolumeRayCastIsosurfaceFunction.
26
27 // .SECTION See Also
28 // vtkVolumeRayCastCompositeFunction vtkVolumeRayCastMIPFunction
29 // vtkVolumeRayCastIsosurfaceFunction vtkVolumeRayCastMapper
30
31 #ifndef __vtkVolumeRayCastFunction_h
32 #define __vtkVolumeRayCastFunction_h
33
34 #include "vtkObject.h"
35
36 class vtkRenderer;
37 class vtkVolume;
38 class vtkVolumeRayCastMapper;
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
57   int                          NumberOfStepsToTake;
58   
59   // The number of steps we actually take if this is
60   // a ray caster that takes steps
61   int                          NumberOfStepsTaken;
62
63 } vtkVolumeRayCastDynamicInfo;
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
70   vtkVolume                   *Volume;
71
72   // A pointer to the renderer
73   vtkRenderer                 *Renderer;
74   
75   // Matrices for switching from view to volume coordinate, and back
76   float                        WorldToVoxelsMatrix[16];
77   float                        VoxelsToWorldMatrix[16];
78   float                        ViewToVoxelsMatrix[16];
79
80   float                       *ClippingPlane;
81   int                          NumberOfClippingPlanes;
82   
83   // The camera thickness (distance between near and far) is necessary 
84   // for computing sampling distance
85   float                        CameraThickness;
86
87   // The type of the data and a pointer to it, and the information
88   // about its size, spacing, origin and precomputed increment
89   int                          ScalarDataType;
90   void                        *ScalarDataPointer;
91   int                          DataIncrement[3];
92   int                          DataSize[3];
93   float                        DataSpacing[3];
94   float                        DataOrigin[3];
95
96   // Information from the vtkVolumeProperty
97   int                          Shading;
98   int                          ColorChannels;
99   float                        Color[3];
100   int                          InterpolationType;
101
102   // The shading tables from the vtkEncodedGradientShader
103   // that will be used for shading the volume.
104   float                       *RedDiffuseShadingTable;
105   float                       *GreenDiffuseShadingTable;
106   float                       *BlueDiffuseShadingTable;
107   float                       *RedSpecularShadingTable;
108   float                       *GreenSpecularShadingTable;
109   float                       *BlueSpecularShadingTable;
110
111   // Info needed from the gradient estimator
112   unsigned short               *EncodedNormals;
113   unsigned char                *GradientMagnitudes;
114
115   // Image information
116   int                          ImageInUseSize[2];
117   int                          ImageMemorySize[2];
118   int                          ImageViewportSize[2];
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
129   int                          MIPFunction;
130   int                          MaximizeOpacity;
131 } vtkVolumeRayCastStaticInfo;
132
133 class VTK_RENDERING_EXPORT vtkVolumeRayCastFunction : public vtkObject
134 {
135 public:
136   vtkTypeRevisionMacro(vtkVolumeRayCastFunction,vtkObject);
137   virtual void PrintSelf(ostream& os, vtkIndent indent);
138
139   // Description:
140   // Do the basic initialization. This includes saving the parameters
141   // passed in into local variables, as well as grabbing some useful
142   // info from the volume property and normal encoder. This initialize
143   // routine is called once per render. It also calls the 
144   // SpecificFunctionInitialize of the subclass function.
145 //BTX
146   void FunctionInitialize( vtkRenderer *ren,
147                            vtkVolume   *vol,
148                            vtkVolumeRayCastStaticInfo *staticInfo );
149
150   virtual void CastRay( vtkVolumeRayCastDynamicInfo *dynamicInfo,
151                         vtkVolumeRayCastStaticInfo *staticInfo )=0;
152 //ETX
153
154   // Description:
155   // Get the value below which all scalar values are considered to
156   // have 0 opacity.
157   virtual float GetZeroOpacityThreshold( vtkVolume *vol )=0;
158
159 protected:
160   vtkVolumeRayCastFunction() {};
161   ~vtkVolumeRayCastFunction() {};
162
163   // Description:
164   // This method gives the subclass a chance to do any special
165   // initialization that it may need to do
166 //BTX
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 };
176
177 #endif