VTK
vtkImageMapper3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageMapper3D.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 =========================================================================*/
32 #ifndef vtkImageMapper3D_h
33 #define vtkImageMapper3D_h
34 
35 #include "vtkRenderingCoreModule.h" // For export macro
36 #include "vtkAbstractMapper3D.h"
37 
38 class vtkRenderer;
39 class vtkProp3D;
40 class vtkPoints;
41 class vtkMatrix4x4;
42 class vtkLookupTable;
43 class vtkScalarsToColors;
44 class vtkImageSlice;
45 class vtkImageProperty;
46 class vtkImageData;
47 class vtkMultiThreader;
48 class vtkImageToImageMapper3DFriendship;
49 
50 class VTKRENDERINGCORE_EXPORT vtkImageMapper3D : public vtkAbstractMapper3D
51 {
52 public:
54  void PrintSelf(ostream& os, vtkIndent indent);
55 
59  virtual void Render(vtkRenderer *renderer, vtkImageSlice *prop) = 0;
60 
66  virtual void ReleaseGraphicsResources(vtkWindow *) = 0;
67 
69 
72  void SetInputData(vtkImageData *input);
77 
79 
85  vtkSetMacro(Border, int);
86  vtkBooleanMacro(Border, int);
87  vtkGetMacro(Border, int);
89 
91 
99  vtkGetMacro(Background, int);
101 
103 
108  vtkSetMacro(SliceAtFocalPoint, int);
109  vtkBooleanMacro(SliceAtFocalPoint, int);
110  vtkGetMacro(SliceAtFocalPoint, int);
112 
114 
119  vtkSetMacro(SliceFacesCamera, int);
120  vtkBooleanMacro(SliceFacesCamera, int);
121  vtkGetMacro(SliceFacesCamera, int);
123 
125 
132  vtkGetObjectMacro(SlicePlane, vtkPlane);
134 
140  virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4 *propMatrix,
141  double plane[4]);
142 
144 
147  vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
148  vtkGetMacro(NumberOfThreads, int);
150 
152 
161  vtkSetMacro(Streaming, int);
162  vtkGetMacro(Streaming, int);
163  vtkBooleanMacro(Streaming, int);
165 
166 protected:
169 
171 
177 
181  virtual int ProcessRequest(vtkInformation* request,
182  vtkInformationVector** inInfo,
183  vtkInformationVector* outInfo);
184 
189  static void CheckerboardRGBA(
190  unsigned char *data, int xsize, int ysize,
191  double originx, double originy, double spacingx, double spacingy);
192 
198  unsigned char *MakeTextureData(
199  vtkImageProperty *property, vtkImageData *input, int extent[6],
200  int &xsize, int &ysize, int &bytesPerPixel, bool &reuseTexture,
201  bool &reuseData);
202 
208  const int extent[6], double coords[12], double tcoords[8]);
209 
217  virtual void ComputeTextureSize(
218  const int extent[6], int &xdim, int &ydim,
219  int imageSize[2], int textureSize[2]);
220 
226 
230  vtkImageSlice *GetCurrentProp() { return this->CurrentProp; }
231 
237 
242  void GetBackgroundColor(vtkImageProperty *property, double color[4]);
243 
244  int Border;
250 
251  // The slice.
255 
256  // Information about the image, updated by UpdateInformation
257  double DataSpacing[3];
258  double DataOrigin[3];
259  int DataWholeExtent[6];
260 
261  // Set by vtkImageStack when doing multi-pass rendering
265 
266 private:
267  // The prop this mapper is attached to, or zero if none.
268  vtkImageSlice *CurrentProp;
269  vtkRenderer *CurrentRenderer;
270 
271  // The cached data-to-world matrix
272  vtkMatrix4x4 *DataToWorldMatrix;
273 
274  vtkImageMapper3D(const vtkImageMapper3D&) VTK_DELETE_FUNCTION;
275  void operator=(const vtkImageMapper3D&) VTK_DELETE_FUNCTION;
276 
277  friend class vtkImageToImageMapper3DFriendship;
278 };
279 
280 #endif
abstract class specifies interface to map 3D data
general representation of visualization data
Definition: vtkDataObject.h:65
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
abstract class for mapping images to the screen
virtual int ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
Handle requests from the pipeline executive.
virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4 *propMatrix, double plane[4])
Get the plane as a homogeneous 4-vector that gives the plane equation coefficients.
virtual void ComputeTextureSize(const int extent[6], int &xdim, int &ydim, int imageSize[2], int textureSize[2])
Given an extent that describes a slice (it must have unit thickness in one of the three directions),...
vtkDataObject * GetDataObjectInput()
static void CheckerboardRGBA(unsigned char *data, int xsize, int ysize, double originx, double originy, double spacingx, double spacingy)
Checkerboard the alpha component of an RGBA image.
vtkScalarsToColors * DefaultLookupTable
vtkMultiThreader * Threader
void GetBackgroundColor(vtkImageProperty *property, double color[4])
Get the background color, by using the first color in the supplied lookup table, or black if there is...
vtkMatrix4x4 * GetDataToWorldMatrix()
Get the data-to-world matrix for this mapper, according to the assembly path for its prop.
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Fill the output port information objects for this algorithm.
virtual void Render(vtkRenderer *renderer, vtkImageSlice *prop)=0
This should only be called by the renderer.
virtual void ReleaseGraphicsResources(vtkWindow *)=0
Release any graphics resources that are being consumed by this mapper.
unsigned char * MakeTextureData(vtkImageProperty *property, vtkImageData *input, int extent[6], int &xsize, int &ysize, int &bytesPerPixel, bool &reuseTexture, bool &reuseData)
Perform window/level and color mapping operations to produce unsigned char data that can be used as a...
vtkDataSet * GetDataSetInput()
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkImageData * GetInput()
virtual int FillInputPortInformation(int port, vtkInformation *info)
See algorithm for more info.
void MakeTextureGeometry(const int extent[6], double coords[12], double tcoords[8])
Compute the coordinates and texture coordinates for the image, given an extent that describes a singl...
void SetInputData(vtkImageData *input)
The input data for this mapper.
vtkRenderer * GetCurrentRenderer()
Get the renderer associated with this mapper, or zero if none.
vtkImageSlice * GetCurrentProp()
Get the vtkImage prop associated with this mapper, or zero if none.
image display properties
represents an image in a 3D scene
Definition: vtkImageSlice.h:53
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
map scalar values into colors via a lookup table
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
A class for performing multithreaded execution.
perform various plane computations
Definition: vtkPlane.h:38
represent and manipulate 3D points
Definition: vtkPoints.h:40
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:47
abstract specification for renderers
Definition: vtkRenderer.h:64
Superclass for mapping scalar values to colors.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ Background
Definition: vtkX3D.h:71
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ extent
Definition: vtkX3D.h:345
@ color
Definition: vtkX3D.h:221
@ data
Definition: vtkX3D.h:315
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.