VTK  9.2.5
vtkImageSliceMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageSliceMapper.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 =========================================================================*/
142 #ifndef vtkImageSliceMapper_h
143 #define vtkImageSliceMapper_h
144 
145 #include "vtkImageMapper3D.h"
146 #include "vtkRenderingCoreModule.h" // For export macro
147 
148 class vtkCamera;
149 class vtkPoints;
150 
151 class VTKRENDERINGCORE_EXPORT vtkImageSliceMapper : public vtkImageMapper3D
152 {
153 public:
156  void PrintSelf(ostream& os, vtkIndent indent) override;
157 
159 
162  virtual void SetSliceNumber(int slice);
163  virtual int GetSliceNumber();
165 
167 
172  virtual int GetSliceNumberMinValue();
173  virtual int GetSliceNumberMaxValue();
175 
177 
182  vtkSetClampMacro(Orientation, int, 0, 2);
183  vtkGetMacro(Orientation, int);
184  void SetOrientationToI() { this->SetOrientation(0); }
185  void SetOrientationToJ() { this->SetOrientation(1); }
186  void SetOrientationToK() { this->SetOrientation(2); }
187  // old methods
188  void SetOrientationToX() { this->SetOrientation(0); }
189  void SetOrientationToY() { this->SetOrientation(1); }
190  void SetOrientationToZ() { this->SetOrientation(2); }
192 
194 
198  vtkSetMacro(Cropping, vtkTypeBool);
199  vtkBooleanMacro(Cropping, vtkTypeBool);
200  vtkGetMacro(Cropping, vtkTypeBool);
202 
204 
208  vtkSetVector6Macro(CroppingRegion, int);
209  vtkGetVector6Macro(CroppingRegion, int);
211 
215  void Render(vtkRenderer* renderer, vtkImageSlice* prop) override;
216 
223 
227  vtkMTimeType GetMTime() override;
228 
230 
234  double* GetBounds() override;
235  void GetBounds(double bounds[6]) override { this->vtkAbstractMapper3D::GetBounds(bounds); }
237 
238  // return the bounds in index space
239  void GetIndexBounds(double extent[6]) override;
240 
246  void GetSlicePlaneInDataCoords(vtkMatrix4x4* propMatrix, double plane[4]) override;
247 
252  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
253 
255 
259  void SetDisplayExtent(const int extent[6])
260  {
261  this->DisplayExtent[0] = extent[0];
262  this->DisplayExtent[1] = extent[1];
263  this->DisplayExtent[2] = extent[2];
264  this->DisplayExtent[3] = extent[3];
265  this->DisplayExtent[4] = extent[4];
266  this->DisplayExtent[5] = extent[5];
267  }
269 
270 protected:
273 
279  vtkPoints* GetPoints() { return this->Points; }
280 
285  void SetExactPixelMatch(int v) { this->ExactPixelMatch = (v != 0); }
286 
291  void SetPassColorData(int v) { this->PassColorData = (v != 0); }
292 
298  int GetOrientationFromCamera(double const* propMatrix, vtkCamera* camera);
299 
303  int GetSliceFromCamera(double const* propMatrix, vtkCamera* camera);
304 
308  static void GetDimensionIndices(int orientation, int& xdim, int& ydim);
309 
315  int CroppingRegion[6];
316  int DisplayExtent[6];
320 
321 private:
322  vtkImageSliceMapper(const vtkImageSliceMapper&) = delete;
323  void operator=(const vtkImageSliceMapper&) = delete;
324 
325  friend class vtkImageResliceMapper;
326 };
327 
328 #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:161
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:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:151
represent and manipulate 3D points
Definition: vtkPoints.h:149
abstract specification for renderers
Definition: vtkRenderer.h:182
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ points
Definition: vtkX3D.h:452
@ orientation
Definition: vtkX3D.h:268
@ extent
Definition: vtkX3D.h:351
int vtkTypeBool
Definition: vtkABI.h:69
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287