ITK  5.0.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:
50  BoundedReciprocal() = default;
51  ~BoundedReciprocal() = default;
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  UnaryGeneratorImageFilter< TInputImage, TOutputImage >
73 {
74 public:
75  ITK_DISALLOW_COPY_AND_ASSIGN(BoundedReciprocalImageFilter);
76 
82  using FunctorType = Functor::BoundedReciprocal< typename TInputImage::PixelType,
83  typename TOutputImage::PixelType >;
84 
86  itkNewMacro(Self);
87 
89  itkTypeMacro(BoundedReciprocalImageFilter,
91 
92 #ifdef ITK_USE_CONCEPT_CHECKING
93  // Begin concept checking
94  itkConceptMacro( InputConvertibleToDoubleCheck,
96  itkConceptMacro( DoubleConvertibleToOutputCheck,
98  // End concept checking
99 #endif
100 
101 protected:
103  {
104 #if !defined( ITK_WRAPPING_PARSER )
106 #endif
107  }
108 
109  ~BoundedReciprocalImageFilter() override = default;
110 };
111 } // end namespace itk
112 
113 #endif
bool operator!=(const BoundedReciprocal &) const
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
void SetFunctor(const std::function< ConstRefFunctionType > &f)
~BoundedReciprocalImageFilter() override=default
Computes 1/(1+x) for each pixel in the image.
bool operator==(const BoundedReciprocal &other) const
Functor::BoundedReciprocal< typename TInputImage::PixelType, typename TOutputImage::PixelType > FunctorType
TOutput operator()(const TInput &A) const
#define itkConceptMacro(name, concept)
Implements pixel-wise generic &quot;operation&quot; on one image.