ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkGradientMagnitudeImageFilter.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 itkGradientMagnitudeImageFilter_h
19 #define itkGradientMagnitudeImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 
23 namespace itk
24 {
40 template< typename TInputImage, typename TOutputImage >
41 class ITK_TEMPLATE_EXPORT GradientMagnitudeImageFilter:
42  public ImageToImageFilter< TInputImage, TOutputImage >
43 {
44 public:
50 
52  itkNewMacro(Self);
53 
56 
59  typedef typename TOutputImage::PixelType OutputPixelType;
60  typedef typename TInputImage::PixelType InputPixelType;
62 
65  itkStaticConstMacro(ImageDimension, unsigned int,
66  TOutputImage::ImageDimension);
67 
69  typedef TInputImage InputImageType;
70  typedef TOutputImage OutputImageType;
71  typedef typename InputImageType::Pointer InputImagePointer;
72  typedef typename OutputImageType::Pointer OutputImagePointer;
73 
75  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
76 
85  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
86 
89  void SetUseImageSpacingOn()
90  { this->SetUseImageSpacing(true); }
91 
95  { this->SetUseImageSpacing(false); }
96 
99  itkSetMacro(UseImageSpacing, bool);
100  itkGetConstMacro(UseImageSpacing, bool);
102 
103 #ifdef ITK_USE_CONCEPT_CHECKING
104  // Begin concept checking
105  itkConceptMacro( InputHasNumericTraitsCheck,
107  // End concept checking
108 #endif
109 
110 protected:
112  {
113  m_UseImageSpacing = true;
114  }
115 
116  virtual ~GradientMagnitudeImageFilter() ITK_OVERRIDE {}
117 
129  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
130  ThreadIdType threadId) ITK_OVERRIDE;
131 
132  void PrintSelf(std::ostream &, Indent) const ITK_OVERRIDE;
133 
134 private:
135  ITK_DISALLOW_COPY_AND_ASSIGN(GradientMagnitudeImageFilter);
136 
137  bool m_UseImageSpacing;
138 };
139 } // end namespace itk
140 
141 #ifndef ITK_MANUAL_INSTANTIATION
142 #include "itkGradientMagnitudeImageFilter.hxx"
143 #endif
144 
145 #endif
NumericTraits< InputPixelType >::RealType RealType
Base class for all process objects that output image data.
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Computes the gradient magnitude of an image region at each pixel.
Superclass::OutputImageRegionType OutputImageRegionType
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Define additional traits for native types such as int or float.
#define itkConceptMacro(name, concept)