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 "vtkObject.h"
36 
38 {
39 public:
42  virtual void PrintSelf(ostream& os, vtkIndent indent);
43 
47  unsigned short *GetImage() {return this->Image;}
48 
50 
52  vtkSetVector2Macro( ImageViewportSize, int );
53  vtkGetVectorMacro( ImageViewportSize, int, 2 );
55 
57 
61  vtkSetVector2Macro( ImageMemorySize, int );
62  vtkGetVectorMacro( ImageMemorySize, int, 2 );
64 
66 
70  vtkSetVector2Macro( ImageInUseSize, int );
71  vtkGetVectorMacro( ImageInUseSize, int, 2 );
73 
75 
80  vtkSetVector2Macro( ImageOrigin, int );
81  vtkGetVectorMacro( ImageOrigin, int, 2 );
83 
85 
89  vtkSetMacro( ImageSampleDistance, float );
90  vtkGetMacro( ImageSampleDistance, float );
92 
95  void AllocateImage();
96 
98  void ClearImage();
99 
101 
106  vtkSetVector2Macro( ZBufferSize, int );
107  vtkGetVectorMacro( ZBufferSize, int, 2 );
109 
111 
117  vtkSetVector2Macro( ZBufferOrigin, int );
118  vtkGetVectorMacro( ZBufferOrigin, int, 2 );
120 
122 
126  vtkSetClampMacro( UseZBuffer, int, 0, 1 );
127  vtkGetMacro( UseZBuffer, int );
128  vtkBooleanMacro( UseZBuffer, int );
130 
135  float GetZBufferValue( int x, int y );
136 
140  float *GetZBuffer() {return this->ZBuffer;}
141 
142  // Descipriotn:
143  // Allocate the space for the ZBuffer according to the size.
144  void AllocateZBuffer();
145 
146 protected:
149 
150  // This is how big the image would be if it covered the entire viewport
151  int ImageViewportSize[2];
152 
153  // This is how big the allocated memory for image is. This may be bigger
154  // or smaller than ImageFullSize - it will be bigger if necessary to
155  // ensure a power of 2, it will be smaller if the volume only covers a
156  // small region of the viewport
157  int ImageMemorySize[2];
158 
159  // This is the size of subregion in ImageSize image that we are using for
160  // the current image. Since ImageSize is a power of 2, there is likely
161  // wasted space in it. This number will be used for things such as clearing
162  // the image if necessary.
163  int ImageInUseSize[2];
164 
165  // This is the location in ImageFullSize image where our ImageSize image
166  // is located.
167  int ImageOrigin[2];
168 
169  // This is a copy of the ImageSampleDistance from the mapper - copied here
170  // in order to share among all mappers contributing to this image
172 
173  // This is the allocated image
174  unsigned short *Image;
175 
176  // This is the size of the zbuffer in pixels
177  int ZBufferSize[2];
178 
179  // This is the size of the memory for the zbuffer - this can be
180  // bigger than the size of the zbuffer since we will allocate enough
181  // space for the whole viewport to avoid re-allocating over and over
183 
184  // This is the distance from the lower left corner of the viewport
185  // where the ZBuffer starts
186  int ZBufferOrigin[2];
187 
188  // This is the flag that indicate whether the ZBuffer is in use
190 
191  // This is the actual ZBuffer data in floats
192  float *ZBuffer;
193 
194 
195 private:
196  vtkFixedPointRayCastImage(const vtkFixedPointRayCastImage&); // Not implemented.
197  void operator=(const vtkFixedPointRayCastImage&); // Not implemented.
198 };
199 
200 #endif
201 
202 
203 
204 
205 
abstract base class for most VTK objects
Definition: vtkObject.h:60
#define VTK_VOLUMERENDERING_EXPORT
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:37
static vtkObject * New()
helper class for a ray cast image