VTK  9.3.1
vtkFixedPointRayCastImage.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
21 #ifndef vtkFixedPointRayCastImage_h
22 #define vtkFixedPointRayCastImage_h
23 
24 #include "vtkObject.h"
25 #include "vtkRenderingVolumeModule.h" // For export macro
26 
27 VTK_ABI_NAMESPACE_BEGIN
28 class VTKRENDERINGVOLUME_EXPORT vtkFixedPointRayCastImage : public vtkObject
29 {
30 public:
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
40  unsigned short* GetImage() { return this->Image; }
41 
43 
47  vtkSetVector2Macro(ImageViewportSize, int);
48  vtkGetVectorMacro(ImageViewportSize, int, 2);
50 
52 
58  vtkSetVector2Macro(ImageMemorySize, int);
59  vtkGetVectorMacro(ImageMemorySize, int, 2);
61 
63 
70  vtkSetVector2Macro(ImageInUseSize, int);
71  vtkGetVectorMacro(ImageInUseSize, int, 2);
73 
75 
83  vtkSetVector2Macro(ImageOrigin, int);
84  vtkGetVectorMacro(ImageOrigin, int, 2);
86 
88 
94  vtkSetMacro(ImageSampleDistance, float);
95  vtkGetMacro(ImageSampleDistance, float);
97 
103  void AllocateImage();
104 
108  void ClearImage();
109 
111 
118  vtkSetVector2Macro(ZBufferSize, int);
119  vtkGetVectorMacro(ZBufferSize, int, 2);
121 
123 
132  vtkSetVector2Macro(ZBufferOrigin, int);
133  vtkGetVectorMacro(ZBufferOrigin, int, 2);
135 
137 
143  vtkSetClampMacro(UseZBuffer, vtkTypeBool, 0, 1);
144  vtkGetMacro(UseZBuffer, vtkTypeBool);
145  vtkBooleanMacro(UseZBuffer, vtkTypeBool);
147 
154  float GetZBufferValue(int x, int y);
155 
161  float* GetZBuffer() { return this->ZBuffer; }
162 
163  // Descipriotn:
164  // Allocate the space for the ZBuffer according to the size.
165  void AllocateZBuffer();
166 
167 protected:
169  ~vtkFixedPointRayCastImage() override;
170 
171  // This is how big the image would be if it covered the entire viewport
172  int ImageViewportSize[2];
173 
174  // This is how big the allocated memory for image is. This may be bigger
175  // or smaller than ImageFullSize - it will be bigger if necessary to
176  // ensure a power of 2, it will be smaller if the volume only covers a
177  // small region of the viewport
178  int ImageMemorySize[2];
179 
180  // This is the size of subregion in ImageSize image that we are using for
181  // the current image. Since ImageSize is a power of 2, there is likely
182  // wasted space in it. This number will be used for things such as clearing
183  // the image if necessary.
184  int ImageInUseSize[2];
185 
186  // This is the location in ImageFullSize image where our ImageSize image
187  // is located.
188  int ImageOrigin[2];
189 
190  // This is a copy of the ImageSampleDistance from the mapper - copied here
191  // in order to share among all mappers contributing to this image
193 
194  // This is the allocated image
195  unsigned short* Image;
196 
197  // This is the size of the zbuffer in pixels
198  int ZBufferSize[2];
199 
200  // This is the size of the memory for the zbuffer - this can be
201  // bigger than the size of the zbuffer since we will allocate enough
202  // space for the whole viewport to avoid re-allocating over and over
204 
205  // This is the distance from the lower left corner of the viewport
206  // where the ZBuffer starts
207  int ZBufferOrigin[2];
208 
209  // This is the flag that indicate whether the ZBuffer is in use
211 
212  // This is the actual ZBuffer data in floats
213  float* ZBuffer;
214 
215 private:
217  void operator=(const vtkFixedPointRayCastImage&) = delete;
218 };
219 
220 VTK_ABI_NAMESPACE_END
221 #endif
unsigned short * GetImage()
Get the internal storage for the image.
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int vtkTypeBool
Definition: vtkABI.h:64
float * GetZBuffer()
Get the ZBuffer.
a simple class to control print indentation
Definition: vtkIndent.h:28
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