VTK  9.3.20240328
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
130 #ifndef vtkImageSliceMapper_h
131 #define vtkImageSliceMapper_h
132 
133 #include "vtkImageMapper3D.h"
134 #include "vtkRenderingCoreModule.h" // For export macro
135 
136 VTK_ABI_NAMESPACE_BEGIN
137 class vtkCamera;
138 class vtkPoints;
139 
140 class VTKRENDERINGCORE_EXPORT vtkImageSliceMapper : public vtkImageMapper3D
141 {
142 public:
145  void PrintSelf(ostream& os, vtkIndent indent) override;
146 
148 
151  virtual void SetSliceNumber(int slice);
152  virtual int GetSliceNumber();
154 
156 
161  virtual int GetSliceNumberMinValue();
162  virtual int GetSliceNumberMaxValue();
164 
166 
171  vtkSetClampMacro(Orientation, int, 0, 2);
172  vtkGetMacro(Orientation, int);
173  void SetOrientationToI() { this->SetOrientation(0); }
174  void SetOrientationToJ() { this->SetOrientation(1); }
175  void SetOrientationToK() { this->SetOrientation(2); }
176  // old methods
177  void SetOrientationToX() { this->SetOrientation(0); }
178  void SetOrientationToY() { this->SetOrientation(1); }
179  void SetOrientationToZ() { this->SetOrientation(2); }
181 
183 
187  vtkSetMacro(Cropping, vtkTypeBool);
188  vtkBooleanMacro(Cropping, vtkTypeBool);
189  vtkGetMacro(Cropping, vtkTypeBool);
191 
193 
197  vtkSetVector6Macro(CroppingRegion, int);
198  vtkGetVector6Macro(CroppingRegion, int);
200 
204  void Render(vtkRenderer* renderer, vtkImageSlice* prop) override;
205 
212 
216  vtkMTimeType GetMTime() override;
217 
219 
223  double* GetBounds() override;
224  void GetBounds(double bounds[6]) override { this->vtkAbstractMapper3D::GetBounds(bounds); }
226 
227  // return the bounds in index space
228  void GetIndexBounds(double extent[6]) override;
229 
235  void GetSlicePlaneInDataCoords(vtkMatrix4x4* propMatrix, double plane[4]) override;
236 
241  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
242 
244 
248  void SetDisplayExtent(const int extent[6])
249  {
250  this->DisplayExtent[0] = extent[0];
251  this->DisplayExtent[1] = extent[1];
252  this->DisplayExtent[2] = extent[2];
253  this->DisplayExtent[3] = extent[3];
254  this->DisplayExtent[4] = extent[4];
255  this->DisplayExtent[5] = extent[5];
256  }
258 
259 protected:
262 
268  vtkPoints* GetPoints() { return this->Points; }
269 
274  void SetExactPixelMatch(int v) { this->ExactPixelMatch = (v != 0); }
275 
280  void SetPassColorData(int v) { this->PassColorData = (v != 0); }
281 
287  int GetOrientationFromCamera(double const* propMatrix, vtkCamera* camera);
288 
292  int GetSliceFromCamera(double const* propMatrix, vtkCamera* camera);
293 
297  static void GetDimensionIndices(int orientation, int& xdim, int& ydim);
298 
304  int CroppingRegion[6];
305  int DisplayExtent[6];
309 
310 private:
311  vtkImageSliceMapper(const vtkImageSliceMapper&) = delete;
312  void operator=(const vtkImageSliceMapper&) = delete;
313 
314  friend class vtkImageResliceMapper;
315 };
316 
317 VTK_ABI_NAMESPACE_END
318 #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:150
abstract class for mapping images to the screen
map a slice of a vtkImageData to the screen
map a slice of a vtkImageData to the screen
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.
void SetOrientationToZ()
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.
double * GetBounds() override
The bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
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.
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:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:140
represent and manipulate 3D points
Definition: vtkPoints.h:138
abstract specification for renderers
Definition: vtkRenderer.h:171
window superclass for vtkRenderWindow
Definition: vtkWindow.h:47
@ points
Definition: vtkX3D.h:446
@ orientation
Definition: vtkX3D.h:262
@ extent
Definition: vtkX3D.h:345
int vtkTypeBool
Definition: vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270