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 =========================================================================*/
134 #ifndef vtkImageMathematics_h
135 #define vtkImageMathematics_h
136 
137 // Operation options.
138 #define VTK_ADD 0
139 #define VTK_SUBTRACT 1
140 #define VTK_MULTIPLY 2
141 #define VTK_DIVIDE 3
142 #define VTK_INVERT 4
143 #define VTK_SIN 5
144 #define VTK_COS 6
145 #define VTK_EXP 7
146 #define VTK_LOG 8
147 #define VTK_ABS 9
148 #define VTK_SQR 10
149 #define VTK_SQRT 11
150 #define VTK_MIN 12
151 #define VTK_MAX 13
152 #define VTK_ATAN 14
153 #define VTK_ATAN2 15
154 #define VTK_MULTIPLYBYK 16
155 #define VTK_ADDC 17
156 #define VTK_CONJUGATE 18
157 #define VTK_COMPLEX_MULTIPLY 19
158 #define VTK_REPLACECBYK 20
159 
160 #include "vtkImagingMathModule.h" // For export macro
162 
163 class VTKIMAGINGMATH_EXPORT vtkImageMathematics : public vtkThreadedImageAlgorithm
164 {
165 public:
168  void PrintSelf(ostream& os, vtkIndent indent) override;
169 
171 
174  vtkSetMacro(Operation, int);
175  vtkGetMacro(Operation, int);
177 
182  void SetOperationToAdd() { this->SetOperation(VTK_ADD); }
183 
188  void SetOperationToSubtract() { this->SetOperation(VTK_SUBTRACT); }
189 
194  void SetOperationToMultiply() { this->SetOperation(VTK_MULTIPLY); }
195 
200  void SetOperationToDivide() { this->SetOperation(VTK_DIVIDE); }
201 
202  void SetOperationToConjugate() { this->SetOperation(VTK_CONJUGATE); }
203 
204  void SetOperationToComplexMultiply() { this->SetOperation(VTK_COMPLEX_MULTIPLY); }
205 
210  void SetOperationToInvert() { this->SetOperation(VTK_INVERT); }
211 
216  void SetOperationToSin() { this->SetOperation(VTK_SIN); }
217 
222  void SetOperationToCos() { this->SetOperation(VTK_COS); }
223 
228  void SetOperationToExp() { this->SetOperation(VTK_EXP); }
229 
234  void SetOperationToLog() { this->SetOperation(VTK_LOG); }
235 
240  void SetOperationToAbsoluteValue() { this->SetOperation(VTK_ABS); }
241 
246  void SetOperationToSquare() { this->SetOperation(VTK_SQR); }
247 
252  void SetOperationToSquareRoot() { this->SetOperation(VTK_SQRT); }
253 
258  void SetOperationToMin() { this->SetOperation(VTK_MIN); }
259 
264  void SetOperationToMax() { this->SetOperation(VTK_MAX); }
265 
270  void SetOperationToATAN() { this->SetOperation(VTK_ATAN); }
271 
272  void SetOperationToATAN2() { this->SetOperation(VTK_ATAN2); }
273 
278  void SetOperationToMultiplyByK() { this->SetOperation(VTK_MULTIPLYBYK); }
279 
284  void SetOperationToAddConstant() { this->SetOperation(VTK_ADDC); }
285 
290  void SetOperationToReplaceCByK() { this->SetOperation(VTK_REPLACECBYK); }
291 
293 
296  vtkSetMacro(ConstantK, double);
297  vtkGetMacro(ConstantK, double);
299 
301 
304  vtkSetMacro(ConstantC, double);
305  vtkGetMacro(ConstantC, double);
307 
309 
312  vtkSetMacro(DivideByZeroToC, vtkTypeBool);
313  vtkGetMacro(DivideByZeroToC, vtkTypeBool);
314  vtkBooleanMacro(DivideByZeroToC, vtkTypeBool);
316 
321  virtual void SetInput1Data(vtkDataObject* in) { this->SetInputData(0, in); }
322  virtual void SetInput2Data(vtkDataObject* in) { this->SetInputData(1, in); }
323 
324 protected:
326  ~vtkImageMathematics() override = default;
327 
329  double ConstantK;
330  double ConstantC;
332 
334 
336  vtkInformationVector* outputVector, vtkImageData*** inData, vtkImageData** outData,
337  int outExt[6], int threadId) override;
338 
340 
341 private:
342  vtkImageMathematics(const vtkImageMathematics&) = delete;
343  void operator=(const vtkImageMathematics&) = delete;
344 };
345 
346 #endif
vtkImageMathematics::~vtkImageMathematics
~vtkImageMathematics() override=default
vtkImageMathematics::SetOperationToSubtract
void SetOperationToSubtract()
Set each pixel in the output image to the difference of the corresponding pixels in Input1 and Input2...
Definition: vtkImageMathematics.h:188
VTK_COS
#define VTK_COS
Definition: vtkImageMathematics.h:144
VTK_SQRT
#define VTK_SQRT
Definition: vtkImageMathematics.h:149
vtkImageMathematics::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageMathematics::SetOperationToAddConstant
void SetOperationToAddConstant()
Set each pixel in the output image to the product of ConstantC with the corresponding pixel in Input1...
Definition: vtkImageMathematics.h:284
vtkImageMathematics::SetOperationToMin
void SetOperationToMin()
Set each pixel in the output image to the minimum of the corresponding pixels in Input1 and Input2.
Definition: vtkImageMathematics.h:258
VTK_ADDC
#define VTK_ADDC
Definition: vtkImageMathematics.h:155
vtkImageMathematics::New
static vtkImageMathematics * New()
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
vtkImageMathematics::Operation
int Operation
Definition: vtkImageMathematics.h:328
vtkImageMathematics::SetOperationToInvert
void SetOperationToInvert()
Set each pixel in the output image to 1 over the corresponding pixel in Input1 and Input2 (output = 1...
Definition: vtkImageMathematics.h:210
vtkThreadedImageAlgorithm
Generic filter that has one input.
Definition: vtkThreadedImageAlgorithm.h:39
vtkImageMathematics
Add, subtract, multiply, divide, invert, sin, cos, exp, log.
Definition: vtkImageMathematics.h:164
vtkImageMathematics::vtkImageMathematics
vtkImageMathematics()
vtkImageMathematics::SetOperationToLog
void SetOperationToLog()
Set each pixel in the output image to the log of the corresponding pixel in Input1.
Definition: vtkImageMathematics.h:234
vtkImageMathematics::SetOperationToMax
void SetOperationToMax()
Set each pixel in the output image to the maximum of the corresponding pixels in Input1 and Input2.
Definition: vtkImageMathematics.h:264
vtkImageMathematics::SetOperationToExp
void SetOperationToExp()
Set each pixel in the output image to the exponential of the corresponding pixel in Input1.
Definition: vtkImageMathematics.h:228
VTK_ADD
#define VTK_ADD
Definition: vtkImageMathematics.h:138
VTK_MULTIPLY
#define VTK_MULTIPLY
Definition: vtkImageMathematics.h:140
vtkThreadedImageAlgorithm.h
VTK_MAX
#define VTK_MAX
Definition: vtkImageMathematics.h:151
vtkImageAlgorithm::SetInputData
void SetInputData(vtkDataObject *)
Assign a data object as input.
VTK_ABS
#define VTK_ABS
Definition: vtkImageMathematics.h:147
vtkImageMathematics::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
vtkX3D::port
@ port
Definition: vtkX3D.h:453
vtkImageMathematics::SetOperationToAdd
void SetOperationToAdd()
Set each pixel in the output image to the sum of the corresponding pixels in Input1 and Input2.
Definition: vtkImageMathematics.h:182
vtkImageMathematics::DivideByZeroToC
vtkTypeBool DivideByZeroToC
Definition: vtkImageMathematics.h:331
VTK_MULTIPLYBYK
#define VTK_MULTIPLYBYK
Definition: vtkImageMathematics.h:154
vtkImageMathematics::SetOperationToSquare
void SetOperationToSquare()
Set each pixel in the output image to the square of the corresponding pixel in Input1.
Definition: vtkImageMathematics.h:246
VTK_DIVIDE
#define VTK_DIVIDE
Definition: vtkImageMathematics.h:141
VTK_INVERT
#define VTK_INVERT
Definition: vtkImageMathematics.h:142
VTK_SUBTRACT
#define VTK_SUBTRACT
Definition: vtkImageMathematics.h:139
VTK_CONJUGATE
#define VTK_CONJUGATE
Definition: vtkImageMathematics.h:156
VTK_ATAN
#define VTK_ATAN
Definition: vtkImageMathematics.h:152
vtkImageMathematics::SetOperationToDivide
void SetOperationToDivide()
Set each pixel in the output image to the quotient of the corresponding pixels in Input1 and Input2 (...
Definition: vtkImageMathematics.h:200
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkImageMathematics::SetOperationToMultiply
void SetOperationToMultiply()
Set each pixel in the output image to the product of the corresponding pixels in Input1 and Input2.
Definition: vtkImageMathematics.h:194
vtkImageMathematics::SetOperationToComplexMultiply
void SetOperationToComplexMultiply()
Definition: vtkImageMathematics.h:204
vtkImageMathematics::SetOperationToSin
void SetOperationToSin()
Set each pixel in the output image to the sine of the corresponding pixel in Input1.
Definition: vtkImageMathematics.h:216
vtkImageMathematics::SetOperationToCos
void SetOperationToCos()
Set each pixel in the output image to the cosine of the corresponding pixel in Input1.
Definition: vtkImageMathematics.h:222
vtkImageMathematics::SetInput2Data
virtual void SetInput2Data(vtkDataObject *in)
Definition: vtkImageMathematics.h:322
vtkImageMathematics::ConstantC
double ConstantC
Definition: vtkImageMathematics.h:330
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkX3D::info
@ info
Definition: vtkX3D.h:382
VTK_REPLACECBYK
#define VTK_REPLACECBYK
Definition: vtkImageMathematics.h:158
VTK_MIN
#define VTK_MIN
Definition: vtkImageMathematics.h:150
VTK_ATAN2
#define VTK_ATAN2
Definition: vtkImageMathematics.h:153
vtkImageMathematics::SetOperationToATAN
void SetOperationToATAN()
Set each pixel in the output image to the arctangent of the corresponding pixel in Input1.
Definition: vtkImageMathematics.h:270
vtkImageMathematics::RequestInformation
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
VTK_COMPLEX_MULTIPLY
#define VTK_COMPLEX_MULTIPLY
Definition: vtkImageMathematics.h:157
vtkImageMathematics::SetOperationToSquareRoot
void SetOperationToSquareRoot()
Set each pixel in the output image to the square root of the corresponding pixel in Input1.
Definition: vtkImageMathematics.h:252
vtkImageMathematics::SetInput1Data
virtual void SetInput1Data(vtkDataObject *in)
Set the two inputs to this filter.
Definition: vtkImageMathematics.h:321
vtkImageMathematics::SetOperationToATAN2
void SetOperationToATAN2()
Definition: vtkImageMathematics.h:272
vtkImageMathematics::SetOperationToReplaceCByK
void SetOperationToReplaceCByK()
Find every pixel in Input1 that equals ConstantC and set the corresponding pixels in the Output to Co...
Definition: vtkImageMathematics.h:290
VTK_LOG
#define VTK_LOG
Definition: vtkImageMathematics.h:146
VTK_EXP
#define VTK_EXP
Definition: vtkImageMathematics.h:145
vtkImageMathematics::SetOperationToAbsoluteValue
void SetOperationToAbsoluteValue()
Set each pixel in the output image to the absolute value of the corresponding pixel in Input1.
Definition: vtkImageMathematics.h:240
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:169
vtkImageMathematics::ThreadedRequestData
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::ConstantK
double ConstantK
Definition: vtkImageMathematics.h:329
vtkImageMathematics::SetOperationToMultiplyByK
void SetOperationToMultiplyByK()
Set each pixel in the output image to the product of ConstantK with the corresponding pixel in Input1...
Definition: vtkImageMathematics.h:278
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkImageMathematics::SetOperationToConjugate
void SetOperationToConjugate()
Definition: vtkImageMathematics.h:202
VTK_SIN
#define VTK_SIN
Definition: vtkImageMathematics.h:143
VTK_SQR
#define VTK_SQR
Definition: vtkImageMathematics.h:148