VTK  9.6.1
vtkImageReslice.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
43
44#ifndef vtkImageReslice_h
45#define vtkImageReslice_h
46
47#include "vtkImagingCoreModule.h" // For export macro
49#include "vtkWrappingHints.h"
50
51// interpolation mode constants
52#define VTK_RESLICE_NEAREST VTK_NEAREST_INTERPOLATION
53#define VTK_RESLICE_LINEAR VTK_LINEAR_INTERPOLATION
54#define VTK_RESLICE_CUBIC VTK_CUBIC_INTERPOLATION
55
56VTK_ABI_NAMESPACE_BEGIN
57class vtkImageData;
59class vtkMatrix4x4;
63
64class VTKIMAGINGCORE_EXPORT VTK_MARSHALAUTO vtkImageReslice : public vtkThreadedImageAlgorithm
65{
66public:
69
70 void PrintSelf(ostream& os, vtkIndent indent) override;
71
73
89 vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
91
93
99 void SetResliceAxesDirectionCosines(double x0, double x1, double x2, double y0, double y1,
100 double y2, double z0, double z1, double z2);
101 void SetResliceAxesDirectionCosines(const double x[3], const double y[3], const double z[3])
102 {
103 this->SetResliceAxesDirectionCosines(x[0], x[1], x[2], y[0], y[1], y[2], z[0], z[1], z[2]);
104 }
105 void SetResliceAxesDirectionCosines(const double xyz[9])
106 {
108 xyz[0], xyz[1], xyz[2], xyz[3], xyz[4], xyz[5], xyz[6], xyz[7], xyz[8]);
109 }
110 void GetResliceAxesDirectionCosines(double x[3], double y[3], double z[3]);
112 {
113 this->GetResliceAxesDirectionCosines(&xyz[0], &xyz[3], &xyz[6]);
114 }
120
121
123
129 void SetResliceAxesOrigin(double x, double y, double z);
130 void SetResliceAxesOrigin(const double xyz[3])
131 {
132 this->SetResliceAxesOrigin(xyz[0], xyz[1], xyz[2]);
133 }
134 void GetResliceAxesOrigin(double xyz[3]);
136 {
138 return this->ResliceAxesOrigin;
139 }
140
141
143
155
157
167 vtkGetObjectMacro(InformationInput, vtkImageData);
169
171
182
184
190 vtkBooleanMacro(AutoCropOutput, vtkTypeBool);
193
195
198 vtkSetMacro(Wrap, vtkTypeBool);
199 vtkGetMacro(Wrap, vtkTypeBool);
200 vtkBooleanMacro(Wrap, vtkTypeBool);
202
204
208 vtkSetMacro(Mirror, vtkTypeBool);
209 vtkGetMacro(Mirror, vtkTypeBool);
210 vtkBooleanMacro(Mirror, vtkTypeBool);
212
214
224 vtkSetMacro(Border, vtkTypeBool);
225 vtkGetMacro(Border, vtkTypeBool);
226 vtkBooleanMacro(Border, vtkTypeBool);
228
230
235 vtkSetMacro(BorderThickness, double);
236 vtkGetMacro(BorderThickness, double);
238
243 vtkGetMacro(InterpolationMode, int);
247 virtual const char* GetInterpolationModeAsString();
249
251
258
260
267 vtkGetMacro(SlabMode, int);
272 virtual const char* GetSlabModeAsString();
274
276
279 vtkSetMacro(SlabNumberOfSlices, int);
280 vtkGetMacro(SlabNumberOfSlices, int);
282
284
293
295
304 vtkSetMacro(SlabSliceSpacingFraction, double);
305 vtkGetMacro(SlabSliceSpacingFraction, double);
307
309
315 vtkBooleanMacro(Optimization, vtkTypeBool);
317
319
326 vtkSetMacro(ScalarShift, double);
327 vtkGetMacro(ScalarShift, double);
329
331
338 vtkSetMacro(ScalarScale, double);
339 vtkGetMacro(ScalarScale, double);
341
343
353 vtkSetMacro(OutputScalarType, int);
354 vtkGetMacro(OutputScalarType, int);
356
358
364 vtkSetVector4Macro(BackgroundColor, double);
365 vtkGetVector4Macro(BackgroundColor, double);
367
369
372 void SetBackgroundLevel(double v) { this->SetBackgroundColor(v, v, v, v); }
373 double GetBackgroundLevel() { return this->GetBackgroundColor()[0]; }
375
377
381 virtual void SetOutputSpacing(double x, double y, double z);
382 virtual void SetOutputSpacing(const double a[3]) { this->SetOutputSpacing(a[0], a[1], a[2]); }
383 vtkGetVector3Macro(OutputSpacing, double);
386
388
397 virtual void SetOutputDirection(double xx, double xy, double xz, double yx, double yy, double yz,
398 double zx, double zy, double zz);
399 virtual void SetOutputDirection(const double a[9])
400 {
401 this->SetOutputDirection(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
402 }
403 vtkGetVector3Macro(OutputDirection, double);
406
408
412 virtual void SetOutputOrigin(double x, double y, double z);
413 virtual void SetOutputOrigin(const double a[3]) { this->SetOutputOrigin(a[0], a[1], a[2]); }
414 vtkGetVector3Macro(OutputOrigin, double);
417
419
423 virtual void SetOutputExtent(int a, int b, int c, int d, int e, int f);
424 virtual void SetOutputExtent(const int a[6])
425 {
426 this->SetOutputExtent(a[0], a[1], a[2], a[3], a[4], a[5]);
427 }
428 vtkGetVector6Macro(OutputExtent, int);
431
433
443 vtkSetMacro(OutputDimensionality, int);
444 vtkGetMacro(OutputDimensionality, int);
446
452
457
459
468 {
469 if (t && !this->GetInterpolate())
470 {
472 }
473 else if (!t && this->GetInterpolate())
474 {
476 }
477 }
478 void InterpolateOn() { this->SetInterpolate(1); }
479 void InterpolateOff() { this->SetInterpolate(0); }
482
484
492
494
502
504
511
512protected:
515
536 double OutputOrigin[3];
537 double OutputSpacing[3];
550
553
559
564 virtual int ConvertScalarInfo(int& scalarType, int& numComponents);
565
574 virtual void ConvertScalars(void* inPtr, void* outPtr, int inputType, int inputNumComponents,
575 int count, int idX, int idY, int idZ, int threadId);
576
577 void ConvertScalarsBase(void* inPtr, void* outPtr, int inputType, int inputNumComponents,
578 int count, int idX, int idY, int idZ, int threadId)
579 {
580 this->ConvertScalars(
581 inPtr, outPtr, inputType, inputNumComponents, count, idX, idY, idZ, threadId);
582 }
583
590
592 vtkInformation* inInfo, const double outDirection[9], double bounds[6]);
593 void AllocateOutputData(vtkImageData* output, vtkInformation* outInfo, int* uExtent) override;
599 vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData, int ext[6],
600 int id) override;
601 int FillInputPortInformation(int port, vtkInformation* info) override;
602 int FillOutputPortInformation(int port, vtkInformation* info) override;
603
605 vtkAbstractTransform* GetOptimizedTransform() { return this->OptimizedTransform; }
606
607private:
608 vtkImageReslice(const vtkImageReslice&) = delete;
609 void operator=(const vtkImageReslice&) = delete;
610};
611
612VTK_ABI_NAMESPACE_END
613#endif
interpolate data values from images
superclass for all geometric transformations
Proxy object to connect input/output ports.
vtkAlgorithmOutput * GetOutputPort()
general representation of visualization data
Detect and break reference loops.
topologically and geometrically regular array of data
Reslices a volume along a new set of axes.
void InterpolateOff()
Convenient methods for switching between nearest-neighbor and linear interpolation.
vtkTypeBool GetInterpolate()
Convenient methods for switching between nearest-neighbor and linear interpolation.
void SetResliceAxesDirectionCosines(const double x[3], const double y[3], const double z[3])
Specify the direction cosines for the ResliceAxes (i.e.
vtkImageStencilData * GetStencil()
Use a stencil to limit the calculations to a specific region of the output.
virtual void SetOutputOrigin(const double a[3])
Set the origin for the output data.
virtual double * GetBackgroundColor()
Set the background values for multi-component images.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double BackgroundColor[4]
void ReportReferences(vtkGarbageCollector *) override
Report object referenced by instances of this class.
int FillInputPortInformation(int port, vtkInformation *info) override
virtual void SetOutputExtent(int a, int b, int c, int d, int e, int f)
Set the extent for the output data.
void SetResliceAxesDirectionCosines(const double xyz[9])
Specify the direction cosines for the ResliceAxes (i.e.
vtkTypeBool TransformInputSampling
void GetAutoCroppedOutputBounds(vtkInformation *inInfo, const double outDirection[9], double bounds[6])
double OutputSpacing[3]
virtual int GetInterpolationMode()
double * GetResliceAxesOrigin()
Specify the origin for the ResliceAxes (i.e.
virtual void SetResliceTransform(vtkAbstractTransform *)
Set a transform to be applied to the resampling grid that has been defined via the ResliceAxes and th...
int RequestInformationBase(vtkInformationVector **, vtkInformationVector *)
For derived classes, this should be called at the very end of RequestInformation() to ensure that var...
virtual const char * GetInterpolationModeAsString()
void SetResliceAxesDirectionCosines(double x0, double x1, double x2, double y0, double y1, double y2, double z0, double z1, double z2)
Specify the direction cosines for the ResliceAxes (i.e.
vtkTypeBool HasConvertScalars
This should be set to 1 by derived classes that override the ConvertScalars method.
void SetSlabModeToMean()
Set the slab mode, for generating thick slices.
void InterpolateOn()
Convenient methods for switching between nearest-neighbor and linear interpolation.
void SetResliceAxesOrigin(double x, double y, double z)
Specify the origin for the ResliceAxes (i.e.
void SetResliceAxesOrigin(const double xyz[3])
Specify the origin for the ResliceAxes (i.e.
virtual void ConvertScalars(void *inPtr, void *outPtr, int inputType, int inputNumComponents, int count, int idX, int idY, int idZ, int threadId)
This should be overridden by derived classes that operate on the interpolated data before it is place...
void GetResliceAxesDirectionCosines(double xyz[9])
Specify the direction cosines for the ResliceAxes (i.e.
virtual void SetOutputExtent(const int a[6])
Set the extent for the output data.
virtual void SetOutputOrigin(double x, double y, double z)
Set the origin for the output data.
vtkTypeBool Optimization
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
void SetOutputSpacingToDefault()
Set the voxel spacing for the output data.
virtual void SetOutputDirection(const double a[9])
Set the direction for the output data.
double ResliceAxesOrigin[3]
double ResliceAxesDirectionCosines[9]
void SetStencilOutput(vtkImageStencilData *stencil)
Get the output stencil.
void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int ext[6], int id) override
If the subclass does not define an Execute method, then the task will be broken up,...
vtkImageStencilData * GetStencilOutput()
Get the output stencil.
virtual vtkAbstractImageInterpolator * GetInterpolator()
Set the interpolator to use.
void SetInterpolationModeToCubic()
vtkTypeBool UsePermuteExecute
virtual void SetOutputDirection(double xx, double xy, double xz, double yx, double yy, double yz, double zx, double zy, double zz)
Set the direction for the output data.
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to translate the update extent requests from each output port ...
vtkTypeBool ComputeOutputExtent
double SlabSliceSpacingFraction
vtkImageData * AllocateOutputData(vtkDataObject *, vtkInformation *) override
Allocate the output data.
void GetResliceAxesOrigin(double xyz[3])
Specify the origin for the ResliceAxes (i.e.
void SetSlabModeToMin()
Set the slab mode, for generating thick slices.
void SetInterpolate(vtkTypeBool t)
Convenient methods for switching between nearest-neighbor and linear interpolation.
virtual void SetOutputSpacing(const double a[3])
Set the voxel spacing for the output data.
double GetBackgroundLevel()
Set background grey level (for single-component images).
virtual int ConvertScalarInfo(int &scalarType, int &numComponents)
This should be overridden by derived classes that operate on the interpolated data before it is place...
~vtkImageReslice() override
void SetOutputDirectionToDefault()
Set the direction for the output data.
void AllocateOutputData(vtkImageData *output, vtkInformation *outInfo, int *uExtent) override
Allocate the output data.
void SetSlabModeToMax()
Set the slab mode, for generating thick slices.
vtkTypeBool HitInputExtent
vtkAbstractTransform * OptimizedTransform
vtkTypeBool SlabTrapezoidIntegration
vtkMatrix4x4 * IndexMatrix
vtkMTimeType GetMTime() override
When determining the modified time of the filter, this check the modified time of the transform and m...
vtkTypeBool ComputeOutputSpacing
vtkTypeBool AutoCropOutput
vtkTypeBool GenerateStencilOutput
double OutputDirection[9]
vtkMatrix4x4 * ResliceAxes
virtual void SetOutputSpacing(double x, double y, double z)
Set the voxel spacing for the output data.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called in response to a REQUEST_DATA request from the executive.
static vtkImageReslice * New()
void ConvertScalarsBase(void *inPtr, void *outPtr, int inputType, int inputNumComponents, int count, int idX, int idY, int idZ, int threadId)
double * GetResliceAxesDirectionCosines()
Specify the direction cosines for the ResliceAxes (i.e.
vtkAbstractTransform * ResliceTransform
virtual void SetInterpolator(vtkAbstractImageInterpolator *sampler)
Set the interpolator to use.
virtual void SetResliceAxes(vtkMatrix4x4 *)
This method is used to set up the axes for the output voxels.
vtkAbstractImageInterpolator * Interpolator
vtkAlgorithmOutput * GetStencilOutputPort()
Get the output stencil.
virtual void SetSlabMode(int)
Set the slab mode, for generating thick slices.
vtkTypeBool ComputeOutputOrigin
void SetInterpolationModeToNearestNeighbor()
void SetOutputExtentToDefault()
Set the extent for the output data.
virtual const char * GetSlabModeAsString()
Set the slab mode, for generating thick slices.
vtkAbstractTransform * GetOptimizedTransform()
void GetResliceAxesDirectionCosines(double x[3], double y[3], double z[3])
Specify the direction cosines for the ResliceAxes (i.e.
vtkMatrix4x4 * GetIndexMatrix(vtkInformation *inInfo, vtkInformation *outInfo)
vtkImageData * InformationInput
virtual void SetInterpolationMode(int)
Set interpolation mode (default: nearest neighbor).
void SetBackgroundLevel(double v)
Set background grey level (for single-component images).
void SetOutputOriginToDefault()
Set the origin for the output data.
virtual void SetInformationInput(vtkImageData *)
Set a vtkImageData from which the default Spacing, Origin, and WholeExtent of the output will be copi...
void SetInterpolationModeToLinear()
int FillOutputPortInformation(int port, vtkInformation *info) override
virtual void SetBackgroundColor(double, double, double, double)
Set the background values for multi-component images.
void SetStencilData(vtkImageStencilData *stencil)
Use a stencil to limit the calculations to a specific region of the output.
void SetSlabModeToSum()
Set the slab mode, for generating thick slices.
efficient description of an image stencil
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 4x4 transformation matrices
Superclass for mapping scalar values to colors.
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_RESLICE_CUBIC
#define VTK_RESLICE_NEAREST
#define VTK_RESLICE_LINEAR
#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:323
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO