VTK  9.1.0
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 =========================================================================*/
29 #ifndef vtkImageMapper3D_h
30 #define vtkImageMapper3D_h
31 
32 #include "vtkAbstractMapper3D.h"
33 #include "vtkRenderingCoreModule.h" // For export macro
34 #include "vtkThreads.h" // for VTK_MAX_THREADS
35 
36 class vtkRenderer;
37 class vtkProp3D;
38 class vtkPoints;
39 class vtkMatrix4x4;
40 class vtkLookupTable;
41 class vtkScalarsToColors;
42 class vtkImageSlice;
43 class vtkImageProperty;
44 class vtkImageData;
45 class vtkMultiThreader;
46 class vtkImageToImageMapper3DFriendship;
47 
48 class VTKRENDERINGCORE_EXPORT vtkImageMapper3D : public vtkAbstractMapper3D
49 {
50 public:
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
57  virtual void Render(vtkRenderer* renderer, vtkImageSlice* prop) = 0;
58 
64  void ReleaseGraphicsResources(vtkWindow*) override = 0;
65 
67 
70  void SetInputData(vtkImageData* input);
75 
77 
83  vtkSetMacro(Border, vtkTypeBool);
84  vtkBooleanMacro(Border, vtkTypeBool);
85  vtkGetMacro(Border, vtkTypeBool);
87 
89 
95  vtkSetMacro(Background, vtkTypeBool);
96  vtkBooleanMacro(Background, vtkTypeBool);
97  vtkGetMacro(Background, vtkTypeBool);
99 
101 
106  vtkSetMacro(SliceAtFocalPoint, vtkTypeBool);
107  vtkBooleanMacro(SliceAtFocalPoint, vtkTypeBool);
108  vtkGetMacro(SliceAtFocalPoint, vtkTypeBool);
110 
112 
117  vtkSetMacro(SliceFacesCamera, vtkTypeBool);
118  vtkBooleanMacro(SliceFacesCamera, vtkTypeBool);
119  vtkGetMacro(SliceFacesCamera, vtkTypeBool);
121 
123 
130  vtkGetObjectMacro(SlicePlane, vtkPlane);
132 
138  virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4* propMatrix, double plane[4]);
139 
141 
144  vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
145  vtkGetMacro(NumberOfThreads, int);
147 
149 
158  vtkSetMacro(Streaming, vtkTypeBool);
159  vtkGetMacro(Streaming, vtkTypeBool);
160  vtkBooleanMacro(Streaming, vtkTypeBool);
162 
163  // return the bounds in index space
164  virtual void GetIndexBounds(double extent[6]) = 0;
165 
166 protected:
168  ~vtkImageMapper3D() override;
169 
171 
177 
182  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
183 
188  static void CheckerboardRGBA(unsigned char* data, int xsize, int ysize, double originx,
189  double originy, double spacingx, double spacingy);
190 
196  unsigned char* MakeTextureData(vtkImageProperty* property, vtkImageData* input, int extent[6],
197  int& xsize, int& ysize, int& bytesPerPixel, bool& reuseTexture, bool& reuseData);
198 
203  void MakeTextureGeometry(const int extent[6], double coords[12], double tcoords[8]);
204 
212  virtual void ComputeTextureSize(
213  const int extent[6], int& xdim, int& ydim, int imageSize[2], int textureSize[2]);
214 
220 
224  vtkImageSlice* GetCurrentProp() { return this->CurrentProp; }
225 
231 
236  void GetBackgroundColor(vtkImageProperty* property, double color[4]);
237 
244 
245  // The slice.
249 
250  // Information about the image, updated by UpdateInformation
251  double DataSpacing[3];
252  double DataOrigin[3];
253  double DataDirection[9];
254  int DataWholeExtent[6];
255 
256  // Set by vtkImageStack when doing multi-pass rendering
260 
261 private:
262  // The prop this mapper is attached to, or zero if none.
263  vtkImageSlice* CurrentProp;
264  vtkRenderer* CurrentRenderer;
265 
266  // The cached data-to-world matrix
267  vtkMatrix4x4* DataToWorldMatrix;
268 
269  vtkImageMapper3D(const vtkImageMapper3D&) = delete;
270  void operator=(const vtkImageMapper3D&) = delete;
271 
272  friend class vtkImageToImageMapper3DFriendship;
273 };
274 
275 #endif
abstract class specifies interface to map 3D data
general representation of visualization data
Definition: vtkDataObject.h:60
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
topologically and geometrically regular array of data
Definition: vtkImageData.h:48
abstract class for mapping images to the screen
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()
The input data for this mapper.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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
int FillOutputPortInformation(int port, vtkInformation *info) override
See algorithm for more info.
vtkTypeBool SliceFacesCamera
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 void Render(vtkRenderer *renderer, vtkImageSlice *prop)=0
This should only be called by the renderer.
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()
The input data for this mapper.
vtkTypeBool Background
virtual void GetIndexBounds(double extent[6])=0
void ReleaseGraphicsResources(vtkWindow *) override=0
Release any graphics resources that are being consumed by this mapper.
vtkImageData * GetInput()
The input data for this mapper.
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...
~vtkImageMapper3D() override
void SetInputData(vtkImageData *input)
The input data for this mapper.
vtkTypeBool Streaming
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Handle requests from the pipeline executive.
int FillInputPortInformation(int port, vtkInformation *info) override
See algorithm for more info.
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.
vtkTypeBool SliceAtFocalPoint
image display properties
represents an image in a 3D scene
Definition: vtkImageSlice.h:47
a simple class to control print indentation
Definition: vtkIndent.h:34
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:36
A class for performing multithreaded execution.
perform various plane computations
Definition: vtkPlane.h:34
represent and manipulate 3D points
Definition: vtkPoints.h:34
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:44
abstract specification for renderers
Definition: vtkRenderer.h:73
Superclass for mapping scalar values to colors.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ Background
Definition: vtkX3D.h:77
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ extent
Definition: vtkX3D.h:351
@ color
Definition: vtkX3D.h:227
@ data
Definition: vtkX3D.h:321
int vtkTypeBool
Definition: vtkABI.h:69