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 
33 #ifndef vtkFixedPointRayCastImage_h
34 #define vtkFixedPointRayCastImage_h
35 
36 #include "vtkRenderingVolumeModule.h" // For export macro
37 #include "vtkObject.h"
38 
39 class VTKRENDERINGVOLUME_EXPORT vtkFixedPointRayCastImage : public vtkObject
40 {
41 public:
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
51  unsigned short *GetImage() {return this->Image;}
52 
54 
58  vtkSetVector2Macro( ImageViewportSize, int );
59  vtkGetVectorMacro( ImageViewportSize, int, 2 );
61 
63 
69  vtkSetVector2Macro( ImageMemorySize, int );
70  vtkGetVectorMacro( ImageMemorySize, int, 2 );
72 
74 
81  vtkSetVector2Macro( ImageInUseSize, int );
82  vtkGetVectorMacro( ImageInUseSize, int, 2 );
84 
86 
94  vtkSetVector2Macro( ImageOrigin, int );
95  vtkGetVectorMacro( ImageOrigin, int, 2 );
97 
99 
105  vtkSetMacro( ImageSampleDistance, float );
106  vtkGetMacro( ImageSampleDistance, float );
108 
114  void AllocateImage();
115 
119  void ClearImage();
120 
122 
129  vtkSetVector2Macro( ZBufferSize, int );
130  vtkGetVectorMacro( ZBufferSize, int, 2 );
132 
134 
143  vtkSetVector2Macro( ZBufferOrigin, int );
144  vtkGetVectorMacro( ZBufferOrigin, int, 2 );
146 
148 
154  vtkSetClampMacro( UseZBuffer, vtkTypeBool, 0, 1 );
155  vtkGetMacro( UseZBuffer, vtkTypeBool );
156  vtkBooleanMacro( UseZBuffer, vtkTypeBool );
158 
165  float GetZBufferValue( int x, int y );
166 
172  float *GetZBuffer() {return this->ZBuffer;}
173 
174  // Descipriotn:
175  // Allocate the space for the ZBuffer according to the size.
176  void AllocateZBuffer();
177 
178 protected:
180  ~vtkFixedPointRayCastImage() override;
181 
182  // This is how big the image would be if it covered the entire viewport
183  int ImageViewportSize[2];
184 
185  // This is how big the allocated memory for image is. This may be bigger
186  // or smaller than ImageFullSize - it will be bigger if necessary to
187  // ensure a power of 2, it will be smaller if the volume only covers a
188  // small region of the viewport
189  int ImageMemorySize[2];
190 
191  // This is the size of subregion in ImageSize image that we are using for
192  // the current image. Since ImageSize is a power of 2, there is likely
193  // wasted space in it. This number will be used for things such as clearing
194  // the image if necessary.
195  int ImageInUseSize[2];
196 
197  // This is the location in ImageFullSize image where our ImageSize image
198  // is located.
199  int ImageOrigin[2];
200 
201  // This is a copy of the ImageSampleDistance from the mapper - copied here
202  // in order to share among all mappers contributing to this image
204 
205  // This is the allocated image
206  unsigned short *Image;
207 
208  // This is the size of the zbuffer in pixels
209  int ZBufferSize[2];
210 
211  // This is the size of the memory for the zbuffer - this can be
212  // bigger than the size of the zbuffer since we will allocate enough
213  // space for the whole viewport to avoid re-allocating over and over
215 
216  // This is the distance from the lower left corner of the viewport
217  // where the ZBuffer starts
218  int ZBufferOrigin[2];
219 
220  // This is the flag that indicate whether the ZBuffer is in use
222 
223  // This is the actual ZBuffer data in floats
224  float *ZBuffer;
225 
226 
227 private:
229  void operator=(const vtkFixedPointRayCastImage&) = delete;
230 };
231 
232 #endif
233 
234 
235 
236 
237 
unsigned short * GetImage()
Get the internal storage for the image.
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int vtkTypeBool
Definition: vtkABI.h:69
float * GetZBuffer()
Get the ZBuffer.
a simple class to control print indentation
Definition: vtkIndent.h:39
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
helper class for a ray cast image