VTK  9.0.1
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 
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, double plane[4]);
138 
140 
143  vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
144  vtkGetMacro(NumberOfThreads, int);
146 
148 
157  vtkSetMacro(Streaming, vtkTypeBool);
158  vtkGetMacro(Streaming, vtkTypeBool);
159  vtkBooleanMacro(Streaming, vtkTypeBool);
161 
162  // return the bounds in index space
163  virtual void GetIndexBounds(double extent[6]) = 0;
164 
165 protected:
167  ~vtkImageMapper3D() override;
168 
170 
173  int FillInputPortInformation(int port, vtkInformation* info) override;
176 
181  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
182 
187  static void CheckerboardRGBA(unsigned char* data, int xsize, int ysize, double originx,
188  double originy, double spacingx, double spacingy);
189 
195  unsigned char* MakeTextureData(vtkImageProperty* property, vtkImageData* input, int extent[6],
196  int& xsize, int& ysize, int& bytesPerPixel, bool& reuseTexture, bool& reuseData);
197 
202  void MakeTextureGeometry(const int extent[6], double coords[12], double tcoords[8]);
203 
211  virtual void ComputeTextureSize(
212  const int extent[6], int& xdim, int& ydim, int imageSize[2], int textureSize[2]);
213 
218  vtkRenderer* GetCurrentRenderer();
219 
223  vtkImageSlice* GetCurrentProp() { return this->CurrentProp; }
224 
229  vtkMatrix4x4* GetDataToWorldMatrix();
230 
235  void GetBackgroundColor(vtkImageProperty* property, double color[4]);
236 
243 
244  // The slice.
248 
249  // Information about the image, updated by UpdateInformation
250  double DataSpacing[3];
251  double DataOrigin[3];
252  double DataDirection[9];
253  int DataWholeExtent[6];
254 
255  // Set by vtkImageStack when doing multi-pass rendering
259 
260 private:
261  // The prop this mapper is attached to, or zero if none.
262  vtkImageSlice* CurrentProp;
263  vtkRenderer* CurrentRenderer;
264 
265  // The cached data-to-world matrix
266  vtkMatrix4x4* DataToWorldMatrix;
267 
268  vtkImageMapper3D(const vtkImageMapper3D&) = delete;
269  void operator=(const vtkImageMapper3D&) = delete;
270 
271  friend class vtkImageToImageMapper3DFriendship;
272 };
273 
274 #endif
vtkTypeBool SliceAtFocalPoint
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
A class for performing multithreaded execution.
vtkScalarsToColors * DefaultLookupTable
map scalar values into colors via a lookup table
image display properties
vtkTypeBool Streaming
abstract specification for renderers
Definition: vtkRenderer.h:67
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:43
int vtkTypeBool
Definition: vtkABI.h:69
virtual vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
Superclass for mapping scalar values to colors.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Fill the output port information objects for this algorithm.
a simple class to control print indentation
Definition: vtkIndent.h:33
abstract class for mapping images to the screen
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
perform various plane computations
Definition: vtkPlane.h:31
abstract class specifies interface to map 3D data
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
vtkImageSlice * GetCurrentProp()
Get the vtkImage prop associated with this mapper, or zero if none.
vtkMultiThreader * Threader
vtkTypeBool Background
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
represents an image in a 3D scene
Definition: vtkImageSlice.h:46
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
Store zero or more vtkInformation instances.
general representation of visualization data
Definition: vtkDataObject.h:59
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkTypeBool SliceFacesCamera