ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkBoundedReciprocalImageFilter.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 /*=========================================================================
19  *
20  * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21  *
22  * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23  *
24  * For complete copyright, license and disclaimer of warranty information
25  * please refer to the NOTICE file at the top of the ITK source tree.
26  *
27  *=========================================================================*/
28 #ifndef __itkBoundedReciprocalImageFilter_h
29 #define __itkBoundedReciprocalImageFilter_h
30 
32 
33 namespace itk
34 {
44 namespace Functor
45 {
46 template< class TInput, class TOutput >
48 {
49 public:
52  bool operator!=(const BoundedReciprocal &) const
53  {
54  return false;
55  }
56 
57  bool operator==(const BoundedReciprocal & other) const
58  {
59  return !( *this != other );
60  }
61 
62  inline TOutput operator()(const TInput & A) const
63  {
64  return static_cast< TOutput >( 1.0 / ( 1.0 + static_cast< double >( A ) ) );
65  }
66 };
67 }
68 
69 template< class TInputImage, class TOutputImage >
71  public
72  UnaryFunctorImageFilter< TInputImage, TOutputImage,
73  Functor::BoundedReciprocal<
74  typename TInputImage::PixelType,
75  typename TOutputImage::PixelType > >
76 {
77 public:
80  typedef UnaryFunctorImageFilter< TInputImage, TOutputImage,
82  typename TInputImage::PixelType,
83  typename TOutputImage::PixelType >
85 
88 
90  itkNewMacro(Self);
91 
93  itkTypeMacro(BoundedReciprocalImageFilter,
95 
96 #ifdef ITK_USE_CONCEPT_CHECKING
97 
98  itkConceptMacro( InputConvertibleToDoubleCheck,
100  itkConceptMacro( DoubleConvertibleToOutputCheck,
102 
104 #endif
105 
106 protected:
109 
110 private:
111  BoundedReciprocalImageFilter(const Self &); //purposely not implemented
112  void operator=(const Self &); //purposely not implemented
113 };
114 } // end namespace itk
115 
116 #endif
117