ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkCompose2DVectorImageFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkCompose2DVectorImageFilter_h
00019 #define __itkCompose2DVectorImageFilter_h
00020 
00021 #include "itkBinaryFunctorImageFilter.h"
00022 #include "itkVector.h"
00023 
00024 namespace itk
00025 {
00026 namespace Functor
00027 {
00028 template< class TInput >
00029 class Compose2DVector
00030 {
00031 public:
00032   typedef Vector< TInput, 2 > OutputType;
00033   Compose2DVector() {}
00034   ~Compose2DVector() {}
00035   bool operator!=(const Compose2DVector &) const
00036   {
00037     return false;
00038   }
00039 
00040   bool operator==(const Compose2DVector & other) const
00041   {
00042     return !( *this != other );
00043   }
00044 
00045   inline OutputType operator()(const TInput & s1,
00046                                const TInput & s2) const
00047   {
00048     OutputType v;
00049 
00050     v[0] = s1;
00051     v[1] = s2;
00052     return v;
00053   }
00054 };
00055 }
00056 
00069 template< typename TInputImage,
00070           typename TOutputImage =
00071             Image< Vector< typename TInputImage::PixelType, 2 >,
00072                    ::itk::GetImageDimension< TInputImage >::ImageDimension > >
00073 class ITK_EXPORT Compose2DVectorImageFilter:
00074   public
00075   BinaryFunctorImageFilter< TInputImage, TInputImage,
00076                             TOutputImage,
00077                             Functor::Compose2DVector< typename TInputImage::PixelType >   >
00078 {
00079 public:
00081   typedef Compose2DVectorImageFilter Self;
00082   typedef BinaryFunctorImageFilter<
00083     TInputImage, TInputImage,
00084     TOutputImage,
00085     Functor::Compose2DVector<
00086       typename TInputImage::PixelType > > Superclass;
00087 
00088   typedef SmartPointer< Self >       Pointer;
00089   typedef SmartPointer< const Self > ConstPointer;
00090 
00091   typedef typename Superclass::OutputImageType OutputImageType;
00092 
00094   itkNewMacro(Self);
00095 
00097   itkTypeMacro(Compose2DVectorImageFilter,
00098                BinaryFunctorImageFilter);
00099 
00100 #ifdef ITK_USE_CONCEPT_CHECKING
00101 
00102   itkConceptMacro( InputHasNumericTraitsCheck,
00103                    ( Concept::HasNumericTraits< typename TInputImage::PixelType > ) );
00104 
00106 #endif
00107 protected:
00108   Compose2DVectorImageFilter() {}
00109   virtual ~Compose2DVectorImageFilter() {}
00110 private:
00111   Compose2DVectorImageFilter(const Self &); //purposely not implemented
00112   void operator=(const Self &);             //purposely not implemented
00113 };
00114 } // end namespace itk
00116 
00117 #endif
00118