VTK  9.2.5
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 =========================================================================*/
61 #ifndef vtkImageResliceMapper_h
62 #define vtkImageResliceMapper_h
63 
64 #include "vtkImageMapper3D.h"
65 #include "vtkRenderingImageModule.h" // For export macro
66 
68 class vtkRenderer;
69 class vtkRenderWindow;
70 class vtkCamera;
71 class vtkLookupTable;
72 class vtkImageSlice;
73 class vtkImageData;
75 class vtkMatrix4x4;
77 
78 class VTKRENDERINGIMAGE_EXPORT vtkImageResliceMapper : public vtkImageMapper3D
79 {
80 public:
83  void PrintSelf(ostream& os, vtkIndent indent) override;
84 
91  virtual void SetSlicePlane(vtkPlane* plane);
92 
94 
100  vtkSetMacro(JumpToNearestSlice, vtkTypeBool);
101  vtkBooleanMacro(JumpToNearestSlice, vtkTypeBool);
102  vtkGetMacro(JumpToNearestSlice, vtkTypeBool);
104 
106 
109  vtkSetMacro(SlabThickness, double);
110  vtkGetMacro(SlabThickness, double);
112 
114 
123  vtkSetClampMacro(SlabType, int, VTK_IMAGE_SLAB_MIN, VTK_IMAGE_SLAB_SUM);
124  vtkGetMacro(SlabType, int);
125  void SetSlabTypeToMin() { this->SetSlabType(VTK_IMAGE_SLAB_MIN); }
126  void SetSlabTypeToMax() { this->SetSlabType(VTK_IMAGE_SLAB_MAX); }
127  void SetSlabTypeToMean() { this->SetSlabType(VTK_IMAGE_SLAB_MEAN); }
128  void SetSlabTypeToSum() { this->SetSlabType(VTK_IMAGE_SLAB_SUM); }
129  virtual const char* GetSlabTypeAsString();
131 
133 
138  vtkSetClampMacro(SlabSampleFactor, int, 1, 2);
139  vtkGetMacro(SlabSampleFactor, int);
141 
143 
149  vtkSetClampMacro(ImageSampleFactor, int, 1, 16);
150  vtkGetMacro(ImageSampleFactor, int);
152 
154 
158  vtkSetMacro(AutoAdjustImageQuality, vtkTypeBool);
159  vtkBooleanMacro(AutoAdjustImageQuality, vtkTypeBool);
160  vtkGetMacro(AutoAdjustImageQuality, vtkTypeBool);
162 
164 
170  vtkSetMacro(ResampleToScreenPixels, vtkTypeBool);
171  vtkBooleanMacro(ResampleToScreenPixels, vtkTypeBool);
172  vtkGetMacro(ResampleToScreenPixels, vtkTypeBool);
174 
176 
182  vtkSetMacro(SeparateWindowLevelOperation, vtkTypeBool);
183  vtkBooleanMacro(SeparateWindowLevelOperation, vtkTypeBool);
184  vtkGetMacro(SeparateWindowLevelOperation, vtkTypeBool);
186 
188 
192  virtual void SetInterpolator(vtkAbstractImageInterpolator* interpolator);
195 
199  void Render(vtkRenderer* renderer, vtkImageSlice* prop) override;
200 
207 
211  vtkMTimeType GetMTime() override;
212 
214 
218  double* GetBounds() override;
219  void GetBounds(double bounds[6]) override { this->vtkAbstractMapper3D::GetBounds(bounds); }
221 
226  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
227 
228  // return the bounds in index space
229  void GetIndexBounds(double extent[6]) override;
230 
231 protected:
234 
238  void CheckerboardImage(vtkImageData* input, vtkCamera* camera, vtkImageProperty* property);
239 
244 
250 
255 
261 
266 
271 
276 
278 
281  void Update(int port) override;
282  void Update() override;
283  vtkTypeBool Update(int port, vtkInformationVector* requests) override;
284  vtkTypeBool Update(vtkInformation* requests) override;
286 
291 
292  vtkImageSliceMapper* SliceMapper; // Does the OpenGL rendering
293 
294  vtkTypeBool JumpToNearestSlice; // Adjust SliceAtFocalPoint
295  vtkTypeBool AutoAdjustImageQuality; // LOD-style behavior
296  vtkTypeBool SeparateWindowLevelOperation; // Do window/level as a separate step
297  double SlabThickness; // Current slab thickness
298  int SlabType; // Current slab mode
299  int SlabSampleFactor; // Sampling factor for slab mode
300  int ImageSampleFactor; // Sampling factor for image pixels
301  vtkTypeBool ResampleToScreenPixels; // Use software interpolation only
302  int InternalResampleToScreenPixels; // Use software interpolation only
303  int ResliceNeedUpdate; // Execute reslice on next render
304  vtkImageResliceToColors* ImageReslice; // For software interpolation
305  vtkMatrix4x4* ResliceMatrix; // Cached reslice matrix
306  vtkMatrix4x4* WorldToDataMatrix; // World to Data transform matrix
307  vtkMatrix4x4* SliceToWorldMatrix; // Slice to World transform matrix
309 
310 private:
312  void operator=(const vtkImageResliceMapper&) = delete;
313 };
314 
315 #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:161
Detect and break reference loops.
topologically and geometrically regular array of data
Definition: vtkImageData.h:163
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
Override Update to handle some tricky details.
void SetSlabTypeToSum()
The slab type, for thick slicing (default: Mean).
vtkMTimeType GetMTime() override
Get the mtime for the mapper.
void Render(vtkRenderer *renderer, vtkImageSlice *prop) override
This should only be called by the renderer.
void SetSlabTypeToMean()
The slab type, for thick slicing (default: Mean).
virtual const char * GetSlabTypeAsString()
The slab type, for thick slicing (default: Mean).
static vtkImageResliceMapper * New()
vtkTypeBool SeparateWindowLevelOperation
void GetBounds(double bounds[6]) override
The bounding box (array of six doubles) of the data expressed as (xmin,xmax, ymin,...
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.
virtual void SetInterpolator(vtkAbstractImageInterpolator *interpolator)
Set a custom interpolator.
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
Override Update to handle some tricky details.
void UpdateResliceMatrix(vtkRenderer *ren, vtkImageSlice *prop)
Update the reslice matrix, which is the slice-to-data matrix.
virtual vtkAbstractImageInterpolator * GetInterpolator()
Set a custom interpolator.
void Update() override
Override Update to handle some tricky details.
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.
void UpdateSliceToWorldMatrix(vtkCamera *camera)
Update the slice-to-world matrix from the camera.
void SetSlabTypeToMax()
The slab type, for thick slicing (default: Mean).
void SetSlabTypeToMin()
The slab type, for thick slicing (default: Mean).
~vtkImageResliceMapper() override
Reslice and produce color scalars.
map a slice of a vtkImageData to the screen
represents an image in a 3D scene
a simple class to control print indentation
Definition: vtkIndent.h:119
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:151
perform various plane computations
Definition: vtkPlane.h:146
create a window for renderers to draw into
abstract specification for renderers
Definition: vtkRenderer.h:182
record modification and/or execution time
Definition: vtkTimeStamp.h:55
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ 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:287