VTK  9.4.20251007
vtkImageSliceMapper.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
23
24#ifndef vtkImageSliceMapper_h
25#define vtkImageSliceMapper_h
26
27#include "vtkImageMapper3D.h"
28#include "vtkRenderingCoreModule.h" // For export macro
29#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
30
31VTK_ABI_NAMESPACE_BEGIN
32class vtkCamera;
33class vtkPoints;
34
35class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkImageSliceMapper : public vtkImageMapper3D
36{
37public:
40 void PrintSelf(ostream& os, vtkIndent indent) override;
41
43
46 virtual void SetSliceNumber(int slice);
47 virtual int GetSliceNumber();
49
51
59
61
66 vtkSetClampMacro(Orientation, int, 0, 2);
67 vtkGetMacro(Orientation, int);
68 void SetOrientationToI() { this->SetOrientation(0); }
69 void SetOrientationToJ() { this->SetOrientation(1); }
70 void SetOrientationToK() { this->SetOrientation(2); }
71 // old methods
72 void SetOrientationToX() { this->SetOrientation(0); }
73 void SetOrientationToY() { this->SetOrientation(1); }
74 void SetOrientationToZ() { this->SetOrientation(2); }
76
78
82 vtkSetMacro(Cropping, vtkTypeBool);
83 vtkBooleanMacro(Cropping, vtkTypeBool);
84 vtkGetMacro(Cropping, vtkTypeBool);
86
88
92 vtkSetVector6Macro(CroppingRegion, int);
93 vtkGetVector6Macro(CroppingRegion, int);
95
99 void Render(vtkRenderer* renderer, vtkImageSlice* prop) override;
100
107
112
114
118 double* GetBounds() override;
119 void GetBounds(double bounds[6]) override { this->vtkAbstractMapper3D::GetBounds(bounds); }
121
122 // return the bounds in index space
123 void GetIndexBounds(double extent[6]) override;
124
130 void GetSlicePlaneInDataCoords(vtkMatrix4x4* propMatrix, double plane[4]) override;
131
136 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
137
139
143 void SetDisplayExtent(const int extent[6])
144 {
145 this->DisplayExtent[0] = extent[0];
146 this->DisplayExtent[1] = extent[1];
147 this->DisplayExtent[2] = extent[2];
148 this->DisplayExtent[3] = extent[3];
149 this->DisplayExtent[4] = extent[4];
150 this->DisplayExtent[5] = extent[5];
151 }
152
153
154protected:
157
162 void SetPoints(vtkPoints* points);
163 vtkPoints* GetPoints() { return this->Points; }
164
169 void SetExactPixelMatch(int v) { this->ExactPixelMatch = (v != 0); }
170
175 void SetPassColorData(int v) { this->PassColorData = (v != 0); }
176
182 int GetOrientationFromCamera(double const* propMatrix, vtkCamera* camera);
183
187 int GetSliceFromCamera(double const* propMatrix, vtkCamera* camera);
188
192 static void GetDimensionIndices(int orientation, int& xdim, int& ydim);
193
204
205private:
207 void operator=(const vtkImageSliceMapper&) = delete;
208
210};
211
212VTK_ABI_NAMESPACE_END
213#endif
virtual double * GetBounds()=0
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
a virtual camera for 3D rendering
Definition vtkCamera.h:42
int GetOrientationFromCamera(double const *propMatrix, vtkCamera *camera)
Get the camera orientation as a simple integer [0,1,2,3,4,5] that indicates one of the six major dire...
virtual int GetSliceNumberMaxValue()
Use GetSliceNumberMinValue() and GetSliceNumberMaxValue() to get the range of allowed slices.
void GetIndexBounds(double extent[6]) override
void SetOrientationToX()
Set the orientation of the slices to display.
friend class vtkImageResliceMapper
void SetOrientationToZ()
Set the orientation of the slices to display.
virtual void SetOrientation(int)
Set the orientation of the slices to display.
virtual int GetSliceNumberMinValue()
Use GetSliceNumberMinValue() and GetSliceNumberMaxValue() to get the range of allowed slices.
void GetSlicePlaneInDataCoords(vtkMatrix4x4 *propMatrix, double plane[4]) override
Get the plane as a homogeneous 4-vector that gives the plane equation coefficients.
virtual void SetSliceNumber(int slice)
The slice to display, if there are multiple slices.
void GetBounds(double bounds[6]) override
The bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
void SetExactPixelMatch(int v)
Force linear interpolation.
int GetSliceFromCamera(double const *propMatrix, vtkCamera *camera)
Get the current slice as the one closest to the focal point.
void SetPoints(vtkPoints *points)
Set points that describe a polygon on which the slice will be rendered.
static void GetDimensionIndices(int orientation, int &xdim, int &ydim)
Get the dimension indices according to the orientation.
void SetPassColorData(int v)
Pass color data.
vtkMTimeType GetMTime() override
Get the mtime for the mapper.
~vtkImageSliceMapper() override
void Render(vtkRenderer *renderer, vtkImageSlice *prop) override
This should only be called by the renderer.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetDisplayExtent(const int extent[6])
Set the display extent.
virtual int GetSliceNumber()
The slice to display, if there are multiple slices.
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Handle requests from the pipeline executive.
double * GetBounds() override
The bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
void SetOrientationToK()
Set the orientation of the slices to display.
void SetOrientationToI()
Set the orientation of the slices to display.
static vtkImageSliceMapper * New()
void SetOrientationToJ()
Set the orientation of the slices to display.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
void SetOrientationToY()
Set the orientation of the slices to display.
represents an image in a 3D scene
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 4x4 transformation matrices
represent and manipulate 3D points
Definition vtkPoints.h:30
abstract specification for renderers
Definition vtkRenderer.h:63
window superclass for vtkRenderWindow
Definition vtkWindow.h:29
int vtkTypeBool
Definition vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_MARSHALAUTO