core/ica.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_ica_hh
22 #define mia_core_ica_hh
23 
24 #include <set>
25 #include <vector>
26 #include <itpp/signal/fastica.h>
27 
28 #include <mia/core/defines.hh>
29 #include <mia/core/slopevector.hh>
31 
32 #include <boost/concept/requires.hpp>
33 #include <boost/concept_check.hpp>
34 
35 
37 
44 class EXPORT_CORE CICAAnalysisITPP : public CICAAnalysis {
45 public:
46  typedef CICAAnalysis::IndexSet IndexSet;
47 
48 
50  typedef itpp::Vec<itpp::mat::value_type> itppvector;
54  CICAAnalysisITPP(const itpp::mat& ic, const itpp::mat& mix, const std::vector<double>& mean );
55 
56 
58 
59 
61 
68  void initialize(unsigned int series_length, unsigned int slice_size);
69 
70 
77  bool run(unsigned int nica, std::vector<std::vector<float> > guess);
78 
79 
81  std::vector<float> get_feature_row(unsigned int row)const;
82 
84  std::vector<float> get_mix_series(unsigned int row)const;
85 
87  std::vector<float> get_mix(unsigned int idx)const;
88 
95  std::vector<float> get_incomplete_mix(unsigned int idx, const IndexSet& skip)const;
96 
103  std::vector<float> get_partial_mix(unsigned int idx, const IndexSet& use)const;
104 
110  std::vector<float> get_delta_feature(const IndexSet& plus, const IndexSet& minus)const;
111 
117  void set_mixing_series(unsigned int index, const std::vector<float>& series);
118 
120  CSlopeColumns get_mixing_curves() const;
121 
128  void normalize_ICs();
129 
135  std::vector<float> normalize_Mix();
136 
137 
139  unsigned int get_ncomponents() const;
140 
145  void set_max_iterations(int n);
146 
151  void set_approach(EApproach approach);
152 private:
153  void set_row_internal(unsigned row, const std::vector<double>& buffer, double mean);
154 
155  struct CICAAnalysisITPPImpl *impl;
156 
157 };
158 
159 
160 class EXPORT_CORE CICAAnalysisITPPFactory: public CICAAnalysisFactory {
161 public:
162  PICAAnalysis create() const;
163 };
164 
165 typedef std::shared_ptr<CICAAnalysisITPPFactory> PICAAnalysisITPPFactory;
166 
168 
169 #endif
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
CICAAnalysis::IndexSet IndexSet
Definition: core/ica.hh:46
class for ICA analysis and use of such data. This class implements basic operations for of ICA...
Definition: core/ica.hh:44
itpp::Vec< itpp::mat::value_type > itppvector
The type of a vector as used by IT++.
Definition: core/ica.hh:50
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition: defines.hh:101
std::shared_ptr< CICAAnalysisITPPFactory > PICAAnalysisITPPFactory
Definition: core/ica.hh:165
CICAAnalysis::Pointer PICAAnalysis
std::vector< std::vector< float > > CSlopeColumns
class to store the ICA weight matrix
Definition: slopevector.hh:33
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36