ITK  4.8.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  GradientMagnitudeRecursiveGaussianImageFilter(const Self &); //purposely not
168  // implemented
169  void operator=(const Self &); //purposely not
170 
171  // implemented
172 
174  {
175  public:
176  SqrSpacing():m_Spacing(0) {}
178  bool operator!=(const SqrSpacing & other) const
179  {
180  return !( *this == other );
181  }
182 
183  bool operator==(const SqrSpacing & other) const
184  {
185  return other.m_Spacing == m_Spacing;
186  }
187 
189  {
190  return a + vnl_math_sqr(b / m_Spacing);
191  }
192 
193  double m_Spacing;
194  };
195 
198 
203 
206 };
207 } // end namespace itk
208 
209 #ifndef ITK_MANUAL_INSTANTIATION
210 #include "itkGradientMagnitudeRecursiveGaussianImageFilter.hxx"
211 #endif
212 
213 #endif
Computes the Magnitude of the Gradient of an image by convolution with the first derivative of a Gaus...
void SetNumberOfThreads(ThreadIdType nb) override
InternalRealType operator()(const InternalRealType &a, const InternalRealType &b)
Computes the square root of each pixel.
void PrintSelf(std::ostream &os, Indent indent) const override
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.
void SetNormalizeAcrossScale(bool normalizeInScaleSpace)
void EnlargeOutputRequestedRegion(DataObject *output) override
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.