ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkCompose2DCovariantVectorImageFilter.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 __itkCompose2DCovariantVectorImageFilter_h
00019 #define __itkCompose2DCovariantVectorImageFilter_h
00020 
00021 #include "itkBinaryFunctorImageFilter.h"
00022 #include "itkCovariantVector.h"
00023 
00024 namespace itk
00025 {
00026 namespace Functor
00027 {
00028 template< class TInput >
00029 class Compose2DCovariantVector
00030 {
00031 public:
00032   typedef CovariantVector< TInput, 2 > OutputType;
00033   Compose2DCovariantVector() {}
00034   ~Compose2DCovariantVector() {}
00035   bool operator!=(const Compose2DCovariantVector &) const
00036   {
00037     return false;
00038   }
00039 
00040   bool operator==(const Compose2DCovariantVector & 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< CovariantVector< typename TInputImage::PixelType, 2 >,
00072                    ::itk::GetImageDimension< TInputImage >::ImageDimension > >
00073 class ITK_EXPORT Compose2DCovariantVectorImageFilter:
00074   public
00075   BinaryFunctorImageFilter< TInputImage, TInputImage,
00076                             TOutputImage,
00077                             Functor::Compose2DCovariantVector< typename TInputImage::PixelType >   >
00078 {
00079 public:
00081   typedef Compose2DCovariantVectorImageFilter Self;
00082   typedef BinaryFunctorImageFilter<
00083     TInputImage, TInputImage,
00084     TOutputImage,
00085     Functor::Compose2DCovariantVector< typename TInputImage::PixelType > > Superclass;
00086 
00087   typedef SmartPointer< Self >       Pointer;
00088   typedef SmartPointer< const Self > ConstPointer;
00089 
00090   typedef typename Superclass::OutputImageType OutputImageType;
00091 
00093   itkNewMacro(Self);
00094 
00096   itkTypeMacro(Compose2DCovariantVectorImageFilter,
00097                BinaryFunctorImageFilter);
00098 
00099 #ifdef ITK_USE_CONCEPT_CHECKING
00100 
00101   itkConceptMacro( InputHasNumericTraitsCheck,
00102                    ( Concept::HasNumericTraits< typename TInputImage::PixelType > ) );
00103 
00105 #endif
00106 protected:
00107   Compose2DCovariantVectorImageFilter() {}
00108   virtual ~Compose2DCovariantVectorImageFilter() {}
00109 private:
00110   Compose2DCovariantVectorImageFilter(const Self &); //purposely not implemented
00111   void operator=(const Self &);                      //purposely not implemented
00112 };
00113 } // end namespace itk
00115 
00116 #endif
00117