ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkGradientMagnitudeRecursiveGaussianImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkGradientMagnitudeRecursiveGaussianImageFilter_h
19 #define itkGradientMagnitudeRecursiveGaussianImageFilter_h
20 
22 #include "itkImage.h"
23 #include "itkPixelTraits.h"
25 #include "itkSqrtImageFilter.h"
27 
28 namespace itk
29 {
45 // NOTE that the typename macro has to be used here in lieu
46 // of "typename" because VC++ doesn't like the typename keyword
47 // on the defaults of template parameters
48 template< typename TInputImage,
49  typename TOutputImage = TInputImage >
51  public InPlaceImageFilter< TInputImage, TOutputImage >
52 {
53 public:
59 
61  typedef TInputImage InputImageType;
62  typedef typename InputImageType::PixelType PixelType;
63 
65  itkStaticConstMacro(ImageDimension, unsigned int,
66  TInputImage::ImageDimension);
67 
69 
74  typedef float InternalRealType;
75  typedef Image< InternalRealType,
76  itkGetStaticConstMacro(ImageDimension) > RealImageType;
77 
83 
89 
91  typedef SqrtImageFilter<
93  TOutputImage
95 
98 
101 
103 
105  typedef typename TOutputImage::Pointer OutputImagePointer;
106 
108  typedef TOutputImage OutputImageType;
109  typedef typename OutputImageType::PixelType OutputPixelType;
110 
113  typedef Image< InternalRealType,
114  itkGetStaticConstMacro(ImageDimension) > CumulativeImageType;
116 
118  itkNewMacro(Self);
119 
123 
125  void SetSigma(RealType sigma);
126  RealType GetSigma();
128 
132  void SetNormalizeAcrossScale(bool normalizeInScaleSpace);
133  itkGetConstMacro(NormalizeAcrossScale, bool);
135 
136  void SetNumberOfThreads(ThreadIdType nb) ITK_OVERRIDE;
137 
138 #ifdef ITK_USE_CONCEPT_CHECKING
139  // Begin concept checking
140  itkConceptMacro( InputHasNumericTraitsCheck,
142  // End concept checking
143 #endif
144 
145 protected:
148  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
149 
151  void GenerateData(void) ITK_OVERRIDE;
152 
159  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
160 
164  void EnlargeOutputRequestedRegion(DataObject *output) ITK_OVERRIDE;
165 
166 private:
167  ITK_DISALLOW_COPY_AND_ASSIGN(GradientMagnitudeRecursiveGaussianImageFilter);
168 
170  {
171  public:
172  SqrSpacing():m_Spacing(0) {}
174  bool operator!=(const SqrSpacing & other) const
175  {
176  return !( *this == other );
177  }
178 
179  bool operator==(const SqrSpacing & other) const
180  {
181  return other.m_Spacing == m_Spacing;
182  }
183 
185  {
186  return a + itk::Math::sqr(b / m_Spacing);
187  }
188 
189  double m_Spacing;
190  };
191 
194 
195  GaussianFilterPointer m_SmoothingFilters[ImageDimension - 1];
199 
202 };
203 } // end namespace itk
204 
205 #ifndef ITK_MANUAL_INSTANTIATION
206 #include "itkGradientMagnitudeRecursiveGaussianImageFilter.hxx"
207 #endif
208 
209 #endif
Computes the Magnitude of the Gradient of an image by convolution with the first derivative of a Gaus...
InternalRealType operator()(const InternalRealType &a, const InternalRealType &b)
Computes the square root of each pixel.
Base class for computing IIR convolution with an approximation of a Gaussian kernel.
RecursiveGaussianImageFilter< RealImageType, RealImageType > GaussianFilterType
Base class for all process objects that output image data.
bool sqr(const bool x)
Definition: itkMath.h:824
BinaryFunctorImageFilter< RealImageType, RealImageType, RealImageType, SqrSpacing > SqrSpacingFilterType
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Image< InternalRealType, itkGetStaticConstMacro(ImageDimension) > CumulativeImageType
RecursiveGaussianImageFilter< InputImageType, RealImageType > DerivativeFilterType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Image< InternalRealType, itkGetStaticConstMacro(ImageDimension) > RealImageType
Define additional traits for native types such as int or float.
Base class for filters that take an image as input and overwrite that image as the output...
#define itkConceptMacro(name, concept)
Base class for all data objects in ITK.
Templated n-dimensional image class.
Definition: itkImage.h:75
Implements pixel-wise generic operation of two images, or of an image and a constant.