VTK  9.1.0
vtkImageMathematics.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkImageMathematics.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=========================================================================*/
34#ifndef vtkImageMathematics_h
35#define vtkImageMathematics_h
36
37// Operation options.
38#define VTK_ADD 0
39#define VTK_SUBTRACT 1
40#define VTK_MULTIPLY 2
41#define VTK_DIVIDE 3
42#define VTK_INVERT 4
43#define VTK_SIN 5
44#define VTK_COS 6
45#define VTK_EXP 7
46#define VTK_LOG 8
47#define VTK_ABS 9
48#define VTK_SQR 10
49#define VTK_SQRT 11
50#define VTK_MIN 12
51#define VTK_MAX 13
52#define VTK_ATAN 14
53#define VTK_ATAN2 15
54#define VTK_MULTIPLYBYK 16
55#define VTK_ADDC 17
56#define VTK_CONJUGATE 18
57#define VTK_COMPLEX_MULTIPLY 19
58#define VTK_REPLACECBYK 20
59
60#include "vtkImagingMathModule.h" // For export macro
62
63class VTKIMAGINGMATH_EXPORT vtkImageMathematics : public vtkThreadedImageAlgorithm
64{
65public:
68 void PrintSelf(ostream& os, vtkIndent indent) override;
69
71
74 vtkSetMacro(Operation, int);
75 vtkGetMacro(Operation, int);
77
82 void SetOperationToAdd() { this->SetOperation(VTK_ADD); }
83
88 void SetOperationToSubtract() { this->SetOperation(VTK_SUBTRACT); }
89
94 void SetOperationToMultiply() { this->SetOperation(VTK_MULTIPLY); }
95
100 void SetOperationToDivide() { this->SetOperation(VTK_DIVIDE); }
101
102 void SetOperationToConjugate() { this->SetOperation(VTK_CONJUGATE); }
103
105
110 void SetOperationToInvert() { this->SetOperation(VTK_INVERT); }
111
116 void SetOperationToSin() { this->SetOperation(VTK_SIN); }
117
122 void SetOperationToCos() { this->SetOperation(VTK_COS); }
123
128 void SetOperationToExp() { this->SetOperation(VTK_EXP); }
129
134 void SetOperationToLog() { this->SetOperation(VTK_LOG); }
135
140 void SetOperationToAbsoluteValue() { this->SetOperation(VTK_ABS); }
141
146 void SetOperationToSquare() { this->SetOperation(VTK_SQR); }
147
152 void SetOperationToSquareRoot() { this->SetOperation(VTK_SQRT); }
153
158 void SetOperationToMin() { this->SetOperation(VTK_MIN); }
159
164 void SetOperationToMax() { this->SetOperation(VTK_MAX); }
165
170 void SetOperationToATAN() { this->SetOperation(VTK_ATAN); }
171
172 void SetOperationToATAN2() { this->SetOperation(VTK_ATAN2); }
173
178 void SetOperationToMultiplyByK() { this->SetOperation(VTK_MULTIPLYBYK); }
179
184 void SetOperationToAddConstant() { this->SetOperation(VTK_ADDC); }
185
190 void SetOperationToReplaceCByK() { this->SetOperation(VTK_REPLACECBYK); }
191
193
196 vtkSetMacro(ConstantK, double);
197 vtkGetMacro(ConstantK, double);
199
201
204 vtkSetMacro(ConstantC, double);
205 vtkGetMacro(ConstantC, double);
207
209
212 vtkSetMacro(DivideByZeroToC, vtkTypeBool);
213 vtkGetMacro(DivideByZeroToC, vtkTypeBool);
214 vtkBooleanMacro(DivideByZeroToC, vtkTypeBool);
216
221 virtual void SetInput1Data(vtkDataObject* in) { this->SetInputData(0, in); }
222 virtual void SetInput2Data(vtkDataObject* in) { this->SetInputData(1, in); }
223
224protected:
226 ~vtkImageMathematics() override = default;
227
229 double ConstantK;
230 double ConstantC;
232
234
236 vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
237 int outExt[6], int threadId) override;
238
240
241private:
243 void operator=(const vtkImageMathematics&) = delete;
244};
245
246#endif
general representation of visualization data
Definition: vtkDataObject.h:69
void SetInputData(vtkDataObject *)
Assign a data object as input.
topologically and geometrically regular array of data
Definition: vtkImageData.h:57
Add, subtract, multiply, divide, invert, sin, cos, exp, log.
void SetOperationToMultiply()
Set each pixel in the output image to the product of the corresponding pixels in Input1 and Input2.
void SetOperationToATAN()
Set each pixel in the output image to the arctangent of the corresponding pixel in Input1.
virtual void SetInput1Data(vtkDataObject *in)
Set the two inputs to this filter.
void SetOperationToMultiplyByK()
Set each pixel in the output image to the product of ConstantK with the corresponding pixel in Input1...
void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int outExt[6], int threadId) override
If the subclass does not define an Execute method, then the task will be broken up,...
~vtkImageMathematics() override=default
void SetOperationToSquareRoot()
Set each pixel in the output image to the square root of the corresponding pixel in Input1.
void SetOperationToMin()
Set each pixel in the output image to the minimum of the corresponding pixels in Input1 and Input2.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetInput2Data(vtkDataObject *in)
void SetOperationToDivide()
Set each pixel in the output image to the quotient of the corresponding pixels in Input1 and Input2 (...
void SetOperationToExp()
Set each pixel in the output image to the exponential of the corresponding pixel in Input1.
void SetOperationToSubtract()
Set each pixel in the output image to the difference of the corresponding pixels in Input1 and Input2...
void SetOperationToLog()
Set each pixel in the output image to the log of the corresponding pixel in Input1.
void SetOperationToMax()
Set each pixel in the output image to the maximum of the corresponding pixels in Input1 and Input2.
void SetOperationToAdd()
Set each pixel in the output image to the sum of the corresponding pixels in Input1 and Input2.
int FillInputPortInformation(int port, vtkInformation *info) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
void SetOperationToReplaceCByK()
Find every pixel in Input1 that equals ConstantC and set the corresponding pixels in the Output to Co...
void SetOperationToSin()
Set each pixel in the output image to the sine of the corresponding pixel in Input1.
void SetOperationToAddConstant()
Set each pixel in the output image to the product of ConstantC with the corresponding pixel in Input1...
void SetOperationToAbsoluteValue()
Set each pixel in the output image to the absolute value of the corresponding pixel in Input1.
static vtkImageMathematics * New()
void SetOperationToSquare()
Set each pixel in the output image to the square of the corresponding pixel in Input1.
void SetOperationToInvert()
Set each pixel in the output image to 1 over the corresponding pixel in Input1 and Input2 (output = 1...
void SetOperationToCos()
Set each pixel in the output image to the cosine of the corresponding pixel in Input1.
a simple class to control print indentation
Definition: vtkIndent.h:43
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Generic filter that has one input.
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_SQRT
#define VTK_MULTIPLYBYK
#define VTK_LOG
#define VTK_ATAN
#define VTK_ATAN2
#define VTK_INVERT
#define VTK_SUBTRACT
#define VTK_EXP
#define VTK_MIN
#define VTK_MULTIPLY
#define VTK_COMPLEX_MULTIPLY
#define VTK_SIN
#define VTK_ABS
#define VTK_COS
#define VTK_ADD
#define VTK_SQR
#define VTK_MAX
#define VTK_REPLACECBYK
#define VTK_ADDC
#define VTK_CONJUGATE
#define VTK_DIVIDE