VTK
vtkFixedPointRayCastImage.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkFixedPointRayCastImage.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
32 #ifndef vtkFixedPointRayCastImage_h
33 #define vtkFixedPointRayCastImage_h
34 
35 #include "vtkRenderingVolumeModule.h" // For export macro
36 #include "vtkObject.h"
37 
39 {
40 public:
43  virtual void PrintSelf(ostream& os, vtkIndent indent);
44 
48  unsigned short *GetImage() {return this->Image;}
49 
51 
53  vtkSetVector2Macro( ImageViewportSize, int );
54  vtkGetVectorMacro( ImageViewportSize, int, 2 );
56 
58 
62  vtkSetVector2Macro( ImageMemorySize, int );
63  vtkGetVectorMacro( ImageMemorySize, int, 2 );
65 
67 
71  vtkSetVector2Macro( ImageInUseSize, int );
72  vtkGetVectorMacro( ImageInUseSize, int, 2 );
74 
76 
81  vtkSetVector2Macro( ImageOrigin, int );
82  vtkGetVectorMacro( ImageOrigin, int, 2 );
84 
86 
90  vtkSetMacro( ImageSampleDistance, float );
91  vtkGetMacro( ImageSampleDistance, float );
93 
96  void AllocateImage();
97 
99  void ClearImage();
100 
102 
107  vtkSetVector2Macro( ZBufferSize, int );
108  vtkGetVectorMacro( ZBufferSize, int, 2 );
110 
112 
118  vtkSetVector2Macro( ZBufferOrigin, int );
119  vtkGetVectorMacro( ZBufferOrigin, int, 2 );
121 
123 
127  vtkSetClampMacro( UseZBuffer, int, 0, 1 );
128  vtkGetMacro( UseZBuffer, int );
129  vtkBooleanMacro( UseZBuffer, int );
131 
136  float GetZBufferValue( int x, int y );
137 
141  float *GetZBuffer() {return this->ZBuffer;}
142 
143  // Descipriotn:
144  // Allocate the space for the ZBuffer according to the size.
145  void AllocateZBuffer();
146 
147 protected:
150 
151  // This is how big the image would be if it covered the entire viewport
152  int ImageViewportSize[2];
153 
154  // This is how big the allocated memory for image is. This may be bigger
155  // or smaller than ImageFullSize - it will be bigger if necessary to
156  // ensure a power of 2, it will be smaller if the volume only covers a
157  // small region of the viewport
158  int ImageMemorySize[2];
159 
160  // This is the size of subregion in ImageSize image that we are using for
161  // the current image. Since ImageSize is a power of 2, there is likely
162  // wasted space in it. This number will be used for things such as clearing
163  // the image if necessary.
164  int ImageInUseSize[2];
165 
166  // This is the location in ImageFullSize image where our ImageSize image
167  // is located.
168  int ImageOrigin[2];
169 
170  // This is a copy of the ImageSampleDistance from the mapper - copied here
171  // in order to share among all mappers contributing to this image
173 
174  // This is the allocated image
175  unsigned short *Image;
176 
177  // This is the size of the zbuffer in pixels
178  int ZBufferSize[2];
179 
180  // This is the size of the memory for the zbuffer - this can be
181  // bigger than the size of the zbuffer since we will allocate enough
182  // space for the whole viewport to avoid re-allocating over and over
184 
185  // This is the distance from the lower left corner of the viewport
186  // where the ZBuffer starts
187  int ZBufferOrigin[2];
188 
189  // This is the flag that indicate whether the ZBuffer is in use
191 
192  // This is the actual ZBuffer data in floats
193  float *ZBuffer;
194 
195 
196 private:
197  vtkFixedPointRayCastImage(const vtkFixedPointRayCastImage&); // Not implemented.
198  void operator=(const vtkFixedPointRayCastImage&); // Not implemented.
199 };
200 
201 #endif
202 
203 
204 
205 
206 
abstract base class for most VTK objects
Definition: vtkObject.h:61
#define VTKRENDERINGVOLUME_EXPORT
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
static vtkObject * New()
helper class for a ray cast image