VTK  9.3.20240425
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
27VTK_ABI_NAMESPACE_BEGIN
28class VTKRENDERINGVOLUME_EXPORT vtkFixedPointRayCastImage : public vtkObject
29{
30public:
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
104
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.
166
167protected:
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
215private:
217 void operator=(const vtkFixedPointRayCastImage&) = delete;
218};
219
220VTK_ABI_NAMESPACE_END
221#endif
helper class for a ray cast image
float * GetZBuffer()
Get the ZBuffer.
~vtkFixedPointRayCastImage() override
void AllocateImage()
Call this method once the ImageMemorySize has been set the allocate the image.
void ClearImage()
Clear the image to (0,0,0,0) for each pixel.
float GetZBufferValue(int x, int y)
Get the ZBuffer value corresponding to location (x,y) where (x,y) are indexing into the ImageInUse im...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
unsigned short * GetImage()
Get the internal storage for the image.
static vtkFixedPointRayCastImage * New()
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
int vtkTypeBool
Definition vtkABI.h:64