aimsalgo 6.0.0
Neuroimaging image processing
pca.h
Go to the documentation of this file.
1/* This software and supporting documentation are distributed by
2 * Institut Federatif de Recherche 49
3 * CEA/NeuroSpin, Batiment 145,
4 * 91191 Gif-sur-Yvette cedex
5 * France
6 *
7 * This software is governed by the CeCILL-B license under
8 * French law and abiding by the rules of distribution of free software.
9 * You can use, modify and/or redistribute the software under the
10 * terms of the CeCILL-B license as circulated by CEA, CNRS
11 * and INRIA at the following URL "http://www.cecill.info".
12 *
13 * As a counterpart to the access to the source code and rights to copy,
14 * modify and redistribute granted by the license, users are provided only
15 * with a limited warranty and the software's author, the holder of the
16 * economic rights, and the successive licensors have only limited
17 * liability.
18 *
19 * In this respect, the user's attention is drawn to the risks associated
20 * with loading, using, modifying and/or developing or reproducing the
21 * software by the user in light of its specific status of free software,
22 * that may mean that it is complicated to manipulate, and that also
23 * therefore means that it is reserved for developers and experienced
24 * professionals having in-depth computer knowledge. Users are therefore
25 * encouraged to load and test the software's suitability as regards their
26 * requirements in conditions enabling the security of their systems and/or
27 * data to be ensured and, more generally, to use and operate it in the
28 * same conditions as regards security.
29 *
30 * The fact that you are presently reading this means that you have had
31 * knowledge of the CeCILL-B license and that you accept its terms.
32 */
33
34
35#ifndef AIMS_MATH_PCA_H
36#define AIMS_MATH_PCA_H
37
38#include <aims/def/general.h>
39#include <cartodata/volume/volume.h>
40#include <vector>
41
42
43class AimsPCA
44{
45public:
46 AimsPCA( int significantNumberOfVp, bool normalize = false, bool center = true ) ;
48
49 template <class T>
50 void doIt( const carto::rc_ptr<carto::Volume<T> > & individuals ) ;
51
52 template <class T>
53 void doIt( const std::list< Point3d>& selectedPoints, const carto::rc_ptr<carto::Volume<T> > & data ) ;
54
55
56 float noiseVariance( float& meanNorm ) ;
57 double totalVariance( float& meanNorm ) const ;
58
59 float relativeUnreconstructedVariance( float& meanNorm ) ;
61 void setMinimalInertia( float inertiaLimit ) ;
62
63 float minimalInertia() const ;
64 float significantNumberOfVp() const ;
65
67 float noiseInertia() ;
71 const carto::rc_ptr<carto::Volume<float> > & individual ) ;
73 const carto::rc_ptr<carto::Volume<float> > & individual ) ;
74
77
78 const std::vector<float>& eigenValues() const ;
81
82 const std::vector<float>& mean() const ;
83 const std::vector<float>& var() const ;
84
85 bool valid() const { return _validPca ; }
86
87protected:
89 bool _validPca ;
90 bool _computed ;
92 bool _center ;
94 std::vector<float> _mean ;
95 std::vector<float> _var ;
96
97 std::vector<float> _projectionVector ;
100 std::vector<float> _eigenValues ;
104
107};
108
109#endif
bool _matricesComputed
Definition pca.h:91
float _minimalInertia
Definition pca.h:106
void setSignificantNumberOfVp(int significantNumberOfVp)
carto::VolumeRef< float > _eigenVectors
Definition pca.h:101
std::vector< float > _mean
Definition pca.h:94
float noiseInertia()
float relativeUnreconstructedVariance(float &meanNorm)
bool _validPca
Definition pca.h:89
const std::vector< float > & var() const
const carto::VolumeRef< float > & eigenVectors() const
std::vector< float > _var
Definition pca.h:95
carto::VolumeRef< float > selectedEigenVectors() const
const carto::VolumeRef< float > & projectionMatrix()
bool _computed
Definition pca.h:90
const std::vector< float > & eigenValues() const
void setMinimalInertia(float inertiaLimit)
AimsPCA(int significantNumberOfVp, bool normalize=false, bool center=true)
bool valid() const
Definition pca.h:85
float relativeUnreconstructedVariance()
float significantInertia()
float unreconstructedVariance()
void computeErrorAndProjMatrices()
float noiseVariance(float &meanNorm)
double totalVariance(float &meanNorm) const
void doIt(const carto::rc_ptr< carto::Volume< T > > &individuals)
Definition pca_d.h:60
std::vector< float > _projectionVector
Definition pca.h:97
float minimalInertia() const
carto::VolumeRef< float > projection(const carto::rc_ptr< carto::Volume< float > > &individual)
const std::vector< float > & mean() const
const carto::VolumeRef< float > & reconstructionErrorMatrix()
carto::VolumeRef< float > _selectedEigenVectorsTr
Definition pca.h:103
~AimsPCA()
Definition pca.h:47
carto::VolumeRef< float > _selectedEigenVectors
Definition pca.h:102
carto::VolumeRef< float > _projectionMatrix
Definition pca.h:98
float reconstructionError2(const carto::rc_ptr< carto::Volume< float > > &individual)
bool _center
Definition pca.h:92
carto::VolumeRef< float > _errorMatrix
Definition pca.h:99
float significantNumberOfVp() const
std::vector< float > _eigenValues
Definition pca.h:100
int _significantNumberOfVp
Definition pca.h:105
bool _normalize
Definition pca.h:93