VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkImageMathematics.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00027 #ifndef vtkImageMathematics_h 00028 #define vtkImageMathematics_h 00029 00030 00031 // Operation options. 00032 #define VTK_ADD 0 00033 #define VTK_SUBTRACT 1 00034 #define VTK_MULTIPLY 2 00035 #define VTK_DIVIDE 3 00036 #define VTK_INVERT 4 00037 #define VTK_SIN 5 00038 #define VTK_COS 6 00039 #define VTK_EXP 7 00040 #define VTK_LOG 8 00041 #define VTK_ABS 9 00042 #define VTK_SQR 10 00043 #define VTK_SQRT 11 00044 #define VTK_MIN 12 00045 #define VTK_MAX 13 00046 #define VTK_ATAN 14 00047 #define VTK_ATAN2 15 00048 #define VTK_MULTIPLYBYK 16 00049 #define VTK_ADDC 17 00050 #define VTK_CONJUGATE 18 00051 #define VTK_COMPLEX_MULTIPLY 19 00052 #define VTK_REPLACECBYK 20 00053 00054 #include "vtkImagingMathModule.h" // For export macro 00055 #include "vtkThreadedImageAlgorithm.h" 00056 00057 class VTKIMAGINGMATH_EXPORT vtkImageMathematics : public vtkThreadedImageAlgorithm 00058 { 00059 public: 00060 static vtkImageMathematics *New(); 00061 vtkTypeMacro(vtkImageMathematics,vtkThreadedImageAlgorithm); 00062 void PrintSelf(ostream& os, vtkIndent indent); 00063 00065 00066 vtkSetMacro(Operation,int); 00067 vtkGetMacro(Operation,int); 00069 00072 void SetOperationToAdd() {this->SetOperation(VTK_ADD);}; 00073 00076 void SetOperationToSubtract() {this->SetOperation(VTK_SUBTRACT);}; 00077 00080 void SetOperationToMultiply() {this->SetOperation(VTK_MULTIPLY);}; 00081 00084 void SetOperationToDivide() {this->SetOperation(VTK_DIVIDE);}; 00085 00086 void SetOperationToConjugate() {this->SetOperation(VTK_CONJUGATE);}; 00087 00088 void SetOperationToComplexMultiply() 00089 {this->SetOperation(VTK_COMPLEX_MULTIPLY);}; 00090 00093 void SetOperationToInvert() {this->SetOperation(VTK_INVERT);}; 00094 00097 void SetOperationToSin() {this->SetOperation(VTK_SIN);}; 00098 00101 void SetOperationToCos() {this->SetOperation(VTK_COS);}; 00102 00105 void SetOperationToExp() {this->SetOperation(VTK_EXP);}; 00106 00109 void SetOperationToLog() {this->SetOperation(VTK_LOG);}; 00110 00113 void SetOperationToAbsoluteValue() {this->SetOperation(VTK_ABS);}; 00114 00117 void SetOperationToSquare() {this->SetOperation(VTK_SQR);}; 00118 00121 void SetOperationToSquareRoot() {this->SetOperation(VTK_SQRT);}; 00122 00126 void SetOperationToMin() {this->SetOperation(VTK_MIN);}; 00127 00131 void SetOperationToMax() {this->SetOperation(VTK_MAX);}; 00132 00135 void SetOperationToATAN() {this->SetOperation(VTK_ATAN);}; 00136 00137 void SetOperationToATAN2() {this->SetOperation(VTK_ATAN2);}; 00138 00141 void SetOperationToMultiplyByK() {this->SetOperation(VTK_MULTIPLYBYK);}; 00142 00145 void SetOperationToAddConstant() {this->SetOperation(VTK_ADDC);}; 00146 00149 void SetOperationToReplaceCByK() {this->SetOperation(VTK_REPLACECBYK);}; 00150 00152 00154 vtkSetMacro(ConstantK,double); 00155 vtkGetMacro(ConstantK,double); 00157 00159 00161 vtkSetMacro(ConstantC,double); 00162 vtkGetMacro(ConstantC,double); 00164 00166 00167 vtkSetMacro(DivideByZeroToC,int); 00168 vtkGetMacro(DivideByZeroToC,int); 00169 vtkBooleanMacro(DivideByZeroToC,int); 00171 00173 00175 virtual void SetInput1Data(vtkDataObject *in) { this->SetInputData(0,in); } 00176 virtual void SetInput2Data(vtkDataObject *in) { this->SetInputData(1,in); } 00178 00179 protected: 00180 vtkImageMathematics(); 00181 ~vtkImageMathematics() {} 00182 00183 int Operation; 00184 double ConstantK; 00185 double ConstantC; 00186 int DivideByZeroToC; 00187 00188 virtual int RequestInformation (vtkInformation *, 00189 vtkInformationVector **, 00190 vtkInformationVector *); 00191 00192 virtual void ThreadedRequestData(vtkInformation *request, 00193 vtkInformationVector **inputVector, 00194 vtkInformationVector *outputVector, 00195 vtkImageData ***inData, 00196 vtkImageData **outData, 00197 int extent[6], int threadId); 00198 00199 virtual int FillInputPortInformation(int port, vtkInformation* info); 00200 00201 private: 00202 vtkImageMathematics(const vtkImageMathematics&); // Not implemented. 00203 void operator=(const vtkImageMathematics&); // Not implemented. 00204 }; 00205 00206 #endif 00207