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