ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkCompose3DVectorImageFilter.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 __itkCompose3DVectorImageFilter_h
19 #define __itkCompose3DVectorImageFilter_h
20 #if !defined( ITK_LEGACY_REMOVE )
21 
23 #include "itkVector.h"
24 
25 namespace itk
26 {
27 namespace Functor
28 {
29 template< class TInput >
30 class Compose3DVector
31 {
32 public:
33  typedef Vector< TInput, 3 > OutputType;
34  Compose3DVector() {}
35  ~Compose3DVector() {}
36  bool operator!=(const Compose3DVector &) const
37  {
38  return false;
39  }
40 
41  bool operator==(const Compose3DVector & other) const
42  {
43  return !( *this != other );
44  }
45 
46  inline OutputType operator()(const TInput & s1,
47  const TInput & s2,
48  const TInput & s3) const
49  {
50  OutputType v;
51 
52  v[0] = s1;
53  v[1] = s2;
54  v[2] = s3;
55  return v;
56  }
57 };
58 }
59 
73 template< typename TInputImage,
74  typename TOutputImage =
75  Image< Vector< typename TInputImage::PixelType, 3 >,
76  TInputImage::ImageDimension > >
77 class ITK_EXPORT Compose3DVectorImageFilter:
78  public
79  TernaryFunctorImageFilter< TInputImage, TInputImage,
80  TInputImage, TOutputImage,
81  Functor::Compose3DVector< typename TInputImage::PixelType > >
82 {
83 public:
85  typedef Compose3DVectorImageFilter Self;
86  typedef TernaryFunctorImageFilter<
87  TInputImage, TInputImage, TInputImage,
88  TOutputImage,
89  Functor::Compose3DVector<
90  typename TInputImage::PixelType > > Superclass;
91 
92  typedef SmartPointer< Self > Pointer;
93  typedef SmartPointer< const Self > ConstPointer;
94 
95  typedef typename Superclass::OutputImageType OutputImageType;
96 
98  itkNewMacro(Self);
99 
101  itkTypeMacro(Compose3DVectorImageFilter,
102  TernaryFunctorImageFilter);
103 
104 #ifdef ITK_USE_CONCEPT_CHECKING
105 
106  itkConceptMacro( InputHasNumericTraitsCheck,
107  ( Concept::HasNumericTraits< typename TInputImage::PixelType > ) );
108 
110 #endif
111 
112 protected:
113  Compose3DVectorImageFilter() {}
114  virtual ~Compose3DVectorImageFilter() {}
115 
116 private:
117  Compose3DVectorImageFilter(const Self &); //purposely not implemented
118  void operator=(const Self &); //purposely not implemented
119 };
120 } // end namespace itk
121 
122 #endif //#if !defined( ITK_LEGACY_REMOVE )
123 #endif
124