VTK  9.0.1
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 =========================================================================*/
30 #ifndef vtkImageSliceMapper_h
31 #define vtkImageSliceMapper_h
32 
33 #include "vtkImageMapper3D.h"
34 #include "vtkRenderingCoreModule.h" // For export macro
35 
36 class vtkCamera;
37 class vtkPoints;
38 
39 class VTKRENDERINGCORE_EXPORT vtkImageSliceMapper : public vtkImageMapper3D
40 {
41 public:
42  static vtkImageSliceMapper* New();
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
47 
50  virtual void SetSliceNumber(int slice);
51  virtual int GetSliceNumber();
53 
55 
60  virtual int GetSliceNumberMinValue();
61  virtual int GetSliceNumberMaxValue();
63 
65 
70  vtkSetClampMacro(Orientation, int, 0, 2);
71  vtkGetMacro(Orientation, int);
72  void SetOrientationToI() { this->SetOrientation(0); }
73  void SetOrientationToJ() { this->SetOrientation(1); }
74  void SetOrientationToK() { this->SetOrientation(2); }
75  // old methods
76  void SetOrientationToX() { this->SetOrientation(0); }
77  void SetOrientationToY() { this->SetOrientation(1); }
78  void SetOrientationToZ() { this->SetOrientation(2); }
80 
82 
86  vtkSetMacro(Cropping, vtkTypeBool);
87  vtkBooleanMacro(Cropping, vtkTypeBool);
88  vtkGetMacro(Cropping, vtkTypeBool);
90 
92 
96  vtkSetVector6Macro(CroppingRegion, int);
97  vtkGetVector6Macro(CroppingRegion, int);
99 
103  void Render(vtkRenderer* renderer, vtkImageSlice* prop) override;
104 
110  void ReleaseGraphicsResources(vtkWindow*) override;
111 
115  vtkMTimeType GetMTime() override;
116 
118 
122  double* GetBounds() override;
123  void GetBounds(double bounds[6]) override { this->vtkAbstractMapper3D::GetBounds(bounds); }
125 
126  // return the bounds in index space
127  void GetIndexBounds(double extent[6]) override;
128 
134  void GetSlicePlaneInDataCoords(vtkMatrix4x4* propMatrix, double plane[4]) override;
135 
140  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
141 
142 protected:
144  ~vtkImageSliceMapper() override;
145 
150  void SetPoints(vtkPoints* points);
151  vtkPoints* GetPoints() { return this->Points; }
152 
157  void SetExactPixelMatch(int v) { this->ExactPixelMatch = (v != 0); }
158 
163  void SetPassColorData(int v) { this->PassColorData = (v != 0); }
164 
166 
170  void SetDisplayExtent(const int extent[6])
171  {
172  this->DisplayExtent[0] = extent[0];
173  this->DisplayExtent[1] = extent[1];
174  this->DisplayExtent[2] = extent[2];
175  this->DisplayExtent[3] = extent[3];
176  this->DisplayExtent[4] = extent[4];
177  this->DisplayExtent[5] = extent[5];
178  }
180 
186  int GetOrientationFromCamera(double const* propMatrix, vtkCamera* camera);
187 
191  int GetSliceFromCamera(double const* propMatrix, vtkCamera* camera);
192 
196  static void GetDimensionIndices(int orientation, int& xdim, int& ydim);
197 
203  int CroppingRegion[6];
204  int DisplayExtent[6];
208 
209 private:
210  vtkImageSliceMapper(const vtkImageSliceMapper&) = delete;
211  void operator=(const vtkImageSliceMapper&) = delete;
212 
213  friend class vtkImageResliceMapper;
214 };
215 
216 #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:35
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293
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:67
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:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
void SetOrientationToX()
Set the orientation of the slices to display.
a simple class to control print indentation
Definition: vtkIndent.h:33
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:45
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:46
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()
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:33
void SetOrientationToJ()
Set the orientation of the slices to display.