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

graphics/vtkVolumeRayCastMapper.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkVolumeRayCastMapper.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 
00055 #ifndef __vtkVolumeRayCastMapper_h
00056 #define __vtkVolumeRayCastMapper_h
00057 
00058 #include "vtkVolumeMapper.h"
00059 #include "vtkMultiThreader.h"
00060 #include "vtkVolumeRayCastFunction.h"
00061 #include "vtkRayBounder.h"
00062 #include "vtkEncodedGradientShader.h"
00063 #include "vtkEncodedGradientEstimator.h"
00064 
00065 class vtkRenderer;
00066 class vtkVolume;
00067 class vtkVolumeTransform;
00068 class vtkPlaneCollection;
00069 
00070 // Macro for floor of x
00071 #define vtkFloorFuncMacro(x)   (((x) < 0.0)?((int)((x)-1.0)):((int)(x)))
00072 
00073 // Macro for rounding x
00074 #define vtkRoundFuncMacro(x)   (int)((x)+0.5)
00075 
00076 // Macro for tri-linear interpolation - do four linear interpolations on
00077 // edges, two linear interpolations between pairs of edges, then a final
00078 // interpolation between faces
00079 #define vtkTrilinFuncMacro(v,x,y,z,a,b,c,d,e,f,g,h)         \
00080         t00 =   a + (x)*(b-a);      \
00081         t01 =   c + (x)*(d-c);      \
00082         t10 =   e + (x)*(f-e);      \
00083         t11 =   g + (x)*(h-g);      \
00084         t0  = t00 + (y)*(t01-t00);  \
00085         t1  = t10 + (y)*(t11-t10);  \
00086         v   =  t0 + (z)*(t1-t0);
00087 
00088 class VTK_EXPORT vtkVolumeRayCastMapper : public vtkVolumeMapper
00089 {
00090 public:
00091   static vtkVolumeRayCastMapper *New();
00092   vtkTypeMacro(vtkVolumeRayCastMapper,vtkVolumeMapper);
00093   void PrintSelf( ostream& os, vtkIndent index );
00094 
00101   vtkSetMacro( SampleDistance, float );
00102   vtkGetMacro( SampleDistance, float );
00103 
00106   vtkSetObjectMacro( RayBounder, vtkRayBounder );
00107   vtkGetObjectMacro( RayBounder, vtkRayBounder );
00108 
00111   vtkSetObjectMacro( VolumeRayCastFunction, vtkVolumeRayCastFunction );
00112   vtkGetObjectMacro( VolumeRayCastFunction, vtkVolumeRayCastFunction );
00113 
00115   void SetGradientEstimator( vtkEncodedGradientEstimator *gradest );
00116   vtkGetObjectMacro( GradientEstimator, vtkEncodedGradientEstimator );
00117 
00119   vtkGetObjectMacro( GradientShader, vtkEncodedGradientShader );
00120 
00121 //BTX
00124   void Render( vtkRenderer *, vtkVolume * ) {};
00125 
00127   void InitializeRender( vtkRenderer *ren, vtkVolume *vol,
00128           VTKRayCastVolumeInfo *volumeInfo );
00129 
00134   void ReleaseGraphicsResources(vtkWindow *);
00135 
00138   float GetZeroOpacityThreshold( vtkVolume *vol );
00139 
00141   void CastViewRay( VTKRayCastRayInfo *rayInfo,
00142           VTKRayCastVolumeInfo *volumeInfo );
00143 
00145   int GetMapperType() { return VTK_RAYCAST_VOLUME_MAPPER; };
00146 
00149   virtual int IsARayCastMapper() {return 1;};
00150 
00153   virtual float GetGradientMagnitudeScale();
00154   virtual float GetGradientMagnitudeBias();
00155   
00156 //ETX
00157 
00158 protected:
00159   vtkVolumeRayCastMapper();
00160   ~vtkVolumeRayCastMapper();
00161   vtkVolumeRayCastMapper(const vtkVolumeRayCastMapper&) {};
00162   void operator=(const vtkVolumeRayCastMapper&) {};
00163 
00164   vtkVolumeRayCastFunction     *VolumeRayCastFunction;
00165   vtkEncodedGradientEstimator  *GradientEstimator;
00166   vtkEncodedGradientShader     *GradientShader;
00167 
00168   // The distance between sample points along the ray
00169   float                        SampleDistance;
00170 
00171   float                        WorldSampleDistance;
00172   int                          ScalarDataType;
00173   void                         *ScalarDataPointer;
00174   float                        *DepthRangeBufferPointer;
00175 
00176   int                          ClipRayAgainstVolume( 
00177                  VTKRayCastRayInfo *rayInfo,
00178                  VTKRayCastVolumeInfo *volumeInfo,
00179                  float bounds[6] );
00180 
00181   int                          ClipRayAgainstClippingPlanes( 
00182                  VTKRayCastRayInfo *rayInfo,
00183                  VTKRayCastVolumeInfo *volumeInfo,
00184                  vtkPlaneCollection *planes );
00185 
00186   void                         GeneralImageInitialization( vtkRenderer *ren, 
00187                         vtkVolume *vol );
00188 
00189   void                         UpdateShadingTables( vtkRenderer *ren, 
00190                       vtkVolume *vol );
00191 
00192   vtkRayBounder                *RayBounder;
00193 
00194   float                        RayStart[3];
00195   float                        RayEnd[3];
00196   int                          RayPixel[2];
00197   float                        RayColor[4];
00198   float                        VolumeBounds[6];
00199   float                        WorldToVolumeMatrix[16];
00200   float                        VolumeToWorldMatrix[16];
00201   float                        ViewToVolumeMatrix[16];
00202 };
00203 
00204 #endif
00205 

Generated on Wed Nov 21 12:27:04 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001