ica_template.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-2013 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_template_hh
22 #define mia_core_ica_template_hh
23 
24 #include <mia/core/ica.hh>
25 #include <vector>
26 
27 #ifndef EXPORT_TDataSeriesICA
28 #ifdef WIN32
29 # define EXPORT_TDataSeriesICA __declspec(dllimport)
30 #else
31 # ifdef __GNUC__
32 # define EXPORT_TDataSeriesICA __attribute__((visibility("default")))
33 # else
34 # define EXPORT_TDataSeriesICA
35 # endif
36 #endif
37 #endif
38 
40 
59 template <class Data>
61 public:
65 
67  typedef typename Data::Pointer PData;
68 
76  TDataSeriesICA(const std::vector<Data>& initializer, bool strip_mean);
77 
84  bool run(size_t ncomponents, bool strip_mean, bool ica_normalize,
85  std::vector<std::vector<float> > guess = std::vector<std::vector<float> >());
86 
87 
96  size_t run_auto(int max_ica, int min_ica, float corr_thresh);
97 
101  void normalize();
102 
104  void normalize_Mix();
105 
106 
110  Data get_mix(size_t idx) const;
111 
113  const Data& get_mean_image() const;
114 
121  Data get_incomplete_mix(size_t idx, const IndexSet& skip) const;
122 
129  Data get_partial_mix(size_t idx, const IndexSet& comps) const;
130 
132  CSlopeColumns get_mixing_curves() const;
133 
135  PData get_feature_image(size_t idx) const;
136 
143  PData get_delta_feature(const IndexSet& plus, const IndexSet& minus)const;
144 
150  void set_mixing_series(size_t index, const std::vector<float>& series);
151 
152 
157  void set_max_iterations(int n);
158 
163  void set_approach(int approach);
164 
165 
166  ~TDataSeriesICA();
167 private:
168  CICAAnalysis m_analysis;
169  typedef typename Data::dimsize_type dimsize_type;
170  dimsize_type m_size;
171  Data m_mean;
172 
173 };
174 
176 
177 #endif