VTK  9.2.6
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 "vtkAbstractMapper3D.h"
36 #include "vtkRenderingCoreModule.h" // For export macro
37 #include "vtkThreads.h" // for VTK_MAX_THREADS
38 
39 class vtkRenderer;
40 class vtkProp3D;
41 class vtkPoints;
42 class vtkMatrix4x4;
43 class vtkLookupTable;
44 class vtkScalarsToColors;
45 class vtkImageSlice;
46 class vtkImageProperty;
47 class vtkImageData;
48 class vtkMultiThreader;
49 class vtkImageToImageMapper3DFriendship;
50 
51 class VTKRENDERINGCORE_EXPORT vtkImageMapper3D : public vtkAbstractMapper3D
52 {
53 public:
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
60  virtual void Render(vtkRenderer* renderer, vtkImageSlice* prop) = 0;
61 
67  void ReleaseGraphicsResources(vtkWindow*) override = 0;
68 
70 
73  void SetInputData(vtkImageData* input);
74  vtkImageData* GetInput();
75  vtkDataSet* GetDataSetInput();
76  vtkDataObject* GetDataObjectInput();
78 
80 
86  vtkSetMacro(Border, vtkTypeBool);
87  vtkBooleanMacro(Border, vtkTypeBool);
88  vtkGetMacro(Border, vtkTypeBool);
90 
92 
98  vtkSetMacro(Background, vtkTypeBool);
99  vtkBooleanMacro(Background, vtkTypeBool);
100  vtkGetMacro(Background, vtkTypeBool);
102 
104 
109  vtkSetMacro(SliceAtFocalPoint, vtkTypeBool);
110  vtkBooleanMacro(SliceAtFocalPoint, vtkTypeBool);
111  vtkGetMacro(SliceAtFocalPoint, vtkTypeBool);
113 
115 
120  vtkSetMacro(SliceFacesCamera, vtkTypeBool);
121  vtkBooleanMacro(SliceFacesCamera, vtkTypeBool);
122  vtkGetMacro(SliceFacesCamera, vtkTypeBool);
124 
126 
133  vtkGetObjectMacro(SlicePlane, vtkPlane);
135 
141  virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4* propMatrix, 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  // return the bounds in index space
167  virtual void GetIndexBounds(double extent[6]) = 0;
168 
169 protected:
171  ~vtkImageMapper3D() override;
172 
174 
177  int FillInputPortInformation(int port, vtkInformation* info) override;
180 
185  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
186 
191  static void CheckerboardRGBA(unsigned char* data, int xsize, int ysize, double originx,
192  double originy, double spacingx, double spacingy);
193 
199  unsigned char* MakeTextureData(vtkImageProperty* property, vtkImageData* input, int extent[6],
200  int& xsize, int& ysize, int& bytesPerPixel, bool& reuseTexture, bool& reuseData);
201 
206  void MakeTextureGeometry(const int extent[6], double coords[12], double tcoords[8]);
207 
215  virtual void ComputeTextureSize(
216  const int extent[6], int& xdim, int& ydim, 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  double DataDirection[9];
257  int DataWholeExtent[6];
258 
259  // Set by vtkImageStack when doing multi-pass rendering
263 
264 private:
265  // The prop this mapper is attached to, or zero if none.
266  vtkImageSlice* CurrentProp;
267  vtkRenderer* CurrentRenderer;
268 
269  // The cached data-to-world matrix
270  vtkMatrix4x4* DataToWorldMatrix;
271 
272  vtkImageMapper3D(const vtkImageMapper3D&) = delete;
273  void operator=(const vtkImageMapper3D&) = delete;
274 
275  friend class vtkImageToImageMapper3DFriendship;
276 };
277 
278 #endif
vtkTypeBool SliceAtFocalPoint
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
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:72
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:49
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:38
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:39
abstract class for mapping images to the screen
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
perform various plane computations
Definition: vtkPlane.h:36
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:49
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:65
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkTypeBool SliceFacesCamera