ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkMaskNegatedImageFilter.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 itkMaskNegatedImageFilter_h
19 #define itkMaskNegatedImageFilter_h
20 
22 #include "itkNumericTraits.h"
23 #include "itkMath.h"
24 
25 namespace itk
26 {
27 namespace Functor
28 {
34 template< typename TInput, typename TMask, typename TOutput = TInput >
36 {
37 public:
39 
41  : m_OutsideValue(NumericTraits< TOutput >::ZeroValue())
42  , m_MaskingValue(NumericTraits< TMask >::ZeroValue())
43  {
44  }
46  bool operator!=(const MaskNegatedInput &) const
47  {
48  return false;
49  }
50 
51  bool operator==(const MaskNegatedInput & other) const
52  {
53  return !( *this != other );
54  }
55 
56  inline TOutput operator()(const TInput & A, const TMask & B) const
57  {
58  if ( B != m_MaskingValue )
59  {
60  return m_OutsideValue;
61  }
62  else
63  {
64  return static_cast< TOutput >( A );
65  }
66  }
67 
69  void SetOutsideValue(const TOutput & outsideValue)
70  {
71  m_OutsideValue = outsideValue;
72  }
73 
75  const TOutput & GetOutsideValue() const
76  {
77  return m_OutsideValue;
78  }
79 
81  void SetMaskingValue(const TMask & maskingValue)
82  {
83  m_MaskingValue = maskingValue;
84  }
85 
87  const TMask & GetMaskingValue() const
88  {
89  return m_MaskingValue;
90  }
91 private:
92  TOutput m_OutsideValue;
94 };
95 }
96 
99 
140 
149 
153 
165 
168 
172 
175 
184 
191 
200 
202 
211 
void SetOutsideValue(const TOutput &outsideValue)
void SetMaskingValue(const TMask &maskingValue)
const TOutput & GetOutsideValue() const
bool operator==(const MaskNegatedInput &other) const
TOutput operator()(const TInput &A, const TMask &B) const
bool operator!=(const MaskNegatedInput &) const
Define additional traits for native types such as int or float.
NumericTraits< TInput >::AccumulateType AccumulatorType