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 "vtkObject.h" 00036 00037 class VTK_VOLUMERENDERING_EXPORT vtkFixedPointRayCastImage : public vtkObject 00038 { 00039 public: 00040 static vtkFixedPointRayCastImage *New(); 00041 vtkTypeMacro(vtkFixedPointRayCastImage,vtkObject); 00042 virtual void PrintSelf(ostream& os, vtkIndent indent); 00043 00047 unsigned short *GetImage() {return this->Image;} 00048 00050 00052 vtkSetVector2Macro( ImageViewportSize, int ); 00053 vtkGetVectorMacro( ImageViewportSize, int, 2 ); 00055 00057 00061 vtkSetVector2Macro( ImageMemorySize, int ); 00062 vtkGetVectorMacro( ImageMemorySize, int, 2 ); 00064 00066 00070 vtkSetVector2Macro( ImageInUseSize, int ); 00071 vtkGetVectorMacro( ImageInUseSize, int, 2 ); 00073 00075 00080 vtkSetVector2Macro( ImageOrigin, int ); 00081 vtkGetVectorMacro( ImageOrigin, int, 2 ); 00083 00085 00089 vtkSetMacro( ImageSampleDistance, float ); 00090 vtkGetMacro( ImageSampleDistance, float ); 00092 00095 void AllocateImage(); 00096 00098 void ClearImage(); 00099 00101 00106 vtkSetVector2Macro( ZBufferSize, int ); 00107 vtkGetVectorMacro( ZBufferSize, int, 2 ); 00109 00111 00117 vtkSetVector2Macro( ZBufferOrigin, int ); 00118 vtkGetVectorMacro( ZBufferOrigin, int, 2 ); 00120 00122 00126 vtkSetClampMacro( UseZBuffer, int, 0, 1 ); 00127 vtkGetMacro( UseZBuffer, int ); 00128 vtkBooleanMacro( UseZBuffer, int ); 00130 00135 float GetZBufferValue( int x, int y ); 00136 00140 float *GetZBuffer() {return this->ZBuffer;} 00141 00142 // Descipriotn: 00143 // Allocate the space for the ZBuffer according to the size. 00144 void AllocateZBuffer(); 00145 00146 protected: 00147 vtkFixedPointRayCastImage(); 00148 ~vtkFixedPointRayCastImage(); 00149 00150 // This is how big the image would be if it covered the entire viewport 00151 int ImageViewportSize[2]; 00152 00153 // This is how big the allocated memory for image is. This may be bigger 00154 // or smaller than ImageFullSize - it will be bigger if necessary to 00155 // ensure a power of 2, it will be smaller if the volume only covers a 00156 // small region of the viewport 00157 int ImageMemorySize[2]; 00158 00159 // This is the size of subregion in ImageSize image that we are using for 00160 // the current image. Since ImageSize is a power of 2, there is likely 00161 // wasted space in it. This number will be used for things such as clearing 00162 // the image if necessary. 00163 int ImageInUseSize[2]; 00164 00165 // This is the location in ImageFullSize image where our ImageSize image 00166 // is located. 00167 int ImageOrigin[2]; 00168 00169 // This is a copy of the ImageSampleDistance from the mapper - copied here 00170 // in order to share among all mappers contributing to this image 00171 float ImageSampleDistance; 00172 00173 // This is the allocated image 00174 unsigned short *Image; 00175 00176 // This is the size of the zbuffer in pixels 00177 int ZBufferSize[2]; 00178 00179 // This is the size of the memory for the zbuffer - this can be 00180 // bigger than the size of the zbuffer since we will allocate enough 00181 // space for the whole viewport to avoid re-allocating over and over 00182 int ZBufferMemorySize; 00183 00184 // This is the distance from the lower left corner of the viewport 00185 // where the ZBuffer starts 00186 int ZBufferOrigin[2]; 00187 00188 // This is the flag that indicate whether the ZBuffer is in use 00189 int UseZBuffer; 00190 00191 // This is the actual ZBuffer data in floats 00192 float *ZBuffer; 00193 00194 00195 private: 00196 vtkFixedPointRayCastImage(const vtkFixedPointRayCastImage&); // Not implemented. 00197 void operator=(const vtkFixedPointRayCastImage&); // Not implemented. 00198 }; 00199 00200 #endif 00201 00202 00203 00204 00205