VTK  9.7.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
82
83#ifndef vtkImageReslice_h
84#define vtkImageReslice_h
85
86#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_7_0
87#include "vtkImagingCoreModule.h" // For export macro
89#include "vtkWrappingHints.h"
90
91// interpolation mode constants
92#define VTK_RESLICE_NEAREST VTK_NEAREST_INTERPOLATION
93#define VTK_RESLICE_LINEAR VTK_LINEAR_INTERPOLATION
94#define VTK_RESLICE_CUBIC VTK_CUBIC_INTERPOLATION
95
96VTK_ABI_NAMESPACE_BEGIN
97class vtkImageData;
99class vtkMatrix4x4;
103class vtkDataArray;
104
106{
107public:
110
111 void PrintSelf(ostream& os, vtkIndent indent) override;
112
114
130 vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
132
134
140 void SetResliceAxesDirectionCosines(double x0, double x1, double x2, double y0, double y1,
141 double y2, double z0, double z1, double z2);
142 void SetResliceAxesDirectionCosines(const double x[3], const double y[3], const double z[3])
143 {
144 this->SetResliceAxesDirectionCosines(x[0], x[1], x[2], y[0], y[1], y[2], z[0], z[1], z[2]);
145 }
146 void SetResliceAxesDirectionCosines(const double xyz[9])
147 {
149 xyz[0], xyz[1], xyz[2], xyz[3], xyz[4], xyz[5], xyz[6], xyz[7], xyz[8]);
150 }
151 void GetResliceAxesDirectionCosines(double x[3], double y[3], double z[3]);
153 {
154 this->GetResliceAxesDirectionCosines(&xyz[0], &xyz[3], &xyz[6]);
155 }
161
162
164
170 void SetResliceAxesOrigin(double x, double y, double z);
171 void SetResliceAxesOrigin(const double xyz[3])
172 {
173 this->SetResliceAxesOrigin(xyz[0], xyz[1], xyz[2]);
174 }
175 void GetResliceAxesOrigin(double xyz[3]);
177 {
179 return this->ResliceAxesOrigin;
180 }
181
182
184
196
198
208 vtkGetObjectMacro(InformationInput, vtkImageData);
210
212
223
225
231 vtkBooleanMacro(AutoCropOutput, vtkTypeBool);
234
236
239 vtkSetMacro(Wrap, vtkTypeBool);
240 vtkGetMacro(Wrap, vtkTypeBool);
241 vtkBooleanMacro(Wrap, vtkTypeBool);
243
245
249 vtkSetMacro(Mirror, vtkTypeBool);
250 vtkGetMacro(Mirror, vtkTypeBool);
251 vtkBooleanMacro(Mirror, vtkTypeBool);
253
255
265 vtkSetMacro(Border, vtkTypeBool);
266 vtkGetMacro(Border, vtkTypeBool);
267 vtkBooleanMacro(Border, vtkTypeBool);
269
271
276 vtkSetMacro(BorderThickness, double);
277 vtkGetMacro(BorderThickness, double);
279
284 vtkGetMacro(InterpolationMode, int);
288 virtual const char* GetInterpolationModeAsString();
290
292
299
301
308 vtkGetMacro(SlabMode, int);
313 virtual const char* GetSlabModeAsString();
315
317
320 vtkSetMacro(SlabNumberOfSlices, int);
321 vtkGetMacro(SlabNumberOfSlices, int);
323
325
334
336
345 vtkSetMacro(SlabSliceSpacingFraction, double);
346 vtkGetMacro(SlabSliceSpacingFraction, double);
348
350
356 vtkBooleanMacro(Optimization, vtkTypeBool);
358
360
367 vtkSetMacro(ScalarShift, double);
368 vtkGetMacro(ScalarShift, double);
370
372
379 vtkSetMacro(ScalarScale, double);
380 vtkGetMacro(ScalarScale, double);
382
384
394 vtkSetMacro(OutputScalarType, int);
395 vtkGetMacro(OutputScalarType, int);
397
399
405 vtkSetVector4Macro(BackgroundColor, double);
406 vtkGetVector4Macro(BackgroundColor, double);
408
410
413 void SetBackgroundLevel(double v) { this->SetBackgroundColor(v, v, v, v); }
414 double GetBackgroundLevel() { return this->GetBackgroundColor()[0]; }
416
418
422 virtual void SetOutputSpacing(double x, double y, double z);
423 virtual void SetOutputSpacing(const double a[3]) { this->SetOutputSpacing(a[0], a[1], a[2]); }
424 vtkGetVector3Macro(OutputSpacing, double);
427
429
438 virtual void SetOutputDirection(double xx, double xy, double xz, double yx, double yy, double yz,
439 double zx, double zy, double zz);
440 virtual void SetOutputDirection(const double a[9])
441 {
442 this->SetOutputDirection(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
443 }
444 vtkGetVector3Macro(OutputDirection, double);
447
449
453 virtual void SetOutputOrigin(double x, double y, double z);
454 virtual void SetOutputOrigin(const double a[3]) { this->SetOutputOrigin(a[0], a[1], a[2]); }
455 vtkGetVector3Macro(OutputOrigin, double);
458
460
464 virtual void SetOutputExtent(int a, int b, int c, int d, int e, int f);
465 virtual void SetOutputExtent(const int a[6])
466 {
467 this->SetOutputExtent(a[0], a[1], a[2], a[3], a[4], a[5]);
468 }
469 vtkGetVector6Macro(OutputExtent, int);
472
474
484 vtkSetMacro(OutputDimensionality, int);
485 vtkGetMacro(OutputDimensionality, int);
487
493
498
500
509 {
510 if (t && !this->GetInterpolate())
511 {
513 }
514 else if (!t && this->GetInterpolate())
515 {
517 }
518 }
519 void InterpolateOn() { this->SetInterpolate(1); }
520 void InterpolateOff() { this->SetInterpolate(0); }
523
525
533
535
543
545
552
553protected:
556
577 double OutputOrigin[3];
578 double OutputSpacing[3];
591
594
600
605 virtual int ConvertScalarInfo(int& scalarType, int& numComponents);
606
615 virtual void ConvertScalars(
616 vtkDataArray* input, void* outPtr, int count, int idX, int idY, int idZ, int threadId);
617
619 vtkDataArray* input, void* outPtr, int count, int idX, int idY, int idZ, int threadId)
620 {
621 this->ConvertScalars(input, outPtr, count, idX, idY, idZ, threadId);
622 }
623
631 VTK_DEPRECATED_IN_9_7_0("Use the ConvertScalars overload taking vtkDataArray* instead")
632 virtual void ConvertScalars(VTK_FUTURE_CONST void* inPtr, void* outPtr, int inputType,
633 int inputNumComponents, int count, int idX, int idY, int idZ, int threadId);
634
635 void ConvertScalarsBase(VTK_FUTURE_CONST void* inPtr, void* outPtr, int inputType,
636 int inputNumComponents, int count, int idX, int idY, int idZ, int threadId);
637
644
646 vtkInformation* inInfo, const double outDirection[9], double bounds[6]);
648 vtkImageData* output, vtkInformation* outInfo, VTK_FUTURE_CONST int uExtent[6]) override;
654 vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
655 VTK_FUTURE_CONST int ext[6], int id) override;
656 int FillInputPortInformation(int port, vtkInformation* info) override;
657 int FillOutputPortInformation(int port, vtkInformation* info) override;
658
660 vtkAbstractTransform* GetOptimizedTransform() { return this->OptimizedTransform; }
661
662private:
663 vtkImageReslice(const vtkImageReslice&) = delete;
664 void operator=(const vtkImageReslice&) = delete;
665};
666
667VTK_ABI_NAMESPACE_END
668#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 ConvertScalars(vtkDataArray *input, void *outPtr, 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...
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
These method should be reimplemented by subclasses that have more than a single input or single outpu...
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.
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.
vtkImageStencilData * GetStencilOutput()
Get the output stencil.
virtual vtkAbstractImageInterpolator * GetInterpolator()
Set the interpolator to use.
void AllocateOutputData(vtkImageData *output, vtkInformation *outInfo, VTK_FUTURE_CONST int uExtent[6]) override
Allocate the output data.
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
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 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()
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 ConvertScalarsBase(vtkDataArray *input, void *outPtr, int count, int idX, int idY, int idZ, int threadId)
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
These method should be reimplemented by subclasses that have more than a single input or single outpu...
void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, VTK_FUTURE_CONST int ext[6], int id) override
If the subclass does not define an Execute method, then the task will be broken up,...
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:108
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 vtkDataArray
#define VTK_DEPRECATED_IN_9_7_0(reason)
#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:318
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO