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) override;
55 
59  virtual void Render(vtkRenderer *renderer, vtkImageSlice *prop) = 0;
60 
66  void ReleaseGraphicsResources(vtkWindow *) override = 0;
67 
69 
72  void SetInputData(vtkImageData *input);
77 
79 
85  vtkSetMacro(Border, vtkTypeBool);
86  vtkBooleanMacro(Border, vtkTypeBool);
87  vtkGetMacro(Border, vtkTypeBool);
89 
91 
97  vtkSetMacro(Background, vtkTypeBool);
98  vtkBooleanMacro(Background, vtkTypeBool);
99  vtkGetMacro(Background, vtkTypeBool);
101 
103 
108  vtkSetMacro(SliceAtFocalPoint, vtkTypeBool);
109  vtkBooleanMacro(SliceAtFocalPoint, vtkTypeBool);
110  vtkGetMacro(SliceAtFocalPoint, vtkTypeBool);
112 
114 
119  vtkSetMacro(SliceFacesCamera, vtkTypeBool);
120  vtkBooleanMacro(SliceFacesCamera, vtkTypeBool);
121  vtkGetMacro(SliceFacesCamera, vtkTypeBool);
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, vtkTypeBool);
162  vtkGetMacro(Streaming, vtkTypeBool);
163  vtkBooleanMacro(Streaming, vtkTypeBool);
165 
166 protected:
168  ~vtkImageMapper3D() override;
169 
171 
177 
182  vtkInformationVector** inInfo,
183  vtkInformationVector* outInfo) override;
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 
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&) = delete;
275  void operator=(const vtkImageMapper3D&) = delete;
276 
277  friend class vtkImageToImageMapper3DFriendship;
278 };
279 
280 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:40
vtkPlane
perform various plane computations
Definition: vtkPlane.h:38
vtkImageMapper3D::Threader
vtkMultiThreader * Threader
Definition: vtkImageMapper3D.h:247
vtkImageMapper3D::GetCurrentProp
vtkImageSlice * GetCurrentProp()
Get the vtkImage prop associated with this mapper, or zero if none.
Definition: vtkImageMapper3D.h:230
vtkImageMapper3D::Background
vtkTypeBool Background
Definition: vtkImageMapper3D.h:245
vtkProp3D
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:47
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkImageMapper3D::FillOutputPortInformation
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:42
vtkImageMapper3D::Render
virtual void Render(vtkRenderer *renderer, vtkImageSlice *prop)=0
This should only be called by the renderer.
vtkImageMapper3D::ProcessRequest
int ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Handle requests from the pipeline executive.
vtkImageMapper3D::GetDataObjectInput
vtkDataObject * GetDataObjectInput()
vtkImageMapper3D::Border
vtkTypeBool Border
Definition: vtkImageMapper3D.h:244
vtkImageMapper3D::SliceFacesCamera
vtkTypeBool SliceFacesCamera
Definition: vtkImageMapper3D.h:254
vtkAbstractMapper3D.h
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
vtkImageMapper3D::GetSlicePlaneInDataCoords
virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4 *propMatrix, double plane[4])
Get the plane as a homogeneous 4-vector that gives the plane equation coefficients.
vtkMultiThreader
A class for performing multithreaded execution.
Definition: vtkMultiThreader.h:84
vtkX3D::color
@ color
Definition: vtkX3D.h:221
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkImageSlice
represents an image in a 3D scene
Definition: vtkImageSlice.h:53
vtkX3D::Background
@ Background
Definition: vtkX3D.h:71
vtkImageMapper3D::MatteEnable
bool MatteEnable
Definition: vtkImageMapper3D.h:262
vtkImageProperty
image display properties
Definition: vtkImageProperty.h:43
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
vtkImageMapper3D::SliceAtFocalPoint
vtkTypeBool SliceAtFocalPoint
Definition: vtkImageMapper3D.h:253
vtkImageMapper3D::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override=0
Release any graphics resources that are being consumed by this mapper.
vtkImageMapper3D::MakeTextureGeometry
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::GetCurrentRenderer
vtkRenderer * GetCurrentRenderer()
Get the renderer associated with this mapper, or zero if none.
vtkImageMapper3D::NumberOfThreads
int NumberOfThreads
Definition: vtkImageMapper3D.h:248
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:67
vtkImageMapper3D::SlicePlane
vtkPlane * SlicePlane
Definition: vtkImageMapper3D.h:252
vtkImageMapper3D::DefaultLookupTable
vtkScalarsToColors * DefaultLookupTable
Definition: vtkImageMapper3D.h:246
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:87
vtkLookupTable
map scalar values into colors via a lookup table
Definition: vtkLookupTable.h:75
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkImageMapper3D
abstract class for mapping images to the screen
Definition: vtkImageMapper3D.h:51
vtkAbstractMapper3D
abstract class specifies interface to map 3D data
Definition: vtkAbstractMapper3D.h:46
vtkImageMapper3D::vtkImageMapper3D
vtkImageMapper3D()
vtkImageMapper3D::GetInput
vtkImageData * GetInput()
vtkImageMapper3D::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
See algorithm for more info.
vtkImageMapper3D::ColorEnable
bool ColorEnable
Definition: vtkImageMapper3D.h:263
vtkImageMapper3D::GetDataSetInput
vtkDataSet * GetDataSetInput()
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkImageMapper3D::Streaming
vtkTypeBool Streaming
Definition: vtkImageMapper3D.h:249
vtkImageMapper3D::SetInputData
void SetInputData(vtkImageData *input)
The input data for this mapper.
vtkX3D::extent
@ extent
Definition: vtkX3D.h:345
vtkImageMapper3D::MakeTextureData
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...
vtkImageMapper3D::ComputeTextureSize
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),...
vtkImageMapper3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageMapper3D::DepthEnable
bool DepthEnable
Definition: vtkImageMapper3D.h:264
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
vtkImageMapper3D::GetDataToWorldMatrix
vtkMatrix4x4 * GetDataToWorldMatrix()
Get the data-to-world matrix for this mapper, according to the assembly path for its prop.
vtkImageMapper3D::GetBackgroundColor
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...
vtkImageMapper3D::CheckerboardRGBA
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.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkImageMapper3D::~vtkImageMapper3D
~vtkImageMapper3D() override