1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkImageGradientMagnitude.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 =========================================================================*/ 15 /** 16 * @class vtkImageGradientMagnitude 17 * @brief Computes magnitude of the gradient. 18 * 19 * 20 * vtkImageGradientMagnitude computes the gradient magnitude of an image. 21 * Setting the dimensionality determines whether the gradient is computed on 22 * 2D images, or 3D volumes. The default is two dimensional XY images. 23 * 24 * @sa 25 * vtkImageGradient vtkImageMagnitude 26 */ 27 28 #ifndef vtkImageGradientMagnitude_h 29 #define vtkImageGradientMagnitude_h 30 31 32 #include "vtkImagingGeneralModule.h" // For export macro 33 #include "vtkThreadedImageAlgorithm.h" 34 35 class VTKIMAGINGGENERAL_EXPORT vtkImageGradientMagnitude : public vtkThreadedImageAlgorithm 36 { 37 public: 38 static vtkImageGradientMagnitude *New(); 39 vtkTypeMacro(vtkImageGradientMagnitude,vtkThreadedImageAlgorithm); 40 void PrintSelf(ostream& os, vtkIndent indent) override; 41 42 //@{ 43 /** 44 * If "HandleBoundariesOn" then boundary pixels are duplicated 45 * So central differences can get values. 46 */ 47 vtkSetMacro(HandleBoundaries, vtkTypeBool); 48 vtkGetMacro(HandleBoundaries, vtkTypeBool); 49 vtkBooleanMacro(HandleBoundaries, vtkTypeBool); 50 //@} 51 52 //@{ 53 /** 54 * Determines how the input is interpreted (set of 2d slices ...) 55 */ 56 vtkSetClampMacro(Dimensionality,int,2,3); 57 vtkGetMacro(Dimensionality,int); 58 //@} 59 60 protected: 61 vtkImageGradientMagnitude(); ~vtkImageGradientMagnitude()62 ~vtkImageGradientMagnitude() override {} 63 64 vtkTypeBool HandleBoundaries; 65 int Dimensionality; 66 67 int RequestInformation (vtkInformation*, 68 vtkInformationVector**, 69 vtkInformationVector*) override; 70 int RequestUpdateExtent(vtkInformation*, 71 vtkInformationVector**, 72 vtkInformationVector*) override; 73 74 void ThreadedExecute (vtkImageData *inData, vtkImageData *outData, 75 int extent[6], int id) override; 76 private: 77 vtkImageGradientMagnitude(const vtkImageGradientMagnitude&) = delete; 78 void operator=(const vtkImageGradientMagnitude&) = delete; 79 }; 80 81 #endif 82 83 84 85