ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkCompose3DCovariantVectorImageFilter.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 __itkCompose3DCovariantVectorImageFilter_h
00019 #define __itkCompose3DCovariantVectorImageFilter_h
00020 
00021 #include "itkTernaryFunctorImageFilter.h"
00022 #include "itkCovariantVector.h"
00023 
00024 namespace itk
00025 {
00026 namespace Functor
00027 {
00028 template< class TInput >
00029 class Compose3DCovariantVector
00030 {
00031 public:
00032   typedef CovariantVector< TInput, 3 > OutputType;
00033   Compose3DCovariantVector() {}
00034   ~Compose3DCovariantVector() {}
00035   bool operator!=(const Compose3DCovariantVector &) const
00036   {
00037     return false;
00038   }
00039 
00040   bool operator==(const Compose3DCovariantVector & other) const
00041   {
00042     return !( *this != other );
00043   }
00044 
00045   inline OutputType operator()(const TInput & s1,
00046                                const TInput & s2,
00047                                const TInput & s3) const
00048   {
00049     OutputType v;
00050 
00051     v[0] = s1;
00052     v[1] = s2;
00053     v[2] = s3;
00054     return v;
00055   }
00056 };
00057 }
00058 
00076 template< typename TInputImage,
00077           typename TOutputImage =
00078             Image< CovariantVector< typename TInputImage::PixelType, 3 >,
00079                    ::itk::GetImageDimension< TInputImage >::ImageDimension > >
00080 class ITK_EXPORT Compose3DCovariantVectorImageFilter:
00081   public
00082   TernaryFunctorImageFilter< TInputImage, TInputImage,
00083                              TInputImage, TOutputImage,
00084                              Functor::Compose3DCovariantVector< typename TInputImage::PixelType >   >
00085 {
00086 public:
00088   typedef Compose3DCovariantVectorImageFilter Self;
00089   typedef TernaryFunctorImageFilter<
00090     TInputImage, TInputImage, TInputImage,
00091     TOutputImage,
00092     Functor::Compose3DCovariantVector<
00093       typename TInputImage::PixelType > > Superclass;
00094 
00095   typedef SmartPointer< Self >       Pointer;
00096   typedef SmartPointer< const Self > ConstPointer;
00097 
00098   typedef typename Superclass::OutputImageType OutputImageType;
00099 
00101   itkNewMacro(Self);
00102 
00104   itkTypeMacro(Compose3DCovariantVectorImageFilter,
00105                TernaryFunctorImageFilter);
00106 
00107 #ifdef ITK_USE_CONCEPT_CHECKING
00108 
00109   itkConceptMacro( InputHasNumericTraitsCheck,
00110                    ( Concept::HasNumericTraits< typename TInputImage::PixelType > ) );
00111 
00113 #endif
00114 protected:
00115   Compose3DCovariantVectorImageFilter() {}
00116   virtual ~Compose3DCovariantVectorImageFilter() {}
00117 private:
00118   Compose3DCovariantVectorImageFilter(const Self &); //purposely not implemented
00119   void operator=(const Self &);                      //purposely not implemented
00120 };
00121 } // end namespace itk
00123 
00124 #endif
00125