Rendering/vtkVolumeRayCastFunction.h Source File

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