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