ITK  4.8.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 
24 namespace itk
25 {
26 namespace Functor
27 {
33 template< typename TInput, typename TMask, typename TOutput = TInput >
35 {
36 public:
38 
40  : m_OutsideValue(NumericTraits< TOutput >::ZeroValue())
41  , m_MaskingValue(NumericTraits< TMask >::ZeroValue())
42  {
43  }
45  bool operator!=(const MaskNegatedInput &) const
46  {
47  return false;
48  }
49 
50  bool operator==(const MaskNegatedInput & other) const
51  {
52  return !( *this != other );
53  }
54 
55  inline TOutput operator()(const TInput & A, const TMask & B) const
56  {
57  if ( B != m_MaskingValue )
58  {
59  return m_OutsideValue;
60  }
61  else
62  {
63  return static_cast< TOutput >( A );
64  }
65  }
66 
68  void SetOutsideValue(const TOutput & outsideValue)
69  {
70  m_OutsideValue = outsideValue;
71  }
72 
74  const TOutput & GetOutsideValue() const
75  {
76  return m_OutsideValue;
77  }
78 
80  void SetMaskingValue(const TMask & maskingValue)
81  {
82  m_MaskingValue = maskingValue;
83  }
84 
86  const TMask & GetMaskingValue() const
87  {
88  return m_MaskingValue;
89  }
90 private:
91  TOutput m_OutsideValue;
93 };
94 }
95 
98 
139 
148 
152 
164 
167 
171 
174 
183 
190 
199 
201 
210 
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