ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkGreaterEqualValImageFilter.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 itkGreaterEqualValImageFilter_h
19 #define itkGreaterEqualValImageFilter_h
21 namespace itk
22 {
31 namespace Functor
32 {
33 template< class TInput, class TOutput >
34 class GEConst
35 {
36 public:
37  GEConst() { m_Val = (TInput)0.0; }
38  void SetVal(const TInput i) { m_Val = i; }
39 
40  ~GEConst() {}
41  bool operator!=(const GEConst &) const
42  {
43  return false;
44  }
45 
46  bool operator==(const GEConst & other) const
47  {
48  return !( *this != other );
49  }
50 
51  inline TOutput operator()(const TInput & A)
52  {
53  return static_cast< TOutput >( A >= m_Val );
54  }
55 
56 private:
57  TInput m_Val;
58 };
59 }
60 
61 template< class TInputImage, class TOutputImage >
62 class ITK_EXPORT GreaterEqualValImageFilter:
63  public
64  UnaryFunctorImageFilter< TInputImage, TOutputImage,
65  Functor::GEConst<
66  typename TInputImage::PixelType,
67  typename TOutputImage::PixelType > >
68 {
69 public:
73  typedef UnaryFunctorImageFilter< TInputImage, TOutputImage,
74  Functor::GEConst< typename TInputImage::PixelType,
75  typename TOutputImage::PixelType > > Superclass;
76  typedef SmartPointer< Self >
80 
82  itkNewMacro(Self);
83 
84  void SetVal(typename TInputImage::PixelType val)
85  {
86  this->GetFunctor().SetVal(val);
87  this->Modified();
88  }
89 
90 #ifdef ITK_USE_CONCEPT_CHECKING
91 
92  itkConceptMacro( InputConvertibleToDoubleCheck,
94  itkConceptMacro( DoubleConvertibleToOutputCheck,
96 
98 #endif
99 protected:
102 private:
103  GreaterEqualValImageFilter(const Self &); //purposely not implemented
104  void operator=(const Self &); //purposely not implemented
105 };
106 } // end namespace itk
108 
109 #endif
Base class for all process objects that output image data.
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::GEConst< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
Computes the absolute difference between an image and a constant. Can be done with ShiftScale and Abs...
TOutput operator()(const TInput &A)
Implements pixel-wise generic operation on one image.
void SetVal(typename TInputImage::PixelType val)
bool operator!=(const GEConst &) const
#define itkConceptMacro(name, concept)
bool operator==(const GEConst &other) const