VTK  9.7.1
vtkImageMapper3D.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
20 #ifndef vtkImageMapper3D_h
21 #define vtkImageMapper3D_h
22 
23 #include "vtkAbstractMapper3D.h"
24 #include "vtkRenderingCoreModule.h" // For export macro
25 #include "vtkThreads.h" // for VTK_MAX_THREADS
26 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
27 
28 VTK_ABI_NAMESPACE_BEGIN
29 class vtkRenderer;
30 class vtkProp3D;
31 class vtkPoints;
32 class vtkMatrix4x4;
33 class vtkLookupTable;
34 class vtkScalarsToColors;
35 class vtkImageSlice;
36 class vtkImageProperty;
37 class vtkImageData;
38 class vtkMultiThreader;
39 class vtkImageToImageMapper3DFriendship;
40 
41 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkImageMapper3D : public vtkAbstractMapper3D
42 {
43 public:
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
50  virtual void Render(vtkRenderer* renderer, vtkImageSlice* prop) = 0;
51 
57  void ReleaseGraphicsResources(vtkWindow*) override = 0;
58 
60 
63  void SetInputData(vtkImageData* input);
64  vtkImageData* GetInput();
65  vtkDataSet* GetDataSetInput();
66  vtkDataObject* GetDataObjectInput();
68 
70 
76  vtkSetMacro(Border, vtkTypeBool);
77  vtkBooleanMacro(Border, vtkTypeBool);
78  vtkGetMacro(Border, vtkTypeBool);
80 
82 
88  vtkSetMacro(Background, vtkTypeBool);
89  vtkBooleanMacro(Background, vtkTypeBool);
90  vtkGetMacro(Background, vtkTypeBool);
92 
94 
99  vtkSetMacro(SliceAtFocalPoint, vtkTypeBool);
100  vtkBooleanMacro(SliceAtFocalPoint, vtkTypeBool);
101  vtkGetMacro(SliceAtFocalPoint, vtkTypeBool);
103 
105 
110  vtkSetMacro(SliceFacesCamera, vtkTypeBool);
111  vtkBooleanMacro(SliceFacesCamera, vtkTypeBool);
112  vtkGetMacro(SliceFacesCamera, vtkTypeBool);
114 
116 
123  vtkGetObjectMacro(SlicePlane, vtkPlane);
125 
131  virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4* propMatrix, double plane[4]);
132 
134 
137  vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
138  vtkGetMacro(NumberOfThreads, int);
140 
142 
151  vtkSetMacro(Streaming, vtkTypeBool);
152  vtkGetMacro(Streaming, vtkTypeBool);
153  vtkBooleanMacro(Streaming, vtkTypeBool);
155 
156  // return the bounds in index space
157  virtual void GetIndexBounds(double extent[6]) = 0;
158 
159 protected:
161  ~vtkImageMapper3D() override;
162 
164 
167  int FillInputPortInformation(int port, vtkInformation* info) override;
170 
175  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
176 
181  static void CheckerboardRGBA(unsigned char* data, int xsize, int ysize, double originx,
182  double originy, double spacingx, double spacingy);
183 
200  unsigned char* MakeTextureData(vtkImageProperty* property, vtkImageData* input, int extent[6],
201  int& xsize, int& ysize, int& bytesPerPixel, bool& reuseTexture, bool& reuseData);
202 
207  void MakeTextureGeometry(const int extent[6], double coords[12], double tcoords[8]);
208 
216  virtual void ComputeTextureSize(
217  const int extent[6], int& xdim, int& ydim, int imageSize[2], int textureSize[2]);
218 
223  vtkRenderer* GetCurrentRenderer();
224 
228  vtkImageSlice* GetCurrentProp() { return this->CurrentProp; }
229 
234  vtkMatrix4x4* GetDataToWorldMatrix();
235 
240  void GetBackgroundColor(vtkImageProperty* property, double color[4]);
241 
248 
249  // The slice.
253 
254  // Information about the image, updated by UpdateInformation
255  double DataSpacing[3];
256  double DataOrigin[3];
257  double DataDirection[9];
258  int DataWholeExtent[6];
259 
260  // Set by vtkImageStack when doing multi-pass rendering
264 
265 private:
266  // The prop this mapper is attached to, or zero if none.
267  vtkImageSlice* CurrentProp;
268  vtkRenderer* CurrentRenderer;
269 
270  // The cached data-to-world matrix
271  vtkMatrix4x4* DataToWorldMatrix;
272 
273  vtkImageMapper3D(const vtkImageMapper3D&) = delete;
274  void operator=(const vtkImageMapper3D&) = delete;
275 
276  friend class vtkImageToImageMapper3DFriendship;
277 };
278 
279 VTK_ABI_NAMESPACE_END
280 #endif
vtkTypeBool SliceAtFocalPoint
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:31
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:63
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:39
int vtkTypeBool
Definition: vtkABI.h:64
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:41
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:28
abstract class for mapping images to the screen
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
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:39
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
Store zero or more vtkInformation instances.
#define VTK_MARSHALAUTO
general representation of visualization data
Definition: vtkDataObject.h:55
represent and manipulate 3D points
Definition: vtkPoints.h:30
vtkTypeBool SliceFacesCamera