ITK  4.13.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< typename TInput, typename 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< typename TInputImage, typename 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  // Begin concept checking
98  itkConceptMacro( InputConvertibleToDoubleCheck,
100  itkConceptMacro( DoubleConvertibleToOutputCheck,
102  // End concept checking
103 #endif
104 
105 protected:
107  virtual ~BoundedReciprocalImageFilter() ITK_OVERRIDE {}
108 
109 private:
110  ITK_DISALLOW_COPY_AND_ASSIGN(BoundedReciprocalImageFilter);
111 };
112 } // end namespace itk
113 
114 #endif
bool operator!=(const BoundedReciprocal &) const
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::BoundedReciprocal< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
Base class for all process objects that output image data.
Computes 1/(1+x) for each pixel in the image.
bool operator==(const BoundedReciprocal &other) const
Implements pixel-wise generic operation on one image.
TOutput operator()(const TInput &A) const
#define itkConceptMacro(name, concept)