Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Rendering/vtkVolumeRayCastFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkVolumeRayCastFunction.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00040 
00058 #ifndef __vtkVolumeRayCastFunction_h
00059 #define __vtkVolumeRayCastFunction_h
00060 
00061 #include "vtkObject.h"
00062 
00063 class vtkRenderer;
00064 class vtkVolume;
00065 class vtkVolumeRayCastMapper;
00066 
00067 // Define a couple of structures we need to hold all the important information
00068 // This first structure hold the dynamic information - stuff that changes per 
00069 // ray
00070 typedef struct 
00071 {
00072   // These are the return values - RGBA
00073   float Color[4];
00074   float ScalarValue;
00075 
00076   // Ray information transformed into local coordinates
00077   float                        TransformedStart[4];
00078   float                        TransformedEnd[4];
00079   float                        TransformedDirection[4];
00080   float                        TransformedIncrement[3];
00081   
00082   // The number of steps we want to take if this is
00083   // a ray caster that takes steps
00084   int                          NumberOfStepsToTake;
00085   
00086   // The number of steps we actually take if this is
00087   // a ray caster that takes steps
00088   int                          NumberOfStepsTaken;
00089 
00090 } VTKVRCDynamicInfo;
00091 
00092 // This second structure hold the static information - things that don't
00093 // change over the whole image
00094 typedef struct 
00095 {
00096   // A pointer to the volume
00097   vtkVolume                   *Volume;
00098 
00099   // A pointer to the renderer
00100   vtkRenderer                 *Renderer;
00101   
00102   // Matrices for switching from view to volume coordinate, and back
00103   float                        WorldToVoxelsMatrix[16];
00104   float                        VoxelsToWorldMatrix[16];
00105   float                        ViewToVoxelsMatrix[16];
00106 
00107   float                       *ClippingPlane;
00108   int                          NumberOfClippingPlanes;
00109   
00110   // The camera thickness (distance between near and far) is necessary 
00111   // for computing sampling distance
00112   float                        CameraThickness;
00113 
00114   // The type of the data and a pointer to it, and the information
00115   // about its size, spacing, origin and precomputed increment
00116   int                          ScalarDataType;
00117   void                        *ScalarDataPointer;
00118   int                          DataIncrement[3];
00119   int                          DataSize[3];
00120   float                        DataSpacing[3];
00121   float                        DataOrigin[3];
00122 
00123   // Information from the vtkVolumeProperty
00124   int                          Shading;
00125   int                          ColorChannels;
00126   float                        Color[3];
00127   int                          InterpolationType;
00128   float                        RGBTextureCoefficient;
00129 
00130   // The shading tables from the vtkEncodedGradientShader
00131   // that will be used for shading the volume.
00132   float                       *RedDiffuseShadingTable;
00133   float                       *GreenDiffuseShadingTable;
00134   float                       *BlueDiffuseShadingTable;
00135   float                       *RedSpecularShadingTable;
00136   float                       *GreenSpecularShadingTable;
00137   float                       *BlueSpecularShadingTable;
00138 
00139   // Info needed to do solid textures - a pointer to the texture
00140   // and info about its size, spacing, origin, and precomputed 
00141   // increments
00142   unsigned char               *RGBDataPointer;
00143   int                          RGBDataIncrement[3];
00144   int                          RGBDataSize[3];
00145   float                        RGBDataSpacing[3];
00146   float                        RGBDataOrigin[3];
00147 
00148   // Info needed from the gradient estimator
00149   unsigned short               *EncodedNormals;
00150   unsigned char                *GradientMagnitudes;
00151 
00152   // Image information
00153   int                          ImageInUseSize[2];
00154   int                          ImageMemorySize[2];
00155   int                          ImageViewportSize[2];
00156   int                          ImageOrigin[2];
00157   unsigned char               *Image;
00158   
00159   int                         *RowBounds;
00160 
00161   // Is a MIP ray cast function in use? This will control
00162   // how subsegments of the ray are combined when non-subvolume 
00163   // cropping is used. If maximize opacity is used, the color[3] 
00164   // value is used to find the max othersize the dynamicInfo->ScalarValue
00165   // value is used
00166   int                          MIPFunction;
00167   int                          MaximizeOpacity;
00168 } VTKVRCStaticInfo;
00169 
00170 class VTK_RENDERING_EXPORT vtkVolumeRayCastFunction : public vtkObject
00171 {
00172 public:
00173   vtkTypeMacro(vtkVolumeRayCastFunction,vtkObject);
00174 
00176 
00181   void FunctionInitialize( vtkRenderer *ren,
00182                            vtkVolume   *vol,
00183                            VTKVRCStaticInfo *staticInfo );
00185 
00186   virtual void CastRay( VTKVRCDynamicInfo *dynamicInfo,
00187                         VTKVRCStaticInfo *staticInfo )=0;
00188 //ETX
00189 
00192   virtual float GetZeroOpacityThreshold( vtkVolume *vol )=0;
00193 
00194 protected:
00195   vtkVolumeRayCastFunction() {};
00196   ~vtkVolumeRayCastFunction() {};
00197 
00199 
00201   virtual void SpecificFunctionInitialize( vtkRenderer *ren,
00202                                            vtkVolume   *vol,
00203                                            VTKVRCStaticInfo *staticInfo,
00204                                            vtkVolumeRayCastMapper *mapper )=0;
00206 //ETX
00207 private:
00208   vtkVolumeRayCastFunction(const vtkVolumeRayCastFunction&);  // Not implemented.
00209   void operator=(const vtkVolumeRayCastFunction&);  // Not implemented.
00210 };
00211 
00212 #endif

Generated on Thu Mar 28 14:19:34 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001