VTK  9.1.0
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 =========================================================================*/
138 #ifndef vtkImageMapper3D_h
139 #define vtkImageMapper3D_h
140 
141 #include "vtkAbstractMapper3D.h"
142 #include "vtkRenderingCoreModule.h" // For export macro
143 #include "vtkThreads.h" // for VTK_MAX_THREADS
144 
145 class vtkRenderer;
146 class vtkProp3D;
147 class vtkPoints;
148 class vtkMatrix4x4;
149 class vtkLookupTable;
150 class vtkScalarsToColors;
151 class vtkImageSlice;
152 class vtkImageProperty;
153 class vtkImageData;
154 class vtkMultiThreader;
155 class vtkImageToImageMapper3DFriendship;
156 
157 class VTKRENDERINGCORE_EXPORT vtkImageMapper3D : public vtkAbstractMapper3D
158 {
159 public:
161  void PrintSelf(ostream& os, vtkIndent indent) override;
162 
166  virtual void Render(vtkRenderer* renderer, vtkImageSlice* prop) = 0;
167 
173  void ReleaseGraphicsResources(vtkWindow*) override = 0;
174 
176 
184 
186 
192  vtkSetMacro(Border, vtkTypeBool);
193  vtkBooleanMacro(Border, vtkTypeBool);
194  vtkGetMacro(Border, vtkTypeBool);
196 
198 
204  vtkSetMacro(Background, vtkTypeBool);
205  vtkBooleanMacro(Background, vtkTypeBool);
206  vtkGetMacro(Background, vtkTypeBool);
208 
210 
215  vtkSetMacro(SliceAtFocalPoint, vtkTypeBool);
216  vtkBooleanMacro(SliceAtFocalPoint, vtkTypeBool);
217  vtkGetMacro(SliceAtFocalPoint, vtkTypeBool);
219 
221 
226  vtkSetMacro(SliceFacesCamera, vtkTypeBool);
227  vtkBooleanMacro(SliceFacesCamera, vtkTypeBool);
228  vtkGetMacro(SliceFacesCamera, vtkTypeBool);
230 
232 
239  vtkGetObjectMacro(SlicePlane, vtkPlane);
241 
247  virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4* propMatrix, double plane[4]);
248 
250 
253  vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
254  vtkGetMacro(NumberOfThreads, int);
256 
258 
267  vtkSetMacro(Streaming, vtkTypeBool);
268  vtkGetMacro(Streaming, vtkTypeBool);
269  vtkBooleanMacro(Streaming, vtkTypeBool);
271 
272  // return the bounds in index space
273  virtual void GetIndexBounds(double extent[6]) = 0;
274 
275 protected:
277  ~vtkImageMapper3D() override;
278 
280 
286 
291  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
292 
297  static void CheckerboardRGBA(unsigned char* data, int xsize, int ysize, double originx,
298  double originy, double spacingx, double spacingy);
299 
305  unsigned char* MakeTextureData(vtkImageProperty* property, vtkImageData* input, int extent[6],
306  int& xsize, int& ysize, int& bytesPerPixel, bool& reuseTexture, bool& reuseData);
307 
312  void MakeTextureGeometry(const int extent[6], double coords[12], double tcoords[8]);
313 
321  virtual void ComputeTextureSize(
322  const int extent[6], int& xdim, int& ydim, int imageSize[2], int textureSize[2]);
323 
329 
333  vtkImageSlice* GetCurrentProp() { return this->CurrentProp; }
334 
340 
345  void GetBackgroundColor(vtkImageProperty* property, double color[4]);
346 
353 
354  // The slice.
358 
359  // Information about the image, updated by UpdateInformation
360  double DataSpacing[3];
361  double DataOrigin[3];
362  double DataDirection[9];
363  int DataWholeExtent[6];
364 
365  // Set by vtkImageStack when doing multi-pass rendering
369 
370 private:
371  // The prop this mapper is attached to, or zero if none.
372  vtkImageSlice* CurrentProp;
373  vtkRenderer* CurrentRenderer;
374 
375  // The cached data-to-world matrix
376  vtkMatrix4x4* DataToWorldMatrix;
377 
378  vtkImageMapper3D(const vtkImageMapper3D&) = delete;
379  void operator=(const vtkImageMapper3D&) = delete;
380 
381  friend class vtkImageToImageMapper3DFriendship;
382 };
383 
384 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:143
vtkPlane
perform various plane computations
Definition: vtkPlane.h:143
vtkImageMapper3D::Threader
vtkMultiThreader * Threader
Definition: vtkImageMapper3D.h:350
vtkImageMapper3D::GetCurrentProp
vtkImageSlice * GetCurrentProp()
Get the vtkImage prop associated with this mapper, or zero if none.
Definition: vtkImageMapper3D.h:333
vtkImageMapper3D::Background
vtkTypeBool Background
Definition: vtkImageMapper3D.h:348
vtkProp3D
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:93
vtkImageMapper3D::GetIndexBounds
virtual void GetIndexBounds(double extent[6])=0
vtkX3D::data
@ data
Definition: vtkX3D.h:321
vtkImageMapper3D::ProcessRequest
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Handle requests from the pipeline executive.
vtkImageMapper3D::FillOutputPortInformation
int FillOutputPortInformation(int port, vtkInformation *info) override
See algorithm for more info.
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
vtkImageMapper3D::Render
virtual void Render(vtkRenderer *renderer, vtkImageSlice *prop)=0
This should only be called by the renderer.
vtkImageMapper3D::GetDataObjectInput
vtkDataObject * GetDataObjectInput()
The input data for this mapper.
vtkImageMapper3D::Border
vtkTypeBool Border
Definition: vtkImageMapper3D.h:347
vtkImageMapper3D::SliceFacesCamera
vtkTypeBool SliceFacesCamera
Definition: vtkImageMapper3D.h:357
vtkAbstractMapper3D.h
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
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:77
vtkX3D::color
@ color
Definition: vtkX3D.h:227
vtkX3D::port
@ port
Definition: vtkX3D.h:453
vtkImageSlice
represents an image in a 3D scene
Definition: vtkImageSlice.h:156
vtkX3D::Background
@ Background
Definition: vtkX3D.h:77
vtkImageMapper3D::MatteEnable
bool MatteEnable
Definition: vtkImageMapper3D.h:366
vtkImageProperty
image display properties
Definition: vtkImageProperty.h:146
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:145
vtkImageMapper3D::SliceAtFocalPoint
vtkTypeBool SliceAtFocalPoint
Definition: vtkImageMapper3D.h:356
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:351
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:109
vtkImageMapper3D::SlicePlane
vtkPlane * SlicePlane
Definition: vtkImageMapper3D.h:355
vtkImageMapper3D::DefaultLookupTable
vtkScalarsToColors * DefaultLookupTable
Definition: vtkImageMapper3D.h:349
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkLookupTable
map scalar values into colors via a lookup table
Definition: vtkLookupTable.h:178
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkImageMapper3D
abstract class for mapping images to the screen
Definition: vtkImageMapper3D.h:158
vtkAbstractMapper3D
abstract class specifies interface to map 3D data
Definition: vtkAbstractMapper3D.h:43
vtkImageMapper3D::vtkImageMapper3D
vtkImageMapper3D()
vtkImageMapper3D::GetInput
vtkImageData * GetInput()
The input data for this mapper.
vtkImageMapper3D::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
See algorithm for more info.
vtkImageMapper3D::ColorEnable
bool ColorEnable
Definition: vtkImageMapper3D.h:367
vtkImageMapper3D::GetDataSetInput
vtkDataSet * GetDataSetInput()
The input data for this mapper.
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:182
vtkImageMapper3D::Streaming
vtkTypeBool Streaming
Definition: vtkImageMapper3D.h:352
vtkImageMapper3D::SetInputData
void SetInputData(vtkImageData *input)
The input data for this mapper.
vtkX3D::extent
@ extent
Definition: vtkX3D.h:351
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:368
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:169
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