VTK  9.3.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 
26 VTK_ABI_NAMESPACE_BEGIN
28 class vtkRenderer;
29 class vtkRenderWindow;
30 class vtkCamera;
31 class vtkLookupTable;
32 class vtkImageSlice;
33 class vtkImageData;
35 class vtkMatrix4x4;
38 
39 class VTKRENDERINGIMAGE_EXPORT vtkImageResliceMapper : public vtkImageMapper3D
40 {
41 public:
42  static vtkImageResliceMapper* New();
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
52  virtual void SetSlicePlane(vtkPlane* plane);
53 
55 
61  vtkSetMacro(JumpToNearestSlice, vtkTypeBool);
62  vtkBooleanMacro(JumpToNearestSlice, vtkTypeBool);
63  vtkGetMacro(JumpToNearestSlice, vtkTypeBool);
65 
67 
70  vtkSetMacro(SlabThickness, double);
71  vtkGetMacro(SlabThickness, double);
73 
75 
84  vtkSetClampMacro(SlabType, int, VTK_IMAGE_SLAB_MIN, VTK_IMAGE_SLAB_SUM);
85  vtkGetMacro(SlabType, int);
86  void SetSlabTypeToMin() { this->SetSlabType(VTK_IMAGE_SLAB_MIN); }
87  void SetSlabTypeToMax() { this->SetSlabType(VTK_IMAGE_SLAB_MAX); }
88  void SetSlabTypeToMean() { this->SetSlabType(VTK_IMAGE_SLAB_MEAN); }
89  void SetSlabTypeToSum() { this->SetSlabType(VTK_IMAGE_SLAB_SUM); }
90  virtual const char* GetSlabTypeAsString();
92 
94 
99  vtkSetClampMacro(SlabSampleFactor, int, 1, 2);
100  vtkGetMacro(SlabSampleFactor, int);
102 
104 
110  vtkSetClampMacro(ImageSampleFactor, int, 1, 16);
111  vtkGetMacro(ImageSampleFactor, int);
113 
115 
119  vtkSetMacro(AutoAdjustImageQuality, vtkTypeBool);
120  vtkBooleanMacro(AutoAdjustImageQuality, vtkTypeBool);
121  vtkGetMacro(AutoAdjustImageQuality, vtkTypeBool);
123 
125 
131  vtkSetMacro(ResampleToScreenPixels, vtkTypeBool);
132  vtkBooleanMacro(ResampleToScreenPixels, vtkTypeBool);
133  vtkGetMacro(ResampleToScreenPixels, vtkTypeBool);
135 
137 
143  vtkSetMacro(SeparateWindowLevelOperation, vtkTypeBool);
144  vtkBooleanMacro(SeparateWindowLevelOperation, vtkTypeBool);
145  vtkGetMacro(SeparateWindowLevelOperation, vtkTypeBool);
147 
149 
153  virtual void SetInterpolator(vtkAbstractImageInterpolator* interpolator);
154  virtual vtkAbstractImageInterpolator* GetInterpolator();
156 
160  void Render(vtkRenderer* renderer, vtkImageSlice* prop) override;
161 
167  void ReleaseGraphicsResources(vtkWindow*) override;
168 
172  vtkMTimeType GetMTime() override;
173 
175 
179  double* GetBounds() override;
180  void GetBounds(double bounds[6]) override { this->vtkAbstractMapper3D::GetBounds(bounds); }
182 
187  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
188 
189  // return the bounds in index space
190  void GetIndexBounds(double extent[6]) override;
191 
192 protected:
194  ~vtkImageResliceMapper() override;
195 
199  void CheckerboardImage(vtkImageData* input, vtkCamera* camera, vtkImageProperty* property);
200 
204  void UpdateSliceToWorldMatrix(vtkCamera* camera);
205 
210  void UpdateWorldToDataMatrix(vtkImageSlice* prop);
211 
215  void UpdateResliceMatrix(vtkRenderer* ren, vtkImageSlice* prop);
216 
221  void UpdateResliceInformation(vtkRenderer* ren);
222 
226  void UpdateResliceInterpolation(vtkImageProperty* property);
227 
231  void UpdateColorInformation(vtkImageProperty* property);
232 
236  void UpdatePolygonCoords(vtkRenderer* ren);
237 
239 
242  void Update(int port) override;
243  void Update() override;
244  vtkTypeBool Update(int port, vtkInformationVector* requests) override;
245  vtkTypeBool Update(vtkInformation* requests) override;
247 
251  void ReportReferences(vtkGarbageCollector*) override;
252 
253  vtkImageChangeInformation* ChangeInformation; // Prepare image for mapper
254  vtkImageSliceMapper* SliceMapper; // Does the OpenGL rendering
255 
256  vtkTypeBool JumpToNearestSlice; // Adjust SliceAtFocalPoint
257  vtkTypeBool AutoAdjustImageQuality; // LOD-style behavior
258  vtkTypeBool SeparateWindowLevelOperation; // Do window/level as a separate step
259  double SlabThickness; // Current slab thickness
260  int SlabType; // Current slab mode
261  int SlabSampleFactor; // Sampling factor for slab mode
262  int ImageSampleFactor; // Sampling factor for image pixels
263  vtkTypeBool ResampleToScreenPixels; // Use software interpolation only
264  int InternalResampleToScreenPixels; // Use software interpolation only
265  int ResliceNeedUpdate; // Execute reslice on next render
266  vtkImageResliceToColors* ImageReslice; // For software interpolation
267  vtkMatrix4x4* ResliceMatrix; // Cached reslice matrix
268  vtkMatrix4x4* WorldToDataMatrix; // World to Data transform matrix
269  vtkMatrix4x4* DataToSliceMatrix; // Data to Slice transform matrix
270  vtkMatrix4x4* SliceToWorldMatrix; // Slice to World transform matrix
272 
273 private:
275  void operator=(const vtkImageResliceMapper&) = delete;
276 };
277 
278 VTK_ABI_NAMESPACE_END
279 #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:30
#define VTK_IMAGE_SLAB_MIN
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
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
modify spacing, origin and extent.
record modification and/or execution time
Definition: vtkTimeStamp.h:24
map scalar values into colors via a lookup table
image display properties
abstract specification for renderers
Definition: vtkRenderer.h:61
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:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
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:40
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
virtual void Render(vtkRenderer *renderer, vtkImageSlice *prop)=0
This should only be called by the renderer.
perform various plane computations
Definition: vtkPlane.h:25
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:38
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).
vtkImageChangeInformation * ChangeInformation
void SetSlabTypeToMean()
The slab type, for thick slicing (default: Mean).