Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkVolumeRayCastFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkVolumeRayCastFunction.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 
00030 #ifndef __vtkVolumeRayCastFunction_h
00031 #define __vtkVolumeRayCastFunction_h
00032 
00033 #include "vtkObject.h"
00034 
00035 class vtkRenderer;
00036 class vtkVolume;
00037 class vtkVolumeRayCastMapper;
00038 
00039 // Define a couple of structures we need to hold all the important information
00040 // This first structure hold the dynamic information - stuff that changes per 
00041 // ray
00042 typedef struct 
00043 {
00044   // These are the return values - RGBA
00045   float Color[4];
00046   float ScalarValue;
00047 
00048   // Ray information transformed into local coordinates
00049   float                        TransformedStart[4];
00050   float                        TransformedEnd[4];
00051   float                        TransformedDirection[4];
00052   float                        TransformedIncrement[3];
00053   
00054   // The number of steps we want to take if this is
00055   // a ray caster that takes steps
00056   int                          NumberOfStepsToTake;
00057   
00058   // The number of steps we actually take if this is
00059   // a ray caster that takes steps
00060   int                          NumberOfStepsTaken;
00061 
00062 } vtkVolumeRayCastDynamicInfo;
00063 
00064 // This second structure hold the static information - things that don't
00065 // change over the whole image
00066 typedef struct 
00067 {
00068   // A pointer to the volume
00069   vtkVolume                   *Volume;
00070 
00071   // A pointer to the renderer
00072   vtkRenderer                 *Renderer;
00073   
00074   // Matrices for switching from view to volume coordinate, and back
00075   float                        WorldToVoxelsMatrix[16];
00076   float                        VoxelsToWorldMatrix[16];
00077   float                        ViewToVoxelsMatrix[16];
00078 
00079   float                       *ClippingPlane;
00080   int                          NumberOfClippingPlanes;
00081   
00082   // The camera thickness (distance between near and far) is necessary 
00083   // for computing sampling distance
00084   float                        CameraThickness;
00085 
00086   // The type of the data and a pointer to it, and the information
00087   // about its size, spacing, origin and precomputed increment
00088   int                          ScalarDataType;
00089   void                        *ScalarDataPointer;
00090   int                          DataIncrement[3];
00091   int                          DataSize[3];
00092   double                       DataSpacing[3];
00093   double                       DataOrigin[3];
00094 
00095   // Information from the vtkVolumeProperty
00096   int                          Shading;
00097   int                          ColorChannels;
00098   float                        Color[3];
00099   int                          InterpolationType;
00100 
00101   // The shading tables from the vtkEncodedGradientShader
00102   // that will be used for shading the volume.
00103   float                       *RedDiffuseShadingTable;
00104   float                       *GreenDiffuseShadingTable;
00105   float                       *BlueDiffuseShadingTable;
00106   float                       *RedSpecularShadingTable;
00107   float                       *GreenSpecularShadingTable;
00108   float                       *BlueSpecularShadingTable;
00109 
00110   // Info needed from the gradient estimator
00111   unsigned short               *EncodedNormals;
00112   unsigned char                *GradientMagnitudes;
00113 
00114   // Image information
00115   int                          ImageInUseSize[2];
00116   int                          ImageMemorySize[2];
00117   int                          ImageViewportSize[2];
00118   int                          ImageOrigin[2];
00119   unsigned char               *Image;
00120   
00121   int                         *RowBounds;
00122 
00123   // Is a MIP ray cast function in use? This will control
00124   // how subsegments of the ray are combined when non-subvolume 
00125   // cropping is used. If maximize opacity is used, the color[3] 
00126   // value is used to find the max othersize the dynamicInfo->ScalarValue
00127   // value is used
00128   int                          MIPFunction;
00129   int                          MaximizeOpacity;
00130 } vtkVolumeRayCastStaticInfo;
00131 
00132 class VTK_VOLUMERENDERING_EXPORT vtkVolumeRayCastFunction : public vtkObject
00133 {
00134 public:
00135   vtkTypeRevisionMacro(vtkVolumeRayCastFunction,vtkObject);
00136   virtual void PrintSelf(ostream& os, vtkIndent indent);
00137 
00139 
00144   void FunctionInitialize( vtkRenderer *ren,
00145                            vtkVolume   *vol,
00146                            vtkVolumeRayCastStaticInfo *staticInfo );
00148 
00149   virtual void CastRay( vtkVolumeRayCastDynamicInfo *dynamicInfo,
00150                         vtkVolumeRayCastStaticInfo *staticInfo )=0;
00151 //ETX
00152 
00155   virtual float GetZeroOpacityThreshold( vtkVolume *vol )=0;
00156 
00157 protected:
00158   vtkVolumeRayCastFunction() {};
00159   ~vtkVolumeRayCastFunction() {};
00160 
00162 
00164   virtual void SpecificFunctionInitialize( vtkRenderer *ren,
00165                                            vtkVolume   *vol,
00166                                            vtkVolumeRayCastStaticInfo *staticInfo,
00167                                            vtkVolumeRayCastMapper *mapper )=0;
00169 //ETX
00170 private:
00171   vtkVolumeRayCastFunction(const vtkVolumeRayCastFunction&);  // Not implemented.
00172   void operator=(const vtkVolumeRayCastFunction&);  // Not implemented.
00173 };
00174 
00175 #endif

Generated on Mon Jan 21 23:07:38 2008 for VTK by  doxygen 1.4.3-20050530