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-2017 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 
28 #ifndef EXPORT_TDataSeriesICA
29 #ifdef WIN32
30 # define EXPORT_TDataSeriesICA __declspec(dllimport)
31 #else
32 # ifdef __GNUC__
33 # define EXPORT_TDataSeriesICA __attribute__((visibility("default")))
34 # else
35 # define EXPORT_TDataSeriesICA
36 # endif
37 #endif
38 #endif
39 
41 
60 template <class Data>
62 public:
65  typedef CIndepCompAnalysis::IndexSet IndexSet;
66 
68  typedef typename Data::Pointer PData;
69 
80  TDataSeriesICA(const CIndepCompAnalysisFactory& icatool, const std::vector<Data>& initializer, bool strip_mean);
81 
88  bool run(size_t ncomponents, bool strip_mean, bool ica_normalize,
89  std::vector<std::vector<float> > guess = std::vector<std::vector<float> >());
90 
91 
92 
96  void normalize();
97 
99  void normalize_Mix();
100 
101 
105  Data get_mix(size_t idx) const;
106 
108  const Data& get_mean_image() const;
109 
116  Data get_incomplete_mix(size_t idx, const IndexSet& skip) const;
117 
124  Data get_partial_mix(size_t idx, const IndexSet& comps) const;
125 
127  CSlopeColumns get_mixing_curves() const;
128 
135  std::vector<float> get_mixing_curve(unsigned idx) const;
136 
138  PData get_feature_image(size_t idx) const;
139 
146  PData get_delta_feature(const IndexSet& plus, const IndexSet& minus)const;
147 
153  void set_mixing_series(size_t index, const std::vector<float>& series);
154 
155 
160  void set_max_iterations(int n);
161 
166  void set_approach(CIndepCompAnalysis::EApproach approach);
167 
168 
169  ~TDataSeriesICA();
170 private:
171  PIndepCompAnalysis m_analysis;
172  typedef typename Data::dimsize_type dimsize_type;
173  dimsize_type m_size;
174  Data m_mean;
175 
176 };
177 
179 
180 #endif
std::shared_ptr< Image > normalize(const Image &image)
a normalizer for image intensities
Definition: normalize.hh:131
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
CIndepCompAnalysis::IndexSet IndexSet
Definition: ica_template.hh:65
CIndepCompAnalysis::Pointer PIndepCompAnalysis
Definition: core/ica.hh:159
Data::Pointer PData
Definition: ica_template.hh:68
#define EXPORT_TDataSeriesICA
Definition: ica_template.hh:33
std::vector< std::vector< float > > CSlopeColumns
class to store the ICA weight matrix
Definition: slopevector.hh:33
Templated representation of a ICA series analyis.
Definition: ica_template.hh:61
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36