VTK  9.0.3
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:
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 
163 
167  void Render(vtkRenderer* renderer, vtkImageSlice* prop) override;
168 
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:
202 
206  void CheckerboardImage(vtkImageData* input, vtkCamera* camera, vtkImageProperty* property);
207 
212 
218 
223 
229 
234 
239 
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 
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
interpolate data values from images
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:46
Detect and break reference loops.
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
abstract class for mapping images to the screen
image display properties
map a slice of a vtkImageData to the screen
void CheckerboardImage(vtkImageData *input, vtkCamera *camera, vtkImageProperty *property)
Do a checkerboard pattern to the alpha of an RGBA image.
void GetIndexBounds(double extent[6]) override
vtkImageResliceToColors * ImageReslice
void UpdateResliceInformation(vtkRenderer *ren)
Set all of the reslicing parameters.
void UpdateResliceInterpolation(vtkImageProperty *property)
Set the interpolation.
vtkTypeBool Update(vtkInformation *requests) override
Convenience method to update an algorithm after passing requests to its first output port.
vtkMTimeType GetMTime() override
Get the mtime for the mapper.
void Render(vtkRenderer *renderer, vtkImageSlice *prop) override
This should only be called by the renderer.
virtual const char * GetSlabTypeAsString()
static vtkImageResliceMapper * New()
vtkTypeBool SeparateWindowLevelOperation
void GetBounds(double bounds[6]) override
Get the bounds for this mapper as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetSlicePlane(vtkPlane *plane)
Set the slice that will be used to cut through the image.
void ReportReferences(vtkGarbageCollector *) override
Garbage collection for reference loops.
vtkImageSliceMapper * SliceMapper
void Update(int port) override
Override Update to handle some tricky details.
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Handle requests from the pipeline executive.
vtkTypeBool Update(int port, vtkInformationVector *requests) override
This method enables the passing of data requests to the algorithm to be used during execution (in add...
void UpdateResliceMatrix(vtkRenderer *ren, vtkImageSlice *prop)
Update the reslice matrix, which is the slice-to-data matrix.
virtual vtkAbstractImageInterpolator * GetInterpolator()
void Update() override
void UpdateWorldToDataMatrix(vtkImageSlice *prop)
Check if the vtkProp3D matrix has changed, and if so, set the WorldToDataMatrix to its inverse.
void UpdatePolygonCoords(vtkRenderer *ren)
Make a polygon by cutting the data bounds with a plane.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
double * GetBounds() override
The bounding box (array of six doubles) of the data expressed as (xmin,xmax, ymin,...
void UpdateColorInformation(vtkImageProperty *property)
Update anything related to the image coloring.
virtual void SetInterpolator(vtkAbstractImageInterpolator *sampler)
Set a custom interpolator.
void UpdateSliceToWorldMatrix(vtkCamera *camera)
Update the slice-to-world matrix from the camera.
~vtkImageResliceMapper() override
Reslice and produce color scalars.
map a slice of a vtkImageData to the screen
represents an image in a 3D scene
Definition: vtkImageSlice.h:47
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
map scalar values into colors via a lookup table
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:36
perform various plane computations
Definition: vtkPlane.h:32
create a window for renderers to draw into
abstract specification for renderers
Definition: vtkRenderer.h:68
record modification and/or execution time
Definition: vtkTimeStamp.h:33
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
@ port
Definition: vtkX3D.h:453
@ extent
Definition: vtkX3D.h:351
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_IMAGE_SLAB_MAX
#define VTK_IMAGE_SLAB_MIN
#define VTK_IMAGE_SLAB_SUM
#define VTK_IMAGE_SLAB_MEAN
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293