VTK  9.4.20250303
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
129#ifndef vtkImageMapper3D_h
130#define vtkImageMapper3D_h
131
132#include "vtkAbstractMapper3D.h"
133#include "vtkRenderingCoreModule.h" // For export macro
134#include "vtkThreads.h" // for VTK_MAX_THREADS
135#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
136
137VTK_ABI_NAMESPACE_BEGIN
138class vtkRenderer;
139class vtkProp3D;
140class vtkPoints;
141class vtkMatrix4x4;
142class vtkLookupTable;
144class vtkImageSlice;
145class vtkImageProperty;
146class vtkImageData;
147class vtkMultiThreader;
148class vtkImageToImageMapper3DFriendship;
149
150class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkImageMapper3D : public vtkAbstractMapper3D
151{
152public:
154 void PrintSelf(ostream& os, vtkIndent indent) override;
155
159 virtual void Render(vtkRenderer* renderer, vtkImageSlice* prop) = 0;
160
167
169
177
179
185 vtkSetMacro(Border, vtkTypeBool);
186 vtkBooleanMacro(Border, vtkTypeBool);
187 vtkGetMacro(Border, vtkTypeBool);
189
191
197 vtkSetMacro(Background, vtkTypeBool);
198 vtkBooleanMacro(Background, vtkTypeBool);
199 vtkGetMacro(Background, vtkTypeBool);
201
203
208 vtkSetMacro(SliceAtFocalPoint, vtkTypeBool);
209 vtkBooleanMacro(SliceAtFocalPoint, vtkTypeBool);
210 vtkGetMacro(SliceAtFocalPoint, vtkTypeBool);
212
214
219 vtkSetMacro(SliceFacesCamera, vtkTypeBool);
220 vtkBooleanMacro(SliceFacesCamera, vtkTypeBool);
221 vtkGetMacro(SliceFacesCamera, vtkTypeBool);
223
225
232 vtkGetObjectMacro(SlicePlane, vtkPlane);
234
240 virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4* propMatrix, double plane[4]);
241
243
246 vtkSetClampMacro(NumberOfThreads, int, 1, VTK_MAX_THREADS);
247 vtkGetMacro(NumberOfThreads, int);
249
251
260 vtkSetMacro(Streaming, vtkTypeBool);
261 vtkGetMacro(Streaming, vtkTypeBool);
262 vtkBooleanMacro(Streaming, vtkTypeBool);
264
265 // return the bounds in index space
266 virtual void GetIndexBounds(double extent[6]) = 0;
267
268protected:
271
273
276 int FillInputPortInformation(int port, vtkInformation* info) override;
277 int FillOutputPortInformation(int port, vtkInformation* info) override;
279
284 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
285
290 static void CheckerboardRGBA(unsigned char* data, int xsize, int ysize, double originx,
291 double originy, double spacingx, double spacingy);
292
309 unsigned char* MakeTextureData(vtkImageProperty* property, vtkImageData* input, int extent[6],
310 int& xsize, int& ysize, int& bytesPerPixel, bool& reuseTexture, bool& reuseData);
311
316 void MakeTextureGeometry(const int extent[6], double coords[12], double tcoords[8]);
317
325 virtual void ComputeTextureSize(
326 const int extent[6], int& xdim, int& ydim, int imageSize[2], int textureSize[2]);
327
333
337 vtkImageSlice* GetCurrentProp() { return this->CurrentProp; }
338
344
349 void GetBackgroundColor(vtkImageProperty* property, double color[4]);
350
357
358 // The slice.
362
363 // Information about the image, updated by UpdateInformation
364 double DataSpacing[3];
365 double DataOrigin[3];
366 double DataDirection[9];
367 int DataWholeExtent[6];
368
369 // Set by vtkImageStack when doing multi-pass rendering
373
374private:
375 // The prop this mapper is attached to, or zero if none.
376 vtkImageSlice* CurrentProp;
377 vtkRenderer* CurrentRenderer;
378
379 // The cached data-to-world matrix
380 vtkMatrix4x4* DataToWorldMatrix;
381
382 vtkImageMapper3D(const vtkImageMapper3D&) = delete;
383 void operator=(const vtkImageMapper3D&) = delete;
384
385 friend class vtkImageToImageMapper3DFriendship;
386};
387
388VTK_ABI_NAMESPACE_END
389#endif
abstract class specifies interface to map 3D data
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:165
topologically and geometrically regular array of data
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.
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 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:108
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
A class for performing multithreaded execution.
perform various plane computations
Definition vtkPlane.h:140
represent and manipulate 3D points
Definition vtkPoints.h:139
represents an 3D object for placement in a rendered scene
Definition vtkProp3D.h:89
abstract specification for renderers
Superclass for mapping scalar values to colors.
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_MARSHALAUTO