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

vtkUnstructuredGridVolumeRayCastMapper.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkUnstructuredGridVolumeRayCastMapper.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 
00043 #ifndef __vtkUnstructuredGridVolumeRayCastMapper_h
00044 #define __vtkUnstructuredGridVolumeRayCastMapper_h
00045 
00046 #include "vtkUnstructuredGridVolumeMapper.h"
00047 
00048 class vtkMultiThreader;
00049 class vtkRenderer;
00050 class vtkTimerLog;
00051 class vtkVolume;
00052 class vtkUnstructuredGridVolumeRayCastFunction;
00053 class vtkUnstructuredGridVolumeRayCastIterator;
00054 class vtkUnstructuredGridVolumeRayIntegrator;
00055 class vtkRayCastImageDisplayHelper;
00056 
00057 class VTK_RENDERING_EXPORT vtkUnstructuredGridVolumeRayCastMapper : public vtkUnstructuredGridVolumeMapper
00058 {
00059 public:
00060   static vtkUnstructuredGridVolumeRayCastMapper *New();
00061   vtkTypeRevisionMacro(vtkUnstructuredGridVolumeRayCastMapper,vtkUnstructuredGridVolumeMapper);
00062   void PrintSelf( ostream& os, vtkIndent indent );
00063 
00065 
00068   vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
00069   vtkGetMacro( ImageSampleDistance, float );
00071 
00073 
00075   vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
00076   vtkGetMacro( MinimumImageSampleDistance, float );
00078 
00080 
00082   vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
00083   vtkGetMacro( MaximumImageSampleDistance, float );
00085 
00087 
00090   vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
00091   vtkGetMacro( AutoAdjustSampleDistances, int );
00092   vtkBooleanMacro( AutoAdjustSampleDistances, int );
00094   
00096 
00098   void SetNumberOfThreads( int num );
00099   vtkGetMacro( NumberOfThreads, int );
00101 
00103 
00105   vtkSetClampMacro( IntermixIntersectingGeometry, int, 0, 1 );
00106   vtkGetMacro( IntermixIntersectingGeometry, int );
00107   vtkBooleanMacro( IntermixIntersectingGeometry, int );
00109 
00111 
00112   virtual void SetRayCastFunction(vtkUnstructuredGridVolumeRayCastFunction *f);
00113   vtkGetObjectMacro(RayCastFunction, vtkUnstructuredGridVolumeRayCastFunction);
00115 
00117 
00118   virtual void SetRayIntegrator(vtkUnstructuredGridVolumeRayIntegrator *ri);
00119   vtkGetObjectMacro(RayIntegrator, vtkUnstructuredGridVolumeRayIntegrator);
00121   
00122 //BTX
00125   void Render( vtkRenderer *, vtkVolume * );
00126 
00131   void ReleaseGraphicsResources(vtkWindow *);
00132   
00133   vtkGetVectorMacro( ImageInUseSize, int, 2 );
00134   vtkGetVectorMacro( ImageOrigin, int, 2 );
00135   vtkGetVectorMacro( ImageViewportSize, int , 2 );
00136   
00137 //ETX
00138   
00139   void CastRays( int threadID, int threadCount );
00140 
00141 protected:
00142   vtkUnstructuredGridVolumeRayCastMapper();
00143   ~vtkUnstructuredGridVolumeRayCastMapper();
00144 
00145   float                        ImageSampleDistance;
00146   float                        MinimumImageSampleDistance;
00147   float                        MaximumImageSampleDistance;
00148   int                          AutoAdjustSampleDistances;
00149   
00150   vtkMultiThreader  *Threader;
00151   int               NumberOfThreads;
00152 
00153   vtkRayCastImageDisplayHelper *ImageDisplayHelper;
00154   
00155   // This is how big the image would be if it covered the entire viewport
00156   int            ImageViewportSize[2];
00157   
00158   // This is how big the allocated memory for image is. This may be bigger
00159   // or smaller than ImageFullSize - it will be bigger if necessary to 
00160   // ensure a power of 2, it will be smaller if the volume only covers a
00161   // small region of the viewport
00162   int            ImageMemorySize[2];
00163   
00164   // This is the size of subregion in ImageSize image that we are using for
00165   // the current image. Since ImageSize is a power of 2, there is likely
00166   // wasted space in it. This number will be used for things such as clearing
00167   // the image if necessary.
00168   int            ImageInUseSize[2];
00169   
00170   // This is the location in ImageFullSize image where our ImageSize image
00171   // is located.
00172   int            ImageOrigin[2];
00173   
00174   // This is the allocated image
00175   unsigned char *Image;
00176   
00177   float        *RenderTimeTable;
00178   vtkVolume   **RenderVolumeTable;
00179   vtkRenderer **RenderRendererTable;
00180   int           RenderTableSize;
00181   int           RenderTableEntries;
00182 
00183   void StoreRenderTime( vtkRenderer *ren, vtkVolume *vol, float t );
00184   float RetrieveRenderTime( vtkRenderer *ren, vtkVolume *vol );
00185 
00186   int           IntermixIntersectingGeometry;
00187 
00188   float        *ZBuffer;
00189   int           ZBufferSize[2];
00190   int           ZBufferOrigin[2];
00191 
00192   // Get the ZBuffer value corresponding to location (x,y) where (x,y)
00193   // are indexing into the ImageInUse image. This must be converted to
00194   // the zbuffer image coordinates. Nearest neighbor value is returned.
00195   double         GetZBufferValue( int x, int y );
00196 
00197   double         GetMinimumBoundsDepth( vtkRenderer *ren,
00198                                        vtkVolume   *vol );
00199   
00200   vtkUnstructuredGridVolumeRayCastFunction  *RayCastFunction;
00201   vtkUnstructuredGridVolumeRayCastIterator **RayCastIterators;
00202   vtkUnstructuredGridVolumeRayIntegrator    *RayIntegrator;
00203 
00204   vtkVolume     *CurrentVolume;
00205   vtkRenderer   *CurrentRenderer;
00206   
00207   
00208 private:
00209   vtkUnstructuredGridVolumeRayCastMapper(const vtkUnstructuredGridVolumeRayCastMapper&);  // Not implemented.
00210   void operator=(const vtkUnstructuredGridVolumeRayCastMapper&);  // Not implemented.
00211 };
00212 
00213 #endif
00214