Go to the documentation of this file.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 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 ) const
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 }
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<
00096 TInputImage,TOutputImage,
00097 Functor::VectorMagnitudeLinearTransform<
00098 typename TInputImage::PixelType,
00099 typename TOutputImage::PixelType> > Superclass;
00100 typedef SmartPointer<Self> Pointer;
00101 typedef SmartPointer<const Self> ConstPointer;
00102
00103 typedef typename TOutputImage::PixelType OutputPixelType;
00104 typedef typename TInputImage::PixelType InputPixelType;
00105 typedef typename InputPixelType::ValueType InputValueType;
00106 typedef typename OutputPixelType::ValueType OutputValueType;
00107 typedef typename NumericTraits<InputValueType>::RealType InputRealType;
00108 typedef typename NumericTraits<OutputValueType>::RealType OutputRealType;
00109
00110 typedef typename Superclass::InputImageType InputImageType;
00111 typedef typename Superclass::InputImagePointer InputImagePointer;
00112
00114 itkTypeMacro( VectorRescaleIntensityImageFilter, UnaryFunctorImageFilter );
00115
00117 itkNewMacro(Self);
00118
00119 itkSetMacro( OutputMaximumMagnitude, OutputRealType );
00120 itkGetConstReferenceMacro( OutputMaximumMagnitude, OutputRealType );
00121
00125 itkGetConstReferenceMacro( Scale, InputRealType );
00126 itkGetConstReferenceMacro( Shift, InputRealType );
00128
00131 itkGetConstReferenceMacro( InputMaximumMagnitude, InputRealType );
00132
00134 void BeforeThreadedGenerateData(void);
00135
00137 void PrintSelf(std::ostream& os, Indent indent) const;
00138
00139 #ifdef ITK_USE_CONCEPT_CHECKING
00140
00141 itkConceptMacro(InputHasNumericTraitsCheck,
00142 (Concept::HasNumericTraits<InputValueType>));
00143 itkConceptMacro(OutputHasNumericTraitsCheck,
00144 (Concept::HasNumericTraits<OutputValueType>));
00145
00147 #endif
00148
00149 protected:
00150 VectorRescaleIntensityImageFilter();
00151 virtual ~VectorRescaleIntensityImageFilter() {};
00152
00153 private:
00154 VectorRescaleIntensityImageFilter(const Self&);
00155 void operator=(const Self&);
00156
00157 InputRealType m_Scale;
00158 InputRealType m_Shift;
00159
00160 InputRealType m_InputMaximumMagnitude;
00161 OutputRealType m_OutputMaximumMagnitude;
00162
00163 };
00164
00165
00166
00167 }
00168
00169 #ifndef ITK_MANUAL_INSTANTIATION
00170 #include "itkVectorRescaleIntensityImageFilter.txx"
00171 #endif
00172
00173 #endif
00174