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

Rendering/vtkUnstructuredGridVolumeRayCastMapper.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkUnstructuredGridVolumeRayCastMapper.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 
00035 #ifndef __vtkUnstructuredGridVolumeRayCastMapper_h
00036 #define __vtkUnstructuredGridVolumeRayCastMapper_h
00037 
00038 #include "vtkUnstructuredGridVolumeMapper.h"
00039 
00040 class vtkMultiThreader;
00041 class vtkRenderer;
00042 class vtkTimerLog;
00043 class vtkVolume;
00044 class vtkUnstructuredGridBunykRayCastFunction;
00045 class vtkRayCastImageDisplayHelper;
00046 
00047 class VTK_RENDERING_EXPORT vtkUnstructuredGridVolumeRayCastMapper : public vtkUnstructuredGridVolumeMapper
00048 {
00049 public:
00050   static vtkUnstructuredGridVolumeRayCastMapper *New();
00051   vtkTypeRevisionMacro(vtkUnstructuredGridVolumeRayCastMapper,vtkUnstructuredGridVolumeMapper);
00052   void PrintSelf( ostream& os, vtkIndent indent );
00053 
00055 
00058   vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
00059   vtkGetMacro( ImageSampleDistance, float );
00061 
00063 
00065   vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
00066   vtkGetMacro( MinimumImageSampleDistance, float );
00068 
00070 
00072   vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
00073   vtkGetMacro( MaximumImageSampleDistance, float );
00075 
00077 
00080   vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
00081   vtkGetMacro( AutoAdjustSampleDistances, int );
00082   vtkBooleanMacro( AutoAdjustSampleDistances, int );
00084   
00086 
00088   void SetNumberOfThreads( int num );
00089   vtkGetMacro( NumberOfThreads, int );
00091 
00093 
00095   vtkSetClampMacro( IntermixIntersectingGeometry, int, 0, 1 );
00096   vtkGetMacro( IntermixIntersectingGeometry, int );
00097   vtkBooleanMacro( IntermixIntersectingGeometry, int );
00099   
00100 //BTX
00103   void Render( vtkRenderer *, vtkVolume * );
00104 
00109   void ReleaseGraphicsResources(vtkWindow *);
00110   
00111   vtkGetVectorMacro( ImageInUseSize, int, 2 );
00112   vtkGetVectorMacro( ImageOrigin, int, 2 );
00113   vtkGetVectorMacro( ImageViewportSize, int , 2 );
00114   
00115 //ETX
00116   
00117   void CastRays( int threadID, int threadCount );
00118 
00119 protected:
00120   vtkUnstructuredGridVolumeRayCastMapper();
00121   ~vtkUnstructuredGridVolumeRayCastMapper();
00122 
00123   float                        ImageSampleDistance;
00124   float                        MinimumImageSampleDistance;
00125   float                        MaximumImageSampleDistance;
00126   int                          AutoAdjustSampleDistances;
00127   
00128   vtkMultiThreader  *Threader;
00129   int               NumberOfThreads;
00130 
00131   vtkRayCastImageDisplayHelper *ImageDisplayHelper;
00132   
00133   // This is how big the image would be if it covered the entire viewport
00134   int            ImageViewportSize[2];
00135   
00136   // This is how big the allocated memory for image is. This may be bigger
00137   // or smaller than ImageFullSize - it will be bigger if necessary to 
00138   // ensure a power of 2, it will be smaller if the volume only covers a
00139   // small region of the viewport
00140   int            ImageMemorySize[2];
00141   
00142   // This is the size of subregion in ImageSize image that we are using for
00143   // the current image. Since ImageSize is a power of 2, there is likely
00144   // wasted space in it. This number will be used for things such as clearing
00145   // the image if necessary.
00146   int            ImageInUseSize[2];
00147   
00148   // This is the location in ImageFullSize image where our ImageSize image
00149   // is located.
00150   int            ImageOrigin[2];
00151   
00152   // This is the allocated image
00153   unsigned char *Image;
00154   
00155   float        *RenderTimeTable;
00156   vtkVolume   **RenderVolumeTable;
00157   vtkRenderer **RenderRendererTable;
00158   int           RenderTableSize;
00159   int           RenderTableEntries;
00160 
00161   void StoreRenderTime( vtkRenderer *ren, vtkVolume *vol, float t );
00162   float RetrieveRenderTime( vtkRenderer *ren, vtkVolume *vol );
00163 
00164   int           IntermixIntersectingGeometry;
00165 
00166   float        *ZBuffer;
00167   int           ZBufferSize[2];
00168   int           ZBufferOrigin[2];
00169 
00170   // Get the ZBuffer value corresponding to location (x,y) where (x,y)
00171   // are indexing into the ImageInUse image. This must be converted to
00172   // the zbuffer image coordinates. Nearest neighbor value is returned.
00173   double         GetZBufferValue( int x, int y );
00174 
00175   double         GetMinimumBoundsDepth( vtkRenderer *ren,
00176                                        vtkVolume   *vol );
00177   
00178   vtkUnstructuredGridBunykRayCastFunction *BunykFunction;
00179 
00180   vtkVolume     *CurrentVolume;
00181   vtkRenderer   *CurrentRenderer;
00182   
00183   
00184 private:
00185   vtkUnstructuredGridVolumeRayCastMapper(const vtkUnstructuredGridVolumeRayCastMapper&);  // Not implemented.
00186   void operator=(const vtkUnstructuredGridVolumeRayCastMapper&);  // Not implemented.
00187 };
00188 
00189 #endif
00190