Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkVectorRescaleIntensityImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkVectorRescaleIntensityImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006/04/03 15:07:53 $
00007   Version:   $Revision: 1.4 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkVectorRescaleIntensityImageFilter_h
00018 #define __itkVectorRescaleIntensityImageFilter_h
00019 
00020 #include "itkUnaryFunctorImageFilter.h"
00021 
00022 namespace itk
00023 {
00024 
00025 // This functor class applies a scaling transformation A.x 
00026 // to input values.
00027 namespace Functor {  
00028  
00029 template< typename TInput, typename  TOutput>
00030 class VectorMagnitudeLinearTransform
00031 {
00032 public:
00033   typedef typename NumericTraits< typename TInput::ValueType >::RealType RealType;
00034   VectorMagnitudeLinearTransform() {}
00035   ~VectorMagnitudeLinearTransform() {}
00036   void SetFactor( RealType a ) { m_Factor = a; }
00037   itkStaticConstMacro(VectorDimension,unsigned int,TInput::Dimension);
00038   bool operator!=( const VectorMagnitudeLinearTransform & other ) const
00039   {
00040     if( m_Factor != other.m_Factor )
00041       {
00042       return true;
00043       }
00044     return false;
00045    }
00046   bool operator==( const VectorMagnitudeLinearTransform & other ) const
00047   {
00048     return !(*this != other);
00049   }
00050   inline TOutput operator()( const TInput & x )
00051   {
00052     TOutput  result;
00053     for(unsigned int i=0; i<VectorDimension; i++)
00054       {
00055       const RealType scaledComponent = static_cast<RealType>( x[i] ) * m_Factor;
00056       result[i]= static_cast< typename TOutput::ValueType >( scaledComponent );
00057       }
00058     return result;
00059   }
00060 private:
00061   RealType m_Factor;
00062 }; 
00063 
00064 }  // end namespace functor
00065 
00066 
00084 template <typename  TInputImage, typename  TOutputImage=TInputImage>
00085 class ITK_EXPORT VectorRescaleIntensityImageFilter :
00086     public
00087 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00088                         Functor::VectorMagnitudeLinearTransform< 
00089   typename TInputImage::PixelType, 
00090   typename TOutputImage::PixelType>   >
00091 {
00092 public:
00094   typedef VectorRescaleIntensityImageFilter  Self;
00095   typedef UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00096                                   Functor::VectorMagnitudeLinearTransform< 
00097     typename TInputImage::PixelType, 
00098     typename TOutputImage::PixelType> >  Superclass;
00099   typedef SmartPointer<Self>   Pointer;
00100   typedef SmartPointer<const Self>  ConstPointer;
00101 
00102   typedef typename TOutputImage::PixelType OutputPixelType;
00103   typedef typename TInputImage::PixelType  InputPixelType;
00104   typedef typename InputPixelType::ValueType      InputValueType;
00105   typedef typename OutputPixelType::ValueType     OutputValueType;
00106   typedef typename NumericTraits<InputValueType>::RealType InputRealType;
00107   typedef typename NumericTraits<OutputValueType>::RealType OutputRealType;
00108 
00110   itkNewMacro(Self);
00111 
00112   itkSetMacro( OutputMaximumMagnitude, OutputRealType );
00113   itkGetConstReferenceMacro( OutputMaximumMagnitude, OutputRealType );
00114 
00118   itkGetConstReferenceMacro( Scale, InputRealType );
00119   itkGetConstReferenceMacro( Shift, InputRealType );
00121 
00124   itkGetConstReferenceMacro( InputMaximumMagnitude, InputRealType );
00125 
00127   void BeforeThreadedGenerateData(void);
00128 
00130   void PrintSelf(std::ostream& os, Indent indent) const;
00131 
00132 #ifdef ITK_USE_CONCEPT_CHECKING
00133 
00134   itkConceptMacro(InputHasNumericTraitsCheck,
00135                   (Concept::HasNumericTraits<InputValueType>));
00136   itkConceptMacro(OutputHasNumericTraitsCheck,
00137                   (Concept::HasNumericTraits<OutputValueType>));
00138 
00140 #endif
00141 
00142 protected:
00143   VectorRescaleIntensityImageFilter();
00144   virtual ~VectorRescaleIntensityImageFilter() {};
00145 
00146 private:
00147   VectorRescaleIntensityImageFilter(const Self&); //purposely not implemented
00148   void operator=(const Self&); //purposely not implemented
00149 
00150   InputRealType m_Scale;
00151   InputRealType m_Shift;
00152 
00153   InputRealType        m_InputMaximumMagnitude;
00154   OutputRealType       m_OutputMaximumMagnitude;
00155 
00156 };
00157 
00158 
00159   
00160 } // end namespace itk
00161   
00162 #ifndef ITK_MANUAL_INSTANTIATION
00163 #include "itkVectorRescaleIntensityImageFilter.txx"
00164 #endif
00165   
00166 #endif
00167 

Generated at Sun Sep 23 14:37:56 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000