15 #ifndef _ParticleShapeStatistics_h 16 #define _ParticleShapeStatistics_h 20 #include "vnl/vnl_vector.h" 21 #include "vnl/algo/vnl_symmetric_eigensystem.h" 22 #include "vnl/vnl_matrix.h" 23 #include "itkParticlePositionReader.h" 24 #include "vnl/vnl_vector_fixed.h" 25 #include "vnl/algo/vnl_matrix_inverse.h" 30 #include "itkParticlePositionWriter.h" 37 template <
unsigned int VDimension = 3>
45 itkStaticConstMacro( Dimension,
unsigned int, VDimension );
48 int ImportPoints( std::vector<vnl_vector<double> > points );
51 int ReadPointFiles(
const char* fname );
54 int ReloadPointFiles();
58 int WriteCSVFile(
const char* s );
59 int WriteCSVFile(
const std::string &s )
60 {
return this->WriteCSVFile( s.c_str() ); }
61 int WriteCSVFile2(
const char* s );
62 int WriteCSVFile2(
const std::string &s )
63 {
return this->WriteCSVFile2( s.c_str() ); }
72 int PrincipalComponentProjections();
75 int FisherLinearDiscriminant(
unsigned int );
79 {
return m_numSamples; }
80 inline int Group1SampleSize()
const 81 {
return m_numSamples1; }
82 inline int Group2SampleSize()
const 83 {
return m_numSamples2; }
87 {
return m_numDimensions; }
90 inline int GroupID(
unsigned int i )
const 91 {
return m_groupIDs[i]; }
92 const std::vector<int> &GroupID()
const 93 {
return m_groupIDs; }
97 {
return m_eigenvectors; }
98 const vnl_vector<double> &Eigenvalues()
const 99 {
return m_eigenvalues; }
102 const vnl_vector<double> &
Mean()
const 104 const vnl_vector<double> &Group1Mean()
const 106 const vnl_vector<double> &Group2Mean()
const 110 const vnl_vector<double> &NormalizedGroupDifference()
const 111 {
return m_groupdiffnorm; }
112 const vnl_vector<double> &GroupDifference()
const 113 {
return m_groupdiff; }
122 int ComputeMedianShape(
const int );
125 double L1Norm(
unsigned int a,
unsigned int b );
129 {
return m_principals; }
133 {
return m_fishersLD; }
139 const vnl_vector<double> &
Shape(
unsigned int i )
const 140 {
return m_shapes.get_column( i ); }
145 int SimpleLinearRegression(
const std::vector<double> &y,
146 const std::vector<double> &x,
147 double &a,
double &b )
const;
150 unsigned int m_numSamples1;
151 unsigned int m_numSamples2;
152 unsigned int m_numSamples;
153 unsigned int m_domainsPerShape;
154 unsigned int m_numDimensions;
155 std::vector<int> m_groupIDs;
157 vnl_matrix<double> m_pooled_covariance;
158 vnl_matrix<double> m_eigenvectors;
159 vnl_vector<double> m_eigenvalues;
160 vnl_vector<double> m_mean;
161 vnl_vector<double> m_mean1;
162 vnl_vector<double> m_mean2;
163 vnl_matrix<double> m_pointsMinusMean;
164 vnl_matrix<double> m_shapes;
165 vnl_matrix<double> m_projectedPMM1;
166 vnl_matrix<double> m_projectedPMM2;
167 vnl_vector<double> m_projectedMean1;
168 vnl_vector<double> m_projectedMean2;
169 std::vector<double> m_fishersProjection;
170 std::vector<double> m_percentVarByMode;
171 vnl_vector<double> m_fishersLD;
173 vnl_matrix<double> m_principals;
175 vnl_vector<double> m_groupdiff;
176 vnl_vector<double> m_groupdiffnorm;
179 std::vector< std::string > m_pointsfiles;
182 #if ITK_TEMPLATE_EXPLICIT 183 # include "Templates/itkParticleShapeStatistics+-.h" 187 # include "itkParticleShapeStatistics.txx" 190 #endif // ifndef _ParticleShapeStatistics_h const vnl_matrix< double > & ShapeMatrix() const
const vnl_matrix< double > & PCALoadings() const
const vnl_vector< double > & Mean() const
int GroupID(unsigned int i) const
Representation of a single shape/patient.
int NumberOfDimensions() const
const vnl_matrix< double > & Eigenvectors() const
const vnl_vector< double > & FishersLDA() const