VTK  9.7.1
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
21 #ifndef vtkImageSliceMapper_h
22 #define vtkImageSliceMapper_h
23 
24 #include "vtkImageMapper3D.h"
25 #include "vtkRenderingCoreModule.h" // For export macro
26 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
27 
28 VTK_ABI_NAMESPACE_BEGIN
29 class vtkCamera;
30 class vtkPoints;
31 
32 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkImageSliceMapper : public vtkImageMapper3D
33 {
34 public:
35  static vtkImageSliceMapper* New();
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
40 
43  virtual void SetSliceNumber(int slice);
44  virtual int GetSliceNumber();
46 
48 
53  virtual int GetSliceNumberMinValue();
54  virtual int GetSliceNumberMaxValue();
56 
58 
63  vtkSetClampMacro(Orientation, int, 0, 2);
64  vtkGetMacro(Orientation, int);
65  void SetOrientationToI() { this->SetOrientation(0); }
66  void SetOrientationToJ() { this->SetOrientation(1); }
67  void SetOrientationToK() { this->SetOrientation(2); }
68  // old methods
69  void SetOrientationToX() { this->SetOrientation(0); }
70  void SetOrientationToY() { this->SetOrientation(1); }
71  void SetOrientationToZ() { this->SetOrientation(2); }
73 
75 
79  vtkSetMacro(Cropping, vtkTypeBool);
80  vtkBooleanMacro(Cropping, vtkTypeBool);
81  vtkGetMacro(Cropping, vtkTypeBool);
83 
85 
89  vtkSetVector6Macro(CroppingRegion, int);
90  vtkGetVector6Macro(CroppingRegion, int);
92 
96  void Render(vtkRenderer* renderer, vtkImageSlice* prop) override;
97 
103  void ReleaseGraphicsResources(vtkWindow*) override;
104 
108  vtkMTimeType GetMTime() override;
109 
111 
115  double* GetBounds() override;
116  void GetBounds(double bounds[6]) override { this->vtkAbstractMapper3D::GetBounds(bounds); }
118 
119  // return the bounds in index space
120  void GetIndexBounds(double extent[6]) override;
121 
127  void GetSlicePlaneInDataCoords(vtkMatrix4x4* propMatrix, double plane[4]) override;
128 
133  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
134 
136 
140  void SetDisplayExtent(const int extent[6])
141  {
142  this->DisplayExtent[0] = extent[0];
143  this->DisplayExtent[1] = extent[1];
144  this->DisplayExtent[2] = extent[2];
145  this->DisplayExtent[3] = extent[3];
146  this->DisplayExtent[4] = extent[4];
147  this->DisplayExtent[5] = extent[5];
148  }
150 
152 
157  vtkSetMacro(OutputPointsPrecision, int);
158  vtkGetMacro(OutputPointsPrecision, int);
160 
161 protected:
163  ~vtkImageSliceMapper() override;
164 
169  void SetPoints(vtkPoints* points);
170  vtkPoints* GetPoints() { return this->Points; }
171 
176  void SetExactPixelMatch(int v) { this->ExactPixelMatch = (v != 0); }
177 
182  void SetPassColorData(int v) { this->PassColorData = (v != 0); }
183 
189  int GetOrientationFromCamera(double const* propMatrix, vtkCamera* camera);
190 
194  int GetSliceFromCamera(double const* propMatrix, vtkCamera* camera);
195 
199  static void GetDimensionIndices(int orientation, int& xdim, int& ydim);
200 
206  int CroppingRegion[6];
207  int DisplayExtent[6];
211 
212 private:
213  vtkImageSliceMapper(const vtkImageSliceMapper&) = delete;
214  void operator=(const vtkImageSliceMapper&) = delete;
215 
216  int OutputPointsPrecision{ vtkAlgorithm::DesiredOutputPrecision::DEFAULT_PRECISION };
217 
218  friend class vtkImageResliceMapper;
219 };
220 
221 VTK_ABI_NAMESPACE_END
222 #endif
void ReleaseGraphicsResources(vtkWindow *) override=0
Release any graphics resources that are being consumed by this mapper.
void SetExactPixelMatch(int v)
Force linear interpolation.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:31
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
vtkMTimeType GetMTime() override
Override Modifiedtime as we have added Clipping planes.
void SetOrientationToK()
Set the orientation of the slices to display.
abstract specification for renderers
Definition: vtkRenderer.h:63
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.
void SetPassColorData(int v)
Pass color data.
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
void SetOrientationToX()
Set the orientation of the slices to display.
a simple class to control print indentation
Definition: vtkIndent.h:28
abstract class for mapping images to the screen
map a slice of a vtkImageData to the screen
a virtual camera for 3D rendering
Definition: vtkCamera.h:41
void GetBounds(double bounds[6]) override
The bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax, zmin,zmax).
virtual void Render(vtkRenderer *renderer, vtkImageSlice *prop)=0
This should only be called by the renderer.
virtual double * GetBounds()=0
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax, zmin,zmax).
void SetOrientationToZ()
Set the orientation of the slices to display.
void SetOrientationToI()
Set the orientation of the slices to display.
virtual void GetIndexBounds(double extent[6])=0
represents an image in a 3D scene
Definition: vtkImageSlice.h:39
void SetOrientationToY()
Set the orientation of the slices to display.
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Handle requests from the pipeline executive.
Store zero or more vtkInformation instances.
map a slice of a vtkImageData to the screen
static vtkAlgorithm * New()
#define VTK_MARSHALAUTO
virtual void GetSlicePlaneInDataCoords(vtkMatrix4x4 *propMatrix, double plane[4])
Get the plane as a homogeneous 4-vector that gives the plane equation coefficients.
represent and manipulate 3D points
Definition: vtkPoints.h:30
void SetOrientationToJ()
Set the orientation of the slices to display.