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=========================================================================*/
141#ifndef vtkImageMapper3D_h
142#define vtkImageMapper3D_h
143
144#include "vtkAbstractMapper3D.h"
145#include "vtkRenderingCoreModule.h" // For export macro
146#include "vtkThreads.h" // for VTK_MAX_THREADS
147
148class vtkRenderer;
149class vtkProp3D;
150class vtkPoints;
151class vtkMatrix4x4;
152class vtkLookupTable;
154class vtkImageSlice;
155class vtkImageProperty;
156class vtkImageData;
157class vtkMultiThreader;
158class vtkImageToImageMapper3DFriendship;
159
160class VTKRENDERINGCORE_EXPORT vtkImageMapper3D : public vtkAbstractMapper3D
161{
162public:
164 void PrintSelf(ostream& os, vtkIndent indent) override;
165
169 virtual void Render(vtkRenderer* renderer, vtkImageSlice* prop) = 0;
170
177
179
187
189
195 vtkSetMacro(Border, vtkTypeBool);
196 vtkBooleanMacro(Border, vtkTypeBool);
197 vtkGetMacro(Border, vtkTypeBool);
199
201
207 vtkSetMacro(Background, vtkTypeBool);
208 vtkBooleanMacro(Background, vtkTypeBool);
209 vtkGetMacro(Background, vtkTypeBool);
211
213
218 vtkSetMacro(SliceAtFocalPoint, vtkTypeBool);
219 vtkBooleanMacro(SliceAtFocalPoint, vtkTypeBool);
220 vtkGetMacro(SliceAtFocalPoint, vtkTypeBool);
222
224
229 vtkSetMacro(SliceFacesCamera, vtkTypeBool);
230 vtkBooleanMacro(SliceFacesCamera, vtkTypeBool);
231 vtkGetMacro(SliceFacesCamera, vtkTypeBool);
233
235
242 vtkGetObjectMacro(SlicePlane, vtkPlane);
244
250 virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4* propMatrix, double plane[4]);
251
253
256 vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
257 vtkGetMacro(NumberOfThreads, int);
259
261
270 vtkSetMacro(Streaming, vtkTypeBool);
271 vtkGetMacro(Streaming, vtkTypeBool);
272 vtkBooleanMacro(Streaming, vtkTypeBool);
274
275 // return the bounds in index space
276 virtual void GetIndexBounds(double extent[6]) = 0;
277
278protected:
281
283
289
294 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
295
300 static void CheckerboardRGBA(unsigned char* data, int xsize, int ysize, double originx,
301 double originy, double spacingx, double spacingy);
302
308 unsigned char* MakeTextureData(vtkImageProperty* property, vtkImageData* input, int extent[6],
309 int& xsize, int& ysize, int& bytesPerPixel, bool& reuseTexture, bool& reuseData);
310
315 void MakeTextureGeometry(const int extent[6], double coords[12], double tcoords[8]);
316
324 virtual void ComputeTextureSize(
325 const int extent[6], int& xdim, int& ydim, int imageSize[2], int textureSize[2]);
326
332
336 vtkImageSlice* GetCurrentProp() { return this->CurrentProp; }
337
343
348 void GetBackgroundColor(vtkImageProperty* property, double color[4]);
349
356
357 // The slice.
361
362 // Information about the image, updated by UpdateInformation
363 double DataSpacing[3];
364 double DataOrigin[3];
365 double DataDirection[9];
366 int DataWholeExtent[6];
367
368 // Set by vtkImageStack when doing multi-pass rendering
372
373private:
374 // The prop this mapper is attached to, or zero if none.
375 vtkImageSlice* CurrentProp;
376 vtkRenderer* CurrentRenderer;
377
378 // The cached data-to-world matrix
379 vtkMatrix4x4* DataToWorldMatrix;
380
381 vtkImageMapper3D(const vtkImageMapper3D&) = delete;
382 void operator=(const vtkImageMapper3D&) = delete;
383
384 friend class vtkImageToImageMapper3DFriendship;
385};
386
387#endif
abstract class specifies interface to map 3D data
general representation of visualization data
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
topologically and geometrically regular array of data
Definition: vtkImageData.h:163
abstract class for mapping images to the screen
virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4 *propMatrix, double plane[4])
Get the plane as a homogeneous 4-vector that gives the plane equation coefficients.
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),...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkDataSet * GetDataSetInput()
The input data for this mapper.
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.
vtkScalarsToColors * DefaultLookupTable
vtkMultiThreader * Threader
vtkImageData * GetInput()
The input data for this mapper.
vtkImageSlice * GetCurrentProp()
Get the vtkImage prop associated with this mapper, or zero if none.
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...
int FillOutputPortInformation(int port, vtkInformation *info) override
See algorithm for more info.
vtkTypeBool SliceFacesCamera
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...
vtkDataObject * GetDataObjectInput()
The input data for this mapper.
virtual void Render(vtkRenderer *renderer, vtkImageSlice *prop)=0
This should only be called by the renderer.
vtkRenderer * GetCurrentRenderer()
Get the renderer associated with this mapper, or zero if none.
vtkTypeBool Background
virtual void GetIndexBounds(double extent[6])=0
void ReleaseGraphicsResources(vtkWindow *) override=0
Release any graphics resources that are being consumed by this mapper.
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() override
void SetInputData(vtkImageData *input)
The input data for this mapper.
vtkTypeBool Streaming
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Handle requests from the pipeline executive.
int FillInputPortInformation(int port, vtkInformation *info) override
See algorithm for more info.
vtkTypeBool SliceAtFocalPoint
vtkMatrix4x4 * GetDataToWorldMatrix()
Get the data-to-world matrix for this mapper, according to the assembly path for its prop.
image display properties
represents an image in a 3D scene
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
map scalar values into colors via a lookup table
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:151
A class for performing multithreaded execution.
perform various plane computations
Definition: vtkPlane.h:146
represent and manipulate 3D points
Definition: vtkPoints.h:149
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:99
abstract specification for renderers
Definition: vtkRenderer.h:182
Superclass for mapping scalar values to colors.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ Background
Definition: vtkX3D.h:77
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ extent
Definition: vtkX3D.h:351
@ color
Definition: vtkX3D.h:227
@ data
Definition: vtkX3D.h:321
int vtkTypeBool
Definition: vtkABI.h:69