21 #ifndef otbPCAImageFilter_h
22 #define otbPCAImageFilter_h
52 template <
class TInputImage,
class TOutputImage, Transform::TransformDirection TDirectionOfTransformation>
53 class ITK_EXPORT
PCAImageFilter :
public itk::ImageToImageFilter<TInputImage, TOutputImage>
58 typedef itk::ImageToImageFilter<TInputImage, TOutputImage>
Superclass;
69 itkStaticConstMacro(InputImageDimension,
unsigned int, TInputImage::ImageDimension);
70 itkStaticConstMacro(OutputImageDimension,
unsigned int, TOutputImage::ImageDimension);
87 typedef typename MatrixObjectType::ComponentType
MatrixType;
102 itkSetMacro(NumberOfPrincipalComponentsRequired,
unsigned int);
103 itkGetMacro(NumberOfPrincipalComponentsRequired,
unsigned int);
106 itkSetMacro(Whitening,
bool);
107 itkGetMacro(Whitening,
bool);
112 itkGetMacro(GivenCovarianceMatrix,
bool);
115 if (m_GivenCovarianceMatrix)
116 return m_CovarianceMatrix;
118 return this->GetCovarianceEstimator()->GetCovariance();
123 m_CovarianceMatrix = cov;
124 m_GivenCovarianceMatrix =
true;
129 itkGetMacro(GivenTransformationMatrix,
bool);
132 m_TransformationMatrix = transf;
133 m_GivenTransformationMatrix =
true;
134 m_IsTransformationMatrixForward = isForward;
140 itkGetMacro(UseNormalization,
bool);
143 m_UseNormalization = norm;
144 m_UseVarianceForNormalization = norm;
151 m_UseNormalization =
true;
152 m_GivenMeanValues =
true;
157 itkGetConstMacro(UseVarianceForNormalization,
bool);
158 itkSetMacro(UseVarianceForNormalization,
bool);
163 m_UseNormalization =
true;
164 m_UseVarianceForNormalization =
true;
165 m_GivenStdDevValues =
true;
166 m_StdDevValues = vec;
173 m_Normalizer->GetCovarianceEstimator()->SetUserIgnoredValue(value);
174 m_Normalizer->GetCovarianceEstimator()->SetIgnoreUserDefinedValue(
true);
177 m_CovarianceEstimator->SetUserIgnoredValue(value);
178 m_CovarianceEstimator->SetIgnoreUserDefinedValue(
true);
196 void GenerateOutputInformation()
override;
201 void GenerateData()
override;
203 void PrintSelf(std::ostream& os, itk::Indent indent)
const override;
206 virtual void ForwardGenerateOutputInformation();
207 virtual void ReverseGenerateOutputInformation();
208 virtual void ForwardGenerateData();
209 virtual void ReverseGenerateData();
212 void GenerateTransformationMatrix();
242 #ifndef OTB_MANUAL_INSTANTIATION
Apply a matrix multiplication over the channels of an image.
itk::SmartPointer< Self > Pointer
Normalize an VectorImage by setting its mean to zero and possibly variance to one (band by band).
itk::SmartPointer< Self > Pointer
Performs a Principal Component Analysis.
TransformFilterPointerType m_Transformer
TOutputImage OutputImageType
~PCAImageFilter() override
CovarianceEstimatorFilterPointerType m_CovarianceEstimator
TInputImage InputImageType
StreamingStatisticsVectorImageFilter< InputImageType > CovarianceEstimatorFilterType
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
NormalizeVectorImageFilter< TInputImage, TOutputImage > NormalizeFilterType
bool m_IsTransformationMatrixForward
VectorType m_StdDevValues
InternalMatrixType::element_type MatrixElementType
void SetStatisticsUserIgnoredValue(RealType value)
MatrixType m_TransformationMatrix
CovarianceEstimatorFilterType::Pointer CovarianceEstimatorFilterPointerType
void SetCovarianceMatrix(const MatrixType &cov)
void SetTransformationMatrix(const MatrixType &transf, bool isForward=true)
void SetMeanValues(const VectorType &data)
MatrixType::InternalMatrixType InternalMatrixType
void SetStdDevValues(const VectorType &vec)
Transform::TransformDirection TransformDirectionEnumType
MatrixObjectType::ComponentType MatrixType
PCAImageFilter(const Self &)
MatrixType GetCovarianceMatrix() const
CovarianceEstimatorFilterType::RealPixelType VectorType
NormalizeFilterPointerType m_Normalizer
NormalizeFilterType::Pointer NormalizeFilterPointerType
CovarianceEstimatorFilterType::MatrixObjectType MatrixObjectType
itk::SmartPointer< const Self > ConstPointer
CovarianceEstimatorFilterType::RealType RealType
void SetUseNormalization(bool norm)
bool m_GivenTransformationMatrix
itk::SmartPointer< Self > Pointer
bool m_GivenCovarianceMatrix
unsigned int m_NumberOfPrincipalComponentsRequired
MatrixImageFilter< TInputImage, TOutputImage > TransformFilterType
TransformFilterType::Pointer TransformFilterPointerType
bool m_UseVarianceForNormalization
MatrixType m_CovarianceMatrix
void operator=(const Self &)
This class streams the whole input image through the PersistentStatisticsImageFilter.
StatFilterType::RealType RealType
StatFilterType::RealPixelType RealPixelType
itk::SmartPointer< Self > Pointer
StatFilterType::MatrixObjectType MatrixObjectType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.