VTK
vtkImageResliceMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageResliceMapper.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 =========================================================================*/
29 #ifndef vtkImageResliceMapper_h
30 #define vtkImageResliceMapper_h
31 
32 #include "vtkImageMapper3D.h"
33 #include "vtkRenderingImageModule.h" // For export macro
34 
35 
37 class vtkRenderer;
38 class vtkRenderWindow;
39 class vtkCamera;
40 class vtkLookupTable;
41 class vtkImageSlice;
42 class vtkImageData;
44 class vtkMatrix4x4;
46 
47 class VTKRENDERINGIMAGE_EXPORT vtkImageResliceMapper : public vtkImageMapper3D {
48 public:
49  static vtkImageResliceMapper *New();
51  void PrintSelf(ostream &os, vtkIndent indent) override;
52 
59  virtual void SetSlicePlane(vtkPlane *plane);
60 
62 
68  vtkSetMacro(JumpToNearestSlice, vtkTypeBool);
69  vtkBooleanMacro(JumpToNearestSlice, vtkTypeBool);
70  vtkGetMacro(JumpToNearestSlice, vtkTypeBool);
72 
74 
77  vtkSetMacro(SlabThickness, double);
78  vtkGetMacro(SlabThickness, double);
80 
82 
91  vtkSetClampMacro(SlabType, int, VTK_IMAGE_SLAB_MIN, VTK_IMAGE_SLAB_SUM);
92  vtkGetMacro(SlabType, int);
93  void SetSlabTypeToMin() { this->SetSlabType(VTK_IMAGE_SLAB_MIN); };
94  void SetSlabTypeToMax() { this->SetSlabType(VTK_IMAGE_SLAB_MAX); };
95  void SetSlabTypeToMean() { this->SetSlabType(VTK_IMAGE_SLAB_MEAN); };
96  void SetSlabTypeToSum() { this->SetSlabType(VTK_IMAGE_SLAB_SUM); };
97  virtual const char *GetSlabTypeAsString();
99 
101 
106  vtkSetClampMacro(SlabSampleFactor, int, 1, 2);
107  vtkGetMacro(SlabSampleFactor, int);
109 
111 
117  vtkSetClampMacro(ImageSampleFactor, int, 1, 16);
118  vtkGetMacro(ImageSampleFactor, int);
120 
122 
126  vtkSetMacro(AutoAdjustImageQuality, vtkTypeBool);
127  vtkBooleanMacro(AutoAdjustImageQuality, vtkTypeBool);
128  vtkGetMacro(AutoAdjustImageQuality, vtkTypeBool);
130 
132 
138  vtkSetMacro(ResampleToScreenPixels, vtkTypeBool);
139  vtkBooleanMacro(ResampleToScreenPixels, vtkTypeBool);
140  vtkGetMacro(ResampleToScreenPixels, vtkTypeBool);
142 
144 
150  vtkSetMacro(SeparateWindowLevelOperation, vtkTypeBool);
151  vtkBooleanMacro(SeparateWindowLevelOperation, vtkTypeBool);
152  vtkGetMacro(SeparateWindowLevelOperation, vtkTypeBool);
154 
156 
160  virtual void SetInterpolator(vtkAbstractImageInterpolator *sampler);
161  virtual vtkAbstractImageInterpolator *GetInterpolator();
163 
167  void Render(vtkRenderer *renderer, vtkImageSlice *prop) override;
168 
174  void ReleaseGraphicsResources(vtkWindow *) override;
175 
179  vtkMTimeType GetMTime() override;
180 
182 
186  double *GetBounds() override;
187  void GetBounds(double bounds[6]) override {
188  this->vtkAbstractMapper3D::GetBounds(bounds);
189  };
191 
196  vtkInformationVector *outInfo) override;
197 
198  // return the bounds in index space
199  void GetIndexBounds(double extent[6]) override;
200 
201 protected:
203  ~vtkImageResliceMapper() override;
204 
208  void CheckerboardImage(vtkImageData *input, vtkCamera *camera,
209  vtkImageProperty *property);
210 
214  void UpdateSliceToWorldMatrix(vtkCamera *camera);
215 
220  void UpdateWorldToDataMatrix(vtkImageSlice *prop);
221 
225  void UpdateResliceMatrix(vtkRenderer *ren, vtkImageSlice *prop);
226 
231  void UpdateResliceInformation(vtkRenderer *ren);
232 
236  void UpdateResliceInterpolation(vtkImageProperty *property);
237 
241  void UpdateColorInformation(vtkImageProperty *property);
242 
246  void UpdatePolygonCoords(vtkRenderer *ren);
247 
249 
252  void Update(int port) override;
253  void Update() override;
254  vtkTypeBool Update(int port, vtkInformationVector *requests) override;
255  vtkTypeBool Update(vtkInformation *requests) override;
257 
261  void ReportReferences(vtkGarbageCollector *) override;
262 
263  vtkImageSliceMapper *SliceMapper; // Does the OpenGL rendering
264 
265  vtkTypeBool JumpToNearestSlice; // Adjust SliceAtFocalPoint
266  vtkTypeBool AutoAdjustImageQuality; // LOD-style behavior
268  SeparateWindowLevelOperation; // Do window/level as a separate step
269  double SlabThickness; // Current slab thickness
270  int SlabType; // Current slab mode
271  int SlabSampleFactor; // Sampling factor for slab mode
272  int ImageSampleFactor; // Sampling factor for image pixels
273  vtkTypeBool ResampleToScreenPixels; // Use software interpolation only
274  int InternalResampleToScreenPixels; // Use software interpolation only
275  int ResliceNeedUpdate; // Execute reslice on next render
276  vtkImageResliceToColors *ImageReslice; // For software interpolation
277  vtkMatrix4x4 *ResliceMatrix; // Cached reslice matrix
278  vtkMatrix4x4 *WorldToDataMatrix; // World to Data transform matrix
279  vtkMatrix4x4 *SliceToWorldMatrix; // Slice to World transform matrix
281 
282 private:
284  void operator=(const vtkImageResliceMapper &) = delete;
285 };
286 
287 #endif
vtkPlane
perform various plane computations
Definition: vtkPlane.h:37
vtkImageResliceMapper::SeparateWindowLevelOperation
vtkTypeBool SeparateWindowLevelOperation
Definition: vtkImageResliceMapper.h:268
vtkImageResliceMapper::SetSlabTypeToMax
void SetSlabTypeToMax()
Definition: vtkImageResliceMapper.h:94
vtkImageResliceMapper::InternalResampleToScreenPixels
int InternalResampleToScreenPixels
Definition: vtkImageResliceMapper.h:274
vtkAbstractMapper3D::GetBounds
virtual double * GetBounds()=0
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
vtkImageResliceMapper::SlabThickness
double SlabThickness
Definition: vtkImageResliceMapper.h:269
vtkImageResliceMapper::SliceToWorldMatrix
vtkMatrix4x4 * SliceToWorldMatrix
Definition: vtkImageResliceMapper.h:279
vtkImageResliceMapper::GetBounds
void GetBounds(double bounds[6]) override
Get the bounds for this mapper as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkImageResliceMapper.h:187
VTK_IMAGE_SLAB_MAX
#define VTK_IMAGE_SLAB_MAX
Definition: vtkSystemIncludes.h:100
vtkImageMapper3D::GetIndexBounds
virtual void GetIndexBounds(double extent[6])=0
vtkImageMapper3D::ProcessRequest
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Handle requests from the pipeline executive.
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkImageMapper3D::Render
virtual void Render(vtkRenderer *renderer, vtkImageSlice *prop)=0
This should only be called by the renderer.
vtkAbstractMapper::GetMTime
vtkMTimeType GetMTime() override
Override Modifiedtime as we have added Clipping planes.
vtkImageResliceMapper::ImageSampleFactor
int ImageSampleFactor
Definition: vtkImageResliceMapper.h:272
vtkImageResliceMapper::SlabType
int SlabType
Definition: vtkImageResliceMapper.h:270
vtkImageResliceMapper::ResampleToScreenPixels
vtkTypeBool ResampleToScreenPixels
Definition: vtkImageResliceMapper.h:273
vtkImageSliceMapper
map a slice of a vtkImageData to the screen
Definition: vtkImageSliceMapper.h:45
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkImageResliceMapper::SetSlabTypeToMin
void SetSlabTypeToMin()
Definition: vtkImageResliceMapper.h:93
VTK_IMAGE_SLAB_MEAN
#define VTK_IMAGE_SLAB_MEAN
Definition: vtkSystemIncludes.h:101
vtkX3D::port
Definition: vtkX3D.h:447
vtkImageSlice
represents an image in a 3D scene
Definition: vtkImageSlice.h:52
vtkImageProperty
image display properties
Definition: vtkImageProperty.h:42
vtkImageResliceMapper::SlabSampleFactor
int SlabSampleFactor
Definition: vtkImageResliceMapper.h:271
vtkImageResliceMapper::SetSlabTypeToSum
void SetSlabTypeToSum()
Definition: vtkImageResliceMapper.h:96
VTK_IMAGE_SLAB_MIN
#define VTK_IMAGE_SLAB_MIN
Definition: vtkSystemIncludes.h:99
vtkAlgorithm::Update
virtual void Update()
vtkImageResliceMapper::WorldToDataMatrix
vtkMatrix4x4 * WorldToDataMatrix
Definition: vtkImageResliceMapper.h:278
vtkImageResliceMapper::ResliceNeedUpdate
int ResliceNeedUpdate
Definition: vtkImageResliceMapper.h:275
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:47
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
vtkImageResliceMapper
map a slice of a vtkImageData to the screen
Definition: vtkImageResliceMapper.h:47
vtkCamera
a virtual camera for 3D rendering
Definition: vtkCamera.h:51
vtkImageMapper3D::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override=0
Release any graphics resources that are being consumed by this mapper.
vtkImageResliceMapper::JumpToNearestSlice
vtkTypeBool JumpToNearestSlice
Definition: vtkImageResliceMapper.h:265
vtkImageResliceMapper::SliceMapper
vtkImageSliceMapper * SliceMapper
Definition: vtkImageResliceMapper.h:263
vtkGarbageCollector
Detect and break reference loops.
Definition: vtkGarbageCollector.h:99
vtkImageResliceMapper::AutoAdjustImageQuality
vtkTypeBool AutoAdjustImageQuality
Definition: vtkImageResliceMapper.h:266
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:70
vtkLookupTable
map scalar values into colors via a lookup table
Definition: vtkLookupTable.h:74
vtkImageMapper3D
abstract class for mapping images to the screen
Definition: vtkImageMapper3D.h:50
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkImageResliceMapper::UpdateTime
vtkTimeStamp UpdateTime
Definition: vtkImageResliceMapper.h:280
vtkAlgorithm::ReportReferences
void ReportReferences(vtkGarbageCollector *) override
vtkImageResliceMapper::ResliceMatrix
vtkMatrix4x4 * ResliceMatrix
Definition: vtkImageResliceMapper.h:277
VTK_IMAGE_SLAB_SUM
#define VTK_IMAGE_SLAB_SUM
Definition: vtkSystemIncludes.h:102
vtkImageResliceToColors
Reslice and produce color scalars.
Definition: vtkImageResliceToColors.h:43
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkImageMapper3D.h
vtkX3D::extent
Definition: vtkX3D.h:345
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:90
vtkImageMapper3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractImageInterpolator
interpolate data values from images
Definition: vtkAbstractImageInterpolator.h:49
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkImageResliceMapper::ImageReslice
vtkImageResliceToColors * ImageReslice
Definition: vtkImageResliceMapper.h:276
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:304
vtkImageResliceMapper::SetSlabTypeToMean
void SetSlabTypeToMean()
Definition: vtkImageResliceMapper.h:95