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 
36 class vtkRenderer;
37 class vtkRenderWindow;
38 class vtkCamera;
39 class vtkLookupTable;
40 class vtkImageSlice;
41 class vtkImageData;
43 class vtkMatrix4x4;
45 
46 class VTKRENDERINGIMAGE_EXPORT vtkImageResliceMapper : public vtkImageMapper3D
47 {
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 { this->vtkAbstractMapper3D::GetBounds(bounds); }
189 
194  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
195 
196  // return the bounds in index space
197  void GetIndexBounds(double extent[6]) override;
198 
199 protected:
201  ~vtkImageResliceMapper() override;
202 
206  void CheckerboardImage(vtkImageData* input, vtkCamera* camera, vtkImageProperty* property);
207 
211  void UpdateSliceToWorldMatrix(vtkCamera* camera);
212 
217  void UpdateWorldToDataMatrix(vtkImageSlice* prop);
218 
222  void UpdateResliceMatrix(vtkRenderer* ren, vtkImageSlice* prop);
223 
228  void UpdateResliceInformation(vtkRenderer* ren);
229 
233  void UpdateResliceInterpolation(vtkImageProperty* property);
234 
238  void UpdateColorInformation(vtkImageProperty* property);
239 
243  void UpdatePolygonCoords(vtkRenderer* ren);
244 
246 
249  void Update(int port) override;
250  void Update() override;
251  vtkTypeBool Update(int port, vtkInformationVector* requests) override;
252  vtkTypeBool Update(vtkInformation* requests) override;
254 
258  void ReportReferences(vtkGarbageCollector*) override;
259 
260  vtkImageSliceMapper* SliceMapper; // Does the OpenGL rendering
261 
262  vtkTypeBool JumpToNearestSlice; // Adjust SliceAtFocalPoint
263  vtkTypeBool AutoAdjustImageQuality; // LOD-style behavior
264  vtkTypeBool SeparateWindowLevelOperation; // Do window/level as a separate step
265  double SlabThickness; // Current slab thickness
266  int SlabType; // Current slab mode
267  int SlabSampleFactor; // Sampling factor for slab mode
268  int ImageSampleFactor; // Sampling factor for image pixels
269  vtkTypeBool ResampleToScreenPixels; // Use software interpolation only
270  int InternalResampleToScreenPixels; // Use software interpolation only
271  int ResliceNeedUpdate; // Execute reslice on next render
272  vtkImageResliceToColors* ImageReslice; // For software interpolation
273  vtkMatrix4x4* ResliceMatrix; // Cached reslice matrix
274  vtkMatrix4x4* WorldToDataMatrix; // World to Data transform matrix
275  vtkMatrix4x4* SliceToWorldMatrix; // Slice to World transform matrix
277 
278 private:
280  void operator=(const vtkImageResliceMapper&) = delete;
281 };
282 
283 #endif
vtkPlane
perform various plane computations
Definition: vtkPlane.h:31
vtkImageResliceMapper::SeparateWindowLevelOperation
vtkTypeBool SeparateWindowLevelOperation
Definition: vtkImageResliceMapper.h:264
vtkImageResliceMapper::SetSlabTypeToMax
void SetSlabTypeToMax()
Definition: vtkImageResliceMapper.h:94
vtkImageResliceMapper::InternalResampleToScreenPixels
int InternalResampleToScreenPixels
Definition: vtkImageResliceMapper.h:270
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:265
vtkImageResliceMapper::SliceToWorldMatrix
vtkMatrix4x4 * SliceToWorldMatrix
Definition: vtkImageResliceMapper.h:275
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:35
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
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:268
vtkImageResliceMapper::SlabType
int SlabType
Definition: vtkImageResliceMapper.h:266
vtkImageResliceMapper::ResampleToScreenPixels
vtkTypeBool ResampleToScreenPixels
Definition: vtkImageResliceMapper.h:269
vtkImageSliceMapper
map a slice of a vtkImageData to the screen
Definition: vtkImageSliceMapper.h:39
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:453
vtkImageSlice
represents an image in a 3D scene
Definition: vtkImageSlice.h:46
vtkImageProperty
image display properties
Definition: vtkImageProperty.h:36
vtkImageResliceMapper::SlabSampleFactor
int SlabSampleFactor
Definition: vtkImageResliceMapper.h:267
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:274
vtkImageResliceMapper::ResliceNeedUpdate
int ResliceNeedUpdate
Definition: vtkImageResliceMapper.h:271
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
vtkImageResliceMapper
map a slice of a vtkImageData to the screen
Definition: vtkImageResliceMapper.h:46
vtkCamera
a virtual camera for 3D rendering
Definition: vtkCamera.h:45
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:262
vtkImageResliceMapper::SliceMapper
vtkImageSliceMapper * SliceMapper
Definition: vtkImageResliceMapper.h:260
vtkGarbageCollector
Detect and break reference loops.
Definition: vtkGarbageCollector.h:94
vtkImageResliceMapper::AutoAdjustImageQuality
vtkTypeBool AutoAdjustImageQuality
Definition: vtkImageResliceMapper.h:263
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:64
vtkLookupTable
map scalar values into colors via a lookup table
Definition: vtkLookupTable.h:68
vtkImageMapper3D
abstract class for mapping images to the screen
Definition: vtkImageMapper3D.h:47
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkImageResliceMapper::UpdateTime
vtkTimeStamp UpdateTime
Definition: vtkImageResliceMapper.h:276
vtkAlgorithm::ReportReferences
void ReportReferences(vtkGarbageCollector *) override
vtkImageResliceMapper::ResliceMatrix
vtkMatrix4x4 * ResliceMatrix
Definition: vtkImageResliceMapper.h:273
VTK_IMAGE_SLAB_SUM
#define VTK_IMAGE_SLAB_SUM
Definition: vtkSystemIncludes.h:102
vtkImageResliceToColors
Reslice and produce color scalars.
Definition: vtkImageResliceToColors.h:39
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:58
vtkImageMapper3D.h
vtkX3D::extent
Definition: vtkX3D.h:351
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:84
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:46
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkImageResliceMapper::ImageReslice
vtkImageResliceToColors * ImageReslice
Definition: vtkImageResliceMapper.h:272
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:298
vtkImageResliceMapper::SetSlabTypeToMean
void SetSlabTypeToMean()
Definition: vtkImageResliceMapper.h:95