ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkCompose2DVectorImageFilter.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 itkCompose2DVectorImageFilter_h
19 #define itkCompose2DVectorImageFilter_h
20 #if !defined( ITK_LEGACY_REMOVE )
21 
23 #include "itkVector.h"
24 
25 namespace itk
26 {
27 namespace Functor
28 {
29 template< typename TInput >
30 class Compose2DVector
31 {
32 public:
33  typedef Vector< TInput, 2 > OutputType;
34  Compose2DVector() {}
35  ~Compose2DVector() {}
36  bool operator!=(const Compose2DVector &) const
37  {
38  return false;
39  }
40 
41  bool operator==(const Compose2DVector & other) const
42  {
43  return !( *this != other );
44  }
45 
46  inline OutputType operator()(const TInput & s1,
47  const TInput & s2) const
48  {
49  OutputType v;
50 
51  v[0] = s1;
52  v[1] = s2;
53  return v;
54  }
55 };
56 }
57 
70 template< typename TInputImage,
71  typename TOutputImage =
72  Image< Vector< typename TInputImage::PixelType, 2 >,
73  TInputImage::ImageDimension > >
74 class Compose2DVectorImageFilter:
75  public
76  BinaryFunctorImageFilter< TInputImage, TInputImage,
77  TOutputImage,
78  Functor::Compose2DVector< typename TInputImage::PixelType > >
79 {
80 public:
82  typedef Compose2DVectorImageFilter Self;
83  typedef BinaryFunctorImageFilter<
84  TInputImage, TInputImage,
85  TOutputImage,
86  Functor::Compose2DVector<
87  typename TInputImage::PixelType > > Superclass;
88 
89  typedef SmartPointer< Self > Pointer;
90  typedef SmartPointer< const Self > ConstPointer;
91 
92  typedef typename Superclass::OutputImageType OutputImageType;
93 
95  itkNewMacro(Self);
96 
98  itkTypeMacro(Compose2DVectorImageFilter,
99  BinaryFunctorImageFilter);
100 
101 #ifdef ITK_USE_CONCEPT_CHECKING
102  // Begin concept checking
103  itkConceptMacro( InputHasNumericTraitsCheck,
104  ( Concept::HasNumericTraits< typename TInputImage::PixelType > ) );
105  // End concept checking
106 #endif
107 
108 protected:
109  Compose2DVectorImageFilter() {}
110  virtual ~Compose2DVectorImageFilter() {}
111 
112 private:
113  ITK_DISALLOW_COPY_AND_ASSIGN(Compose2DVectorImageFilter);
114 };
115 } // end namespace itk
116 
117 #endif //#if !defined( ITK_LEGACY_REMOVE )
118 #endif
bool operator!=(const ImageRegionCopier< D1, D2 > &c1, const ImageRegionCopier< D1, D2 > &c2)
#define itkConceptMacro(name, concept)
bool ITKIOXML_EXPORT operator==(itk::FancyString &s, const std::string &)