fastica.hh
Go to the documentation of this file.
1 /* -*- mia-c++ -*-
2  *
3  * This file is part of MIA - a toolbox for medical image analysis
4  * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
5  *
6  * MIA is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with MIA; if not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef mia_core_fastica_hh
22 #define mia_core_fastica_hh
23 
24 #include <memory>
25 #include <mia/core/gsl_matrix.hh>
27 
28 namespace mia {
29 
44 public:
45 
49  enum EApproach {
51  appr_symm
52  };
53 
54 
59  FastICA(int num_ic);
60 
66  bool separate(const gsl::Matrix& mix);
67 
72  void set_approach(EApproach apr);
73 
79  void set_component_energy_limit(double limit);
80 
86  void set_nr_of_independent_components (int nrIC);
87 
91  void set_nonlinearity (PFastICADeflNonlinearity in_g);
92 
96  void set_finetune (bool in_finetune);
97 
101  void set_mu (double mu);
102 
106  void set_epsilon (double epsilon);
107 
111  void set_sample_size (double sampleSize);
112 
116  void set_stabilization (bool in_stabilization);
117 
121  void set_max_num_iterations (int maxNumIterations);
122 
126  void set_max_fine_tune (int maxFineTune);
127 
131  void set_pca_only (bool in_PCAonly);
132 
136  void set_init_guess (const gsl::Matrix& ma_initGuess);
137 
141  void set_saddle_check(bool saddle_check);
142 
146  void set_saddle_check_postiterations(int saddle_postiter);
147 
149  int get_nr_of_independent_components () const;
150 
151 
152  const gsl::Matrix& get_mixing_matrix () const;
153 
154  const gsl::Matrix& get_separating_matrix () const;
155 
156  const gsl::Matrix& get_independent_components () const;
157 
158 
159 
160  const gsl::Matrix& get_whitening_matrix () const;
161 
162  const gsl::Matrix& get_dewhitening_matrix () const;
163 
164  const gsl::Matrix& get_principal_eigenvectors () const;
165 
166  const gsl::Matrix& get_white_signal () const;
167 
168 private:
169  // evaluate the whitening and de-whitening matrices
170  void evaluate_whiten_matrix(const gsl::Matrix& evec, const gsl::Vector& eval);
171  bool fpica_defl_round(int component, gsl::Vector& w, gsl::Matrix& B);
172  bool fpica_defl(const gsl::Matrix& X, gsl::Matrix& B);
173  double fpica_symm_step(gsl::Matrix& B, gsl::Matrix& B_old, double mu, gsl::Matrix& Workspace);
174  bool fpica_symm(const gsl::Matrix& X, gsl::Matrix& B);
175  bool run_saddlecheck(gsl::Matrix &B, const gsl::Matrix& X);
176 
177  EApproach m_approach;
178 
179  int m_numOfIC;
180 
181  PFastICADeflNonlinearity m_nonlinearity;
182 
183  bool m_finetune;
184 
185  double m_mu;
186 
187  double m_epsilon;
188 
189  double m_sampleSize;
190 
191  bool m_stabilization;
192 
193  int m_maxNumIterations;
194 
195  int m_maxFineTune;
196 
197  int m_firstEig;
198 
199  int m_lastEig;
200 
201  bool m_PCAonly;
202 
203  double m_component_energy_limit;
204 
205  bool m_with_initial_guess;
206 
207  bool m_do_saddle_check;
208 
209  int m_saddle_postiter;
210 
211  gsl::Matrix m_initGuess;
212 
213  gsl::Matrix m_mixing_matrix;
214 
215  gsl::Matrix m_separating_matrix;
216 
217  gsl::Matrix m_independent_components;
218 
219  gsl::Matrix m_whitening_matrix;
220 
221  gsl::Matrix m_dewhitening_matrix;
222 
223  gsl::Matrix m_principal_eigenvectors;
224 
225  gsl::Matrix m_white_sig;
226 
227 };
228 
229 }
230 
231 #endif
Definition: fastica.hh:28
std::shared_ptr< CFastICADeflNonlinearity > PFastICADeflNonlinearity
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition: defines.hh:101