ITK  4.12.0
Insight Segmentation and Registration Toolkit
itkTernaryOperatorImageFilter.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 itkTernaryOperatorImageFilter_h
19 #define itkTernaryOperatorImageFilter_h
20 
22 
23 namespace itk
24 {
25 namespace Functor
26 {
32 template< typename TInput1, typename TInput2, typename TInput3, typename TOutput >
34 {
35 public:
38  bool operator!=(const TernaryOperator &) const
39  {
40  return false;
41  }
43 
44  bool operator==(const TernaryOperator & other) const
45  {
46  return !( *this != other );
47  }
48 
49  inline TOutput operator()(const TInput1 & A,
50  const TInput2 & B,
51  const TInput3 & C) const
52  {
53  if (A)
54  {
55  return static_cast<TOutput>( B );
56  }
57  else
58  {
59  return static_cast<TOutput>( C );
60  }
61  }
62 };
63 }
102 template< typename TMask, typename TImage >
104  public
105  TernaryFunctorImageFilter< TMask, TImage, TImage, TImage,
106  Functor::TernaryOperator< typename TMask::PixelType,
107  typename TImage::PixelType,
108  typename TImage::PixelType,
109  typename TImage::PixelType > >
110 {
111 public:
115  TMask, TImage, TImage, TImage,
116  Functor::TernaryOperator< typename TMask::PixelType,
117  typename TImage::PixelType,
118  typename TImage::PixelType,
119  typename TImage::PixelType > > Superclass;
120 
123 
125  itkNewMacro(Self);
126 
128  itkTypeMacro(TernaryOperatorImageFilter,
130 
131 protected:
134 
135 private:
136  ITK_DISALLOW_COPY_AND_ASSIGN(TernaryOperatorImageFilter);
137 };
138 } // end namespace itk
139 
140 #endif
Light weight base class for most itk classes.
Implements pixel-wise generic operation of three images.
Return argument 2 if argument 1 is false, and argument 3 otherwise.
Return the value of input 2 if input 1 is false, and that of input 3 otherwise.
bool operator!=(const TernaryOperator &) const
bool operator==(const TernaryOperator &other) const
TernaryFunctorImageFilter< TMask, TImage, TImage, TImage, Functor::TernaryOperator< typename TMask::PixelType, typename TImage::PixelType, typename TImage::PixelType, typename TImage::PixelType > > Superclass
TOutput operator()(const TInput1 &A, const TInput2 &B, const TInput3 &C) const