VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkFixedPointRayCastImage.h 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 00032 #ifndef __vtkFixedPointRayCastImage_h 00033 #define __vtkFixedPointRayCastImage_h 00034 00035 #include "vtkRenderingVolumeModule.h" // For export macro 00036 #include "vtkObject.h" 00037 00038 class VTKRENDERINGVOLUME_EXPORT vtkFixedPointRayCastImage : public vtkObject 00039 { 00040 public: 00041 static vtkFixedPointRayCastImage *New(); 00042 vtkTypeMacro(vtkFixedPointRayCastImage,vtkObject); 00043 virtual void PrintSelf(ostream& os, vtkIndent indent); 00044 00048 unsigned short *GetImage() {return this->Image;} 00049 00051 00053 vtkSetVector2Macro( ImageViewportSize, int ); 00054 vtkGetVectorMacro( ImageViewportSize, int, 2 ); 00056 00058 00062 vtkSetVector2Macro( ImageMemorySize, int ); 00063 vtkGetVectorMacro( ImageMemorySize, int, 2 ); 00065 00067 00071 vtkSetVector2Macro( ImageInUseSize, int ); 00072 vtkGetVectorMacro( ImageInUseSize, int, 2 ); 00074 00076 00081 vtkSetVector2Macro( ImageOrigin, int ); 00082 vtkGetVectorMacro( ImageOrigin, int, 2 ); 00084 00086 00090 vtkSetMacro( ImageSampleDistance, float ); 00091 vtkGetMacro( ImageSampleDistance, float ); 00093 00096 void AllocateImage(); 00097 00099 void ClearImage(); 00100 00102 00107 vtkSetVector2Macro( ZBufferSize, int ); 00108 vtkGetVectorMacro( ZBufferSize, int, 2 ); 00110 00112 00118 vtkSetVector2Macro( ZBufferOrigin, int ); 00119 vtkGetVectorMacro( ZBufferOrigin, int, 2 ); 00121 00123 00127 vtkSetClampMacro( UseZBuffer, int, 0, 1 ); 00128 vtkGetMacro( UseZBuffer, int ); 00129 vtkBooleanMacro( UseZBuffer, int ); 00131 00136 float GetZBufferValue( int x, int y ); 00137 00141 float *GetZBuffer() {return this->ZBuffer;} 00142 00143 // Descipriotn: 00144 // Allocate the space for the ZBuffer according to the size. 00145 void AllocateZBuffer(); 00146 00147 protected: 00148 vtkFixedPointRayCastImage(); 00149 ~vtkFixedPointRayCastImage(); 00150 00151 // This is how big the image would be if it covered the entire viewport 00152 int ImageViewportSize[2]; 00153 00154 // This is how big the allocated memory for image is. This may be bigger 00155 // or smaller than ImageFullSize - it will be bigger if necessary to 00156 // ensure a power of 2, it will be smaller if the volume only covers a 00157 // small region of the viewport 00158 int ImageMemorySize[2]; 00159 00160 // This is the size of subregion in ImageSize image that we are using for 00161 // the current image. Since ImageSize is a power of 2, there is likely 00162 // wasted space in it. This number will be used for things such as clearing 00163 // the image if necessary. 00164 int ImageInUseSize[2]; 00165 00166 // This is the location in ImageFullSize image where our ImageSize image 00167 // is located. 00168 int ImageOrigin[2]; 00169 00170 // This is a copy of the ImageSampleDistance from the mapper - copied here 00171 // in order to share among all mappers contributing to this image 00172 float ImageSampleDistance; 00173 00174 // This is the allocated image 00175 unsigned short *Image; 00176 00177 // This is the size of the zbuffer in pixels 00178 int ZBufferSize[2]; 00179 00180 // This is the size of the memory for the zbuffer - this can be 00181 // bigger than the size of the zbuffer since we will allocate enough 00182 // space for the whole viewport to avoid re-allocating over and over 00183 int ZBufferMemorySize; 00184 00185 // This is the distance from the lower left corner of the viewport 00186 // where the ZBuffer starts 00187 int ZBufferOrigin[2]; 00188 00189 // This is the flag that indicate whether the ZBuffer is in use 00190 int UseZBuffer; 00191 00192 // This is the actual ZBuffer data in floats 00193 float *ZBuffer; 00194 00195 00196 private: 00197 vtkFixedPointRayCastImage(const vtkFixedPointRayCastImage&); // Not implemented. 00198 void operator=(const vtkFixedPointRayCastImage&); // Not implemented. 00199 }; 00200 00201 #endif 00202 00203 00204 00205 00206