ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkTernaryAddImageFilter.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 __itkTernaryAddImageFilter_h
00019 #define __itkTernaryAddImageFilter_h
00020 
00021 #include "itkTernaryFunctorImageFilter.h"
00022 
00023 namespace itk
00024 {
00025 namespace Functor
00026 {
00032 template< class TInput1, class TInput2, class TInput3, class TOutput >
00033 class Add3
00034 {
00035 public:
00036   Add3() {}
00037   ~Add3() {}
00038   bool operator!=(const Add3 &) const
00039   {
00040     return false;
00041   }
00043 
00044   bool operator==(const Add3 & other) const
00045   {
00046     return !( *this != other );
00047   }
00048 
00049   inline TOutput operator()(const TInput1 & A,
00050                             const TInput2 & B,
00051                             const TInput3 & C) const
00052   { return (TOutput)( A + B + C ); }
00053 };
00054 }
00065 template< class TInputImage1, class TInputImage2,
00066           class TInputImage3, class TOutputImage >
00067 class ITK_EXPORT TernaryAddImageFilter:
00068   public
00069   TernaryFunctorImageFilter< TInputImage1, TInputImage2,
00070                              TInputImage3, TOutputImage,
00071                              Functor::Add3< typename TInputImage1::PixelType,
00072                                             typename TInputImage2::PixelType,
00073                                             typename TInputImage3::PixelType,
00074                                             typename TOutputImage::PixelType >   >
00075 {
00076 public:
00078   typedef TernaryAddImageFilter Self;
00079   typedef TernaryFunctorImageFilter<
00080     TInputImage1, TInputImage2,
00081     TInputImage3, TOutputImage,
00082     Functor::Add3< typename TInputImage1::PixelType,
00083                    typename TInputImage2::PixelType,
00084                    typename TInputImage3::PixelType,
00085                    typename TOutputImage::PixelType >   >  Superclass;
00086 
00087   typedef SmartPointer< Self >       Pointer;
00088   typedef SmartPointer< const Self > ConstPointer;
00089 
00091   itkNewMacro(Self);
00092 
00094   itkTypeMacro(TernaryAddImageFilter,
00095                TernaryFunctorImageFilter);
00096 protected:
00097   TernaryAddImageFilter() {}
00098   virtual ~TernaryAddImageFilter() {}
00099 private:
00100   TernaryAddImageFilter(const Self &); //purposely not implemented
00101   void operator=(const Self &);        //purposely not implemented
00102 };
00103 } // end namespace itk
00105 
00106 #endif
00107