VTK  9.7.1
vtkImageResliceMapper.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
20 #ifndef vtkImageResliceMapper_h
21 #define vtkImageResliceMapper_h
22 
23 #include "vtkImageMapper3D.h"
24 #include "vtkRenderingImageModule.h" // For export macro
25 #include "vtkWrappingHints.h"
26 
27 VTK_ABI_NAMESPACE_BEGIN
29 class vtkRenderer;
30 class vtkRenderWindow;
31 class vtkCamera;
32 class vtkLookupTable;
33 class vtkImageSlice;
34 class vtkImageData;
36 class vtkMatrix4x4;
39 
40 class VTKRENDERINGIMAGE_EXPORT VTK_MARSHALAUTO vtkImageResliceMapper : public vtkImageMapper3D
41 {
42 public:
43  static vtkImageResliceMapper* New();
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
48 
54  virtual void SetSlicePlane(vtkPlane* plane);
55  vtkPlane* GetSlicePlane() override { return this->SlicePlane; }
57 
59 
65  vtkSetMacro(JumpToNearestSlice, vtkTypeBool);
66  vtkBooleanMacro(JumpToNearestSlice, vtkTypeBool);
67  vtkGetMacro(JumpToNearestSlice, vtkTypeBool);
69 
71 
74  vtkSetMacro(SlabThickness, double);
75  vtkGetMacro(SlabThickness, double);
77 
79 
88  vtkSetClampMacro(SlabType, int, VTK_IMAGE_SLAB_MIN, VTK_IMAGE_SLAB_SUM);
89  vtkGetMacro(SlabType, int);
90  void SetSlabTypeToMin() { this->SetSlabType(VTK_IMAGE_SLAB_MIN); }
91  void SetSlabTypeToMax() { this->SetSlabType(VTK_IMAGE_SLAB_MAX); }
92  void SetSlabTypeToMean() { this->SetSlabType(VTK_IMAGE_SLAB_MEAN); }
93  void SetSlabTypeToSum() { this->SetSlabType(VTK_IMAGE_SLAB_SUM); }
94  virtual const char* GetSlabTypeAsString();
96 
98 
103  vtkSetClampMacro(SlabSampleFactor, int, 1, 2);
104  vtkGetMacro(SlabSampleFactor, int);
106 
108 
114  vtkSetClampMacro(ImageSampleFactor, int, 1, 16);
115  vtkGetMacro(ImageSampleFactor, int);
117 
119 
123  vtkSetMacro(AutoAdjustImageQuality, vtkTypeBool);
124  vtkBooleanMacro(AutoAdjustImageQuality, vtkTypeBool);
125  vtkGetMacro(AutoAdjustImageQuality, vtkTypeBool);
127 
129 
135  vtkSetMacro(ResampleToScreenPixels, vtkTypeBool);
136  vtkBooleanMacro(ResampleToScreenPixels, vtkTypeBool);
137  vtkGetMacro(ResampleToScreenPixels, vtkTypeBool);
139 
141 
147  vtkSetMacro(SeparateWindowLevelOperation, vtkTypeBool);
148  vtkBooleanMacro(SeparateWindowLevelOperation, vtkTypeBool);
149  vtkGetMacro(SeparateWindowLevelOperation, vtkTypeBool);
151 
153 
158  virtual void SetInterpolator(vtkAbstractImageInterpolator* interpolator);
160  virtual vtkAbstractImageInterpolator* GetInterpolator();
162 
166  void Render(vtkRenderer* renderer, vtkImageSlice* prop) override;
167 
173  void ReleaseGraphicsResources(vtkWindow*) override;
174 
178  vtkMTimeType GetMTime() override;
179 
181 
185  double* GetBounds() override;
186  void GetBounds(double bounds[6]) override { this->vtkAbstractMapper3D::GetBounds(bounds); }
188 
193  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
194 
195  // return the bounds in index space
196  void GetIndexBounds(double extent[6]) override;
197 
198  vtkGetObjectMacro(ImageReslice, vtkImageResliceToColors);
199  void SetImageReslice(vtkImageResliceToColors*);
200 
201 protected:
203  ~vtkImageResliceMapper() override;
204 
208  void CheckerboardImage(vtkImageData* input, vtkCamera* camera, vtkImageProperty* property);
209 
213  void UpdateSliceToWorldMatrix(vtkCamera* camera);
214 
219  void UpdateWorldToDataMatrix(vtkImageSlice* prop);
220 
224  void UpdateResliceMatrix(vtkRenderer* ren, vtkImageSlice* prop);
225 
230  void UpdateResliceInformation(vtkRenderer* ren);
231 
235  void UpdateResliceInterpolation(vtkImageProperty* property);
236 
240  void UpdateColorInformation(vtkImageProperty* property);
241 
245  void UpdatePolygonCoords(vtkRenderer* ren);
246 
248 
251  bool Update(int port) override;
252  bool Update() override;
253  vtkTypeBool Update(int port, vtkInformationVector* requests) override;
254  vtkTypeBool Update(vtkInformation* requests) override;
256 
260  void ReportReferences(vtkGarbageCollector*) override;
261 
262  vtkImageChangeInformation* ChangeInformation; // Prepare image for mapper
263  vtkImageSliceMapper* SliceMapper; // Does the OpenGL rendering
264 
265  vtkTypeBool JumpToNearestSlice; // Adjust SliceAtFocalPoint
266  vtkTypeBool AutoAdjustImageQuality; // LOD-style behavior
267  vtkTypeBool SeparateWindowLevelOperation; // Do window/level as a separate step
268  double SlabThickness; // Current slab thickness
269  int SlabType; // Current slab mode
270  int SlabSampleFactor; // Sampling factor for slab mode
271  int ImageSampleFactor; // Sampling factor for image pixels
272  vtkTypeBool ResampleToScreenPixels; // Use software interpolation only
273  int InternalResampleToScreenPixels; // Use software interpolation only
274  int ResliceNeedUpdate; // Execute reslice on next render
275  vtkImageResliceToColors* ImageReslice; // For software interpolation
276  vtkMatrix4x4* ResliceMatrix; // Cached reslice matrix
277  vtkMatrix4x4* WorldToDataMatrix; // World to Data transform matrix
278  vtkMatrix4x4* DataToSliceMatrix; // Data to Slice transform matrix
279  vtkMatrix4x4* SliceToWorldMatrix; // Slice to World transform matrix
281 
282 private:
284  void operator=(const vtkImageResliceMapper&) = delete;
285 };
286 
287 VTK_ABI_NAMESPACE_END
288 #endif
interpolate data values from images
#define VTK_IMAGE_SLAB_MAX
void GetBounds(T a, double bds[6])
Reslice and produce color scalars.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:31
#define VTK_IMAGE_SLAB_MIN
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
#define VTK_IMAGE_SLAB_SUM
#define VTK_IMAGE_SLAB_MEAN
void ReportReferences(vtkGarbageCollector *) override
modify spacing, origin and extent.
record modification and/or execution time
Definition: vtkTimeStamp.h:24
map scalar values into colors via a lookup table
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
image display properties
abstract specification for renderers
Definition: vtkRenderer.h:63
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.
vtkTypeBool SeparateWindowLevelOperation
void SetSlabTypeToMax()
The slab type, for thick slicing (default: Mean).
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
a simple class to control print indentation
Definition: vtkIndent.h:28
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:41
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
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).
vtkPlane * GetSlicePlane() override
Set the slice that will be used to cut through the image.
#define VTK_MARSHALEXCLUDE(reason)
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:39
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()
#define VTK_MARSHALAUTO
virtual bool Update()
Bring this algorithm's outputs up-to-date.
void SetSlabTypeToSum()
The slab type, for thick slicing (default: Mean).
vtkImageChangeInformation * ChangeInformation
void SetSlabTypeToMean()
The slab type, for thick slicing (default: Mean).