ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkTernaryFunctorImageFilter.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 __itkTernaryFunctorImageFilter_h
19 #define __itkTernaryFunctorImageFilter_h
20 
21 #include "itkInPlaceImageFilter.h"
23 
24 namespace itk
25 {
38 template< class TInputImage1, class TInputImage2,
39  class TInputImage3, class TOutputImage, class TFunction >
40 class ITK_EXPORT TernaryFunctorImageFilter:
41  public InPlaceImageFilter< TInputImage1, TOutputImage >
42 {
43 public:
49 
51  itkNewMacro(Self);
52 
55 
57  typedef TFunction FunctorType;
58  typedef TInputImage1 Input1ImageType;
59  typedef typename Input1ImageType::ConstPointer Input1ImagePointer;
60  typedef typename Input1ImageType::RegionType Input1ImageRegionType;
61  typedef typename Input1ImageType::PixelType Input1ImagePixelType;
62  typedef TInputImage2 Input2ImageType;
63  typedef typename Input2ImageType::ConstPointer Input2ImagePointer;
64  typedef typename Input2ImageType::RegionType Input2ImageRegionType;
65  typedef typename Input2ImageType::PixelType Input2ImagePixelType;
66  typedef TInputImage3 Input3ImageType;
67  typedef typename Input3ImageType::ConstPointer Input3ImagePointer;
68  typedef typename Input3ImageType::RegionType Input3ImageRegionType;
69  typedef typename Input3ImageType::PixelType Input3ImagePixelType;
70  typedef TOutputImage OutputImageType;
71  typedef typename OutputImageType::Pointer OutputImagePointer;
72  typedef typename OutputImageType::RegionType OutputImageRegionType;
73  typedef typename OutputImageType::PixelType OutputImagePixelType;
74 
76  void SetInput1(const TInputImage1 *image1);
77 
79  void SetInput2(const TInputImage2 *image2);
80 
82  void SetInput3(const TInputImage3 *image3);
83 
88  FunctorType & GetFunctor(void) { return m_Functor; }
89 
94  const FunctorType & GetFunctor() const
95  {
96  return m_Functor;
97  }
98 
105  void SetFunctor(const FunctorType & functor)
106  {
107  if ( !( functor == m_Functor ) )
108  {
109  m_Functor = functor;
110  this->Modified();
111  }
112  }
114 
116  itkStaticConstMacro(Input1ImageDimension, unsigned int,
117  TInputImage1::ImageDimension);
118  itkStaticConstMacro(Input2ImageDimension, unsigned int,
119  TInputImage2::ImageDimension);
120  itkStaticConstMacro(Input3ImageDimension, unsigned int,
121  TInputImage3::ImageDimension);
122  itkStaticConstMacro(OutputImageDimension, unsigned int,
123  TOutputImage::ImageDimension);
125 
126 #ifdef ITK_USE_CONCEPT_CHECKING
127 
128  itkConceptMacro( SameDimensionCheck1,
130  itkConceptMacro( SameDimensionCheck2,
132  itkConceptMacro( SameDimensionCheck3,
134 
136 #endif
137 
138 protected:
141 
144  void BeforeThreadedGenerateData();
145 
156  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
157  ThreadIdType threadId);
158 
159 private:
160  TernaryFunctorImageFilter(const Self &); //purposely not implemented
161  void operator=(const Self &); //purposely not implemented
162 
164 };
165 } // end namespace itk
166 
167 #ifndef ITK_MANUAL_INSTANTIATION
168 #include "itkTernaryFunctorImageFilter.hxx"
169 #endif
170 
171 #endif
172