VTK  9.0.1
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 "vtkObject.h"
37 #include "vtkRenderingVolumeModule.h" // For export macro
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 private:
228  void operator=(const vtkFixedPointRayCastImage&) = delete;
229 };
230 
231 #endif
vtkFixedPointRayCastImage
helper class for a ray cast image
Definition: vtkFixedPointRayCastImage.h:39
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkFixedPointRayCastImage::Image
unsigned short * Image
Definition: vtkFixedPointRayCastImage.h:206
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkObject.h
vtkFixedPointRayCastImage::GetZBuffer
float * GetZBuffer()
Get the ZBuffer.
Definition: vtkFixedPointRayCastImage.h:172
vtkFixedPointRayCastImage::UseZBuffer
vtkTypeBool UseZBuffer
Definition: vtkFixedPointRayCastImage.h:221
vtkFixedPointRayCastImage::ZBufferMemorySize
int ZBufferMemorySize
Definition: vtkFixedPointRayCastImage.h:214
vtkFixedPointRayCastImage::ZBuffer
float * ZBuffer
Definition: vtkFixedPointRayCastImage.h:224
vtkFixedPointRayCastImage::GetImage
unsigned short * GetImage()
Get the internal storage for the image.
Definition: vtkFixedPointRayCastImage.h:51
vtkFixedPointRayCastImage::ImageSampleDistance
float ImageSampleDistance
Definition: vtkFixedPointRayCastImage.h:203
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69