ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkComplexToImaginaryImageFilter.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 __itkComplexToImaginaryImageFilter_h
00019 #define __itkComplexToImaginaryImageFilter_h
00020 
00021 #include "itkUnaryFunctorImageFilter.h"
00022 #include "vnl/vnl_math.h"
00023 
00024 namespace itk
00025 {
00032 namespace Functor
00033 {
00034 template< class TInput, class TOutput >
00035 class ComplexToImaginary
00036 {
00037 public:
00038   ComplexToImaginary() {}
00039   ~ComplexToImaginary() {}
00040   bool operator!=(const ComplexToImaginary &) const
00041   {
00042     return false;
00043   }
00044 
00045   bool operator==(const ComplexToImaginary & other) const
00046   {
00047     return !( *this != other );
00048   }
00049 
00050   inline TOutput operator()(const TInput & A) const
00051   {
00052     return (TOutput)( A.imag() );
00053   }
00054 };
00055 }
00056 
00057 template< class TInputImage, class TOutputImage >
00058 class ITK_EXPORT ComplexToImaginaryImageFilter:
00059   public
00060   UnaryFunctorImageFilter< TInputImage, TOutputImage,
00061                            Functor::ComplexToImaginary<
00062                              typename TInputImage::PixelType,
00063                              typename TOutputImage::PixelType >   >
00064 {
00065 public:
00067   typedef ComplexToImaginaryImageFilter Self;
00068   typedef UnaryFunctorImageFilter<
00069     TInputImage, TOutputImage,
00070     Functor::ComplexToImaginary< typename TInputImage::PixelType,
00071                                  typename TOutputImage::PixelType > > Superclass;
00072 
00073   typedef SmartPointer< Self >       Pointer;
00074   typedef SmartPointer< const Self > ConstPointer;
00075 
00077   itkNewMacro(Self);
00078 
00080   itkTypeMacro(ComplexToImaginaryImageFilter,
00081                UnaryFunctorImageFilter);
00082 
00083   typedef typename TInputImage::PixelType                     InputPixelType;
00084   typedef typename TOutputImage::PixelType                    OutputPixelType;
00085   typedef typename NumericTraits< InputPixelType >::ValueType InputPixelValueType;
00086 
00087 #ifdef ITK_USE_CONCEPT_CHECKING
00088 
00089   itkConceptMacro( InputConvertibleToOutputCheck,
00090                    ( Concept::Convertible< InputPixelValueType, OutputPixelType > ) );
00091 
00093 #endif
00094 protected:
00095   ComplexToImaginaryImageFilter() {}
00096   virtual ~ComplexToImaginaryImageFilter() {}
00097 private:
00098   ComplexToImaginaryImageFilter(const Self &); //purposely not implemented
00099   void operator=(const Self &);                //purposely not implemented
00100 };
00101 } // end namespace itk
00103 
00104 #endif
00105