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: 2004/11/04 20:40:40 $
00007   Version:   $Revision: 1.2 $
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   inline TOutput operator()( const TInput & x )
00039   {
00040     TOutput  result;
00041     for(unsigned int i=0; i<VectorDimension; i++)
00042       {
00043       const RealType scaledComponent = static_cast<RealType>( x[i] ) * m_Factor;
00044       result[i]= static_cast< typename TOutput::ValueType >( scaledComponent );
00045       }
00046     return result;
00047   }
00048 private:
00049   RealType m_Factor;
00050 }; 
00051 
00052 }  // end namespace functor
00053 
00054 
00072 template <typename  TInputImage, typename  TOutputImage=TInputImage>
00073 class ITK_EXPORT VectorRescaleIntensityImageFilter :
00074     public
00075 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00076                         Functor::VectorMagnitudeLinearTransform< 
00077   typename TInputImage::PixelType, 
00078   typename TOutputImage::PixelType>   >
00079 {
00080 public:
00082   typedef VectorRescaleIntensityImageFilter  Self;
00083   typedef UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00084                                   Functor::VectorMagnitudeLinearTransform< 
00085     typename TInputImage::PixelType, 
00086     typename TOutputImage::PixelType> >  Superclass;
00087   typedef SmartPointer<Self>   Pointer;
00088   typedef SmartPointer<const Self>  ConstPointer;
00089 
00090   typedef typename TOutputImage::PixelType OutputPixelType;
00091   typedef typename TInputImage::PixelType  InputPixelType;
00092   typedef typename InputPixelType::ValueType      InputValueType;
00093   typedef typename OutputPixelType::ValueType     OutputValueType;
00094   typedef typename NumericTraits<InputValueType>::RealType InputRealType;
00095   typedef typename NumericTraits<OutputValueType>::RealType OutputRealType;
00096 
00098   itkNewMacro(Self);
00099   
00100   itkSetMacro( OutputMaximumMagnitude, OutputRealType );
00101   itkGetConstReferenceMacro( OutputMaximumMagnitude, OutputRealType );
00102 
00106   itkGetConstReferenceMacro( Scale, InputRealType );
00107   itkGetConstReferenceMacro( Shift, InputRealType );
00108 
00111   itkGetConstReferenceMacro( InputMaximumMagnitude, InputRealType );
00112 
00114   void BeforeThreadedGenerateData(void);
00115 
00117   void PrintSelf(std::ostream& os, Indent indent) const;
00118 
00119 protected:
00120   VectorRescaleIntensityImageFilter();
00121   virtual ~VectorRescaleIntensityImageFilter() {};
00122 
00123 private:
00124   VectorRescaleIntensityImageFilter(const Self&); //purposely not implemented
00125   void operator=(const Self&); //purposely not implemented
00126 
00127   InputRealType m_Scale;
00128   InputRealType m_Shift;
00129 
00130   InputRealType        m_InputMaximumMagnitude;
00131   OutputRealType       m_OutputMaximumMagnitude;
00132 
00133 };
00134 
00135 
00136   
00137 } // end namespace itk
00138   
00139 #ifndef ITK_MANUAL_INSTANTIATION
00140 #include "itkVectorRescaleIntensityImageFilter.txx"
00141 #endif
00142   
00143 #endif

Generated at Thu May 25 00:14:39 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000