VTK  9.0.1
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
void ReleaseGraphicsResources(vtkWindow *) override=0
Release any graphics resources that are being consumed by this mapper.
interpolate data values from images
#define VTK_IMAGE_SLAB_MAX
Reslice and produce color scalars.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
#define VTK_IMAGE_SLAB_MIN
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293
vtkMTimeType GetMTime() override
Override Modifiedtime as we have added Clipping planes.
#define VTK_IMAGE_SLAB_SUM
#define VTK_IMAGE_SLAB_MEAN
void ReportReferences(vtkGarbageCollector *) override
record modification and/or execution time
Definition: vtkTimeStamp.h:32
map scalar values into colors via a lookup table
image display properties
abstract specification for renderers
Definition: vtkRenderer.h:67
vtkImageResliceToColors * ImageReslice
void SetSlabTypeToMin()
The slab type, for thick slicing (default: Mean).
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Detect and break reference loops.
void GetBounds(double bounds[6]) override
The bounding box (array of six doubles) of the data expressed as (xmin,xmax, ymin,ymax, zmin,zmax).
vtkTypeBool SeparateWindowLevelOperation
void SetSlabTypeToMax()
The slab type, for thick slicing (default: Mean).
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
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
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
virtual void Render(vtkRenderer *renderer, vtkImageSlice *prop)=0
This should only be called by the renderer.
perform various plane computations
Definition: vtkPlane.h:31
vtkImageSliceMapper * SliceMapper
virtual double * GetBounds()=0
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax, zmin,zmax).
virtual void Update()
Bring this algorithm's outputs up-to-date.
virtual void GetIndexBounds(double extent[6])=0
create a window for renderers to draw into
represents an image in a 3D scene
Definition: vtkImageSlice.h:46
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()
void SetSlabTypeToSum()
The slab type, for thick slicing (default: Mean).
void SetSlabTypeToMean()
The slab type, for thick slicing (default: Mean).