00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkVectorRescaleIntensityImageFilter_h
00018 #define __itkVectorRescaleIntensityImageFilter_h
00019
00020 #include "itkUnaryFunctorImageFilter.h"
00021
00022 namespace itk
00023 {
00024
00025
00026
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 }
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&);
00125 void operator=(const Self&);
00126
00127 InputRealType m_Scale;
00128 InputRealType m_Shift;
00129
00130 InputRealType m_InputMaximumMagnitude;
00131 OutputRealType m_OutputMaximumMagnitude;
00132
00133 };
00134
00135
00136
00137 }
00138
00139 #ifndef ITK_MANUAL_INSTANTIATION
00140 #include "itkVectorRescaleIntensityImageFilter.txx"
00141 #endif
00142
00143 #endif