ITK  4.4.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);
137 
138 #ifdef ITK_USE_CONCEPT_CHECKING
139 
140  itkConceptMacro( InputHasNumericTraitsCheck,
142 
144 #endif
145 
146 protected:
149  void PrintSelf(std::ostream & os, Indent indent) const;
150 
152  void GenerateData(void);
153 
160  virtual void GenerateInputRequestedRegion()
162 
166  void EnlargeOutputRequestedRegion(DataObject *output);
167 
168 private:
169  GradientMagnitudeRecursiveGaussianImageFilter(const Self &); //purposely not
170  // implemented
171  void operator=(const Self &); //purposely not
172 
173  // implemented
174 
176  {
177 public:
178  SqrSpacing():m_Spacing(0) {}
180  bool operator!=(const SqrSpacing & other) const
181  {
182  return !( *this == other );
183  }
184 
185  bool operator==(const SqrSpacing & other) const
186  {
187  return other.m_Spacing == m_Spacing;
188  }
189 
190  inline InternalRealType operator()(const InternalRealType & a, const InternalRealType & b)
191  {
192  return a + vnl_math_sqr(b / m_Spacing);
193  }
194 
195  double m_Spacing;
196  };
197 
200 
201  GaussianFilterPointer m_SmoothingFilters[ImageDimension - 1];
205 
208 };
209 } // end namespace itk
210 
211 #ifndef ITK_MANUAL_INSTANTIATION
212 #include "itkGradientMagnitudeRecursiveGaussianImageFilter.hxx"
213 #endif
214 
215 #endif
216