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 =========================================================================*/
29 #ifndef vtkImageMapper3D_h
30 #define vtkImageMapper3D_h
31 
32 #include "vtkRenderingCoreModule.h" // For export macro
33 #include "vtkAbstractMapper3D.h"
34 
35 class vtkRenderer;
36 class vtkProp3D;
37 class vtkPoints;
38 class vtkMatrix4x4;
39 class vtkLookupTable;
40 class vtkScalarsToColors;
41 class vtkImageSlice;
42 class vtkImageProperty;
43 class vtkImageData;
44 class vtkMultiThreader;
45 class vtkImageToImageMapper3DFriendship;
46 
47 class VTKRENDERINGCORE_EXPORT vtkImageMapper3D : public vtkAbstractMapper3D
48 {
49 public:
51  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
56  virtual void Render(vtkRenderer *renderer, vtkImageSlice *prop) = 0;
57 
63  void ReleaseGraphicsResources(vtkWindow *) override = 0;
64 
66 
69  void SetInputData(vtkImageData *input);
70  vtkImageData *GetInput();
71  vtkDataSet *GetDataSetInput();
72  vtkDataObject *GetDataObjectInput();
74 
76 
82  vtkSetMacro(Border, vtkTypeBool);
83  vtkBooleanMacro(Border, vtkTypeBool);
84  vtkGetMacro(Border, vtkTypeBool);
86 
88 
94  vtkSetMacro(Background, vtkTypeBool);
95  vtkBooleanMacro(Background, vtkTypeBool);
96  vtkGetMacro(Background, vtkTypeBool);
98 
100 
105  vtkSetMacro(SliceAtFocalPoint, vtkTypeBool);
106  vtkBooleanMacro(SliceAtFocalPoint, vtkTypeBool);
107  vtkGetMacro(SliceAtFocalPoint, vtkTypeBool);
109 
111 
116  vtkSetMacro(SliceFacesCamera, vtkTypeBool);
117  vtkBooleanMacro(SliceFacesCamera, vtkTypeBool);
118  vtkGetMacro(SliceFacesCamera, vtkTypeBool);
120 
122 
129  vtkGetObjectMacro(SlicePlane, vtkPlane);
131 
137  virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4 *propMatrix,
138  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 protected:
165  ~vtkImageMapper3D() override;
166 
168 
171  int FillInputPortInformation(int port, vtkInformation* info) override;
174 
178  int ProcessRequest(vtkInformation* request,
179  vtkInformationVector** inInfo,
180  vtkInformationVector* outInfo) override;
181 
186  static void CheckerboardRGBA(
187  unsigned char *data, int xsize, int ysize,
188  double originx, double originy, double spacingx, double spacingy);
189 
195  unsigned char *MakeTextureData(
196  vtkImageProperty *property, vtkImageData *input, int extent[6],
197  int &xsize, int &ysize, int &bytesPerPixel, bool &reuseTexture,
198  bool &reuseData);
199 
204  void MakeTextureGeometry(
205  const int extent[6], double coords[12], double tcoords[8]);
206 
214  virtual void ComputeTextureSize(
215  const int extent[6], int &xdim, int &ydim,
216  int imageSize[2], int textureSize[2]);
217 
222  vtkRenderer *GetCurrentRenderer();
223 
227  vtkImageSlice *GetCurrentProp() { return this->CurrentProp; }
228 
233  vtkMatrix4x4 *GetDataToWorldMatrix();
234 
239  void GetBackgroundColor(vtkImageProperty *property, double color[4]);
240 
247 
248  // The slice.
252 
253  // Information about the image, updated by UpdateInformation
254  double DataSpacing[3];
255  double DataOrigin[3];
256  int DataWholeExtent[6];
257 
258  // Set by vtkImageStack when doing multi-pass rendering
262 
263 private:
264  // The prop this mapper is attached to, or zero if none.
265  vtkImageSlice *CurrentProp;
266  vtkRenderer *CurrentRenderer;
267 
268  // The cached data-to-world matrix
269  vtkMatrix4x4 *DataToWorldMatrix;
270 
271  vtkImageMapper3D(const vtkImageMapper3D&) = delete;
272  void operator=(const vtkImageMapper3D&) = delete;
273 
274  friend class vtkImageToImageMapper3DFriendship;
275 };
276 
277 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkPlane
perform various plane computations
Definition: vtkPlane.h:31
vtkImageMapper3D::Threader
vtkMultiThreader * Threader
Definition: vtkImageMapper3D.h:244
vtkImageMapper3D::GetCurrentProp
vtkImageSlice * GetCurrentProp()
Get the vtkImage prop associated with this mapper, or zero if none.
Definition: vtkImageMapper3D.h:227
vtkImageMapper3D::Background
vtkTypeBool Background
Definition: vtkImageMapper3D.h:242
vtkProp3D
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:43
vtkX3D::data
Definition: vtkX3D.h:315
vtkAlgorithm::FillInputPortInformation
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkImageMapper3D::Border
vtkTypeBool Border
Definition: vtkImageMapper3D.h:241
vtkImageMapper3D::SliceFacesCamera
vtkTypeBool SliceFacesCamera
Definition: vtkImageMapper3D.h:251
vtkAbstractMapper3D.h
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkMultiThreader
A class for performing multithreaded execution.
Definition: vtkMultiThreader.h:77
vtkX3D::color
Definition: vtkX3D.h:221
vtkX3D::port
Definition: vtkX3D.h:447
vtkAbstractMapper3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageSlice
represents an image in a 3D scene
Definition: vtkImageSlice.h:46
vtkX3D::Background
Definition: vtkX3D.h:71
vtkImageMapper3D::MatteEnable
bool MatteEnable
Definition: vtkImageMapper3D.h:259
vtkImageProperty
image display properties
Definition: vtkImageProperty.h:36
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
vtkImageMapper3D::SliceAtFocalPoint
vtkTypeBool SliceAtFocalPoint
Definition: vtkImageMapper3D.h:250
vtkImageMapper3D::NumberOfThreads
int NumberOfThreads
Definition: vtkImageMapper3D.h:245
vtkAbstractMapper::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
Definition: vtkAbstractMapper.h:68
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:60
vtkImageMapper3D::SlicePlane
vtkPlane * SlicePlane
Definition: vtkImageMapper3D.h:249
vtkImageMapper3D::DefaultLookupTable
vtkScalarsToColors * DefaultLookupTable
Definition: vtkImageMapper3D.h:243
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkLookupTable
map scalar values into colors via a lookup table
Definition: vtkLookupTable.h:68
vtkX3D::info
Definition: vtkX3D.h:376
vtkImageMapper3D
abstract class for mapping images to the screen
Definition: vtkImageMapper3D.h:47
vtkAbstractMapper3D
abstract class specifies interface to map 3D data
Definition: vtkAbstractMapper3D.h:42
vtkAlgorithm::ProcessRequest
virtual int ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
vtkImageMapper3D::ColorEnable
bool ColorEnable
Definition: vtkImageMapper3D.h:260
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:57
vtkImageMapper3D::Streaming
vtkTypeBool Streaming
Definition: vtkImageMapper3D.h:246
vtkX3D::extent
Definition: vtkX3D.h:345
vtkImageMapper3D::DepthEnable
bool DepthEnable
Definition: vtkImageMapper3D.h:261
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:58
vtkAlgorithm::FillOutputPortInformation
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Fill the output port information objects for this algorithm.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69