fastica_nonlinearity.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_fastica_nonlinearity_hh
22 #define mia_core_fastica_nonlinearity_hh
23 
24 #include <mia/core/gsl_vector.hh>
25 #include <mia/core/gsl_matrix.hh>
26 
27 #include <mia/core/factory.hh>
28 namespace mia {
29 
30 
32 public:
33 
36 
37  static const char *data_descr;
38 
40 
41  void set_signal(const gsl::Matrix *signal);
42  void set_mu(double m);
43 
44 protected:
45  double get_sample_scale() const {return m_sample_scale;}
46  double get_mu() const { return m_mu;};
47  const gsl::Matrix& get_signal() const;
48 
49 private:
50  virtual void post_set_signal() = 0;
51  double m_mu;
52  double m_sample_scale;
53  const gsl::Matrix *m_signal;
54 };
55 
69 public:
70 
73 
74  static const char *type_descr;
75 
76 
77  void apply(gsl::Vector& w);
78  void apply(gsl::Matrix& W);
79 
80  std::vector<double> get_saddle_test_table(const gsl::Matrix& ics) const;
81  double get_saddle_test_value(const gsl::Vector& ic) const;
82 
83 protected:
84  virtual void post_set_signal();
85 private:
94  virtual double get_correction_and_scale(gsl::Vector& XTw, gsl::Vector& correction) = 0;
95 
100  virtual double do_get_saddle_test_value(const gsl::Vector& ic) const = 0;
101  void sum_final(gsl::Vector& w, double scale);
102  void sum_final_stabelized(gsl::Vector& w, double scale);
103 
104  gsl::Vector m_XTw;
105  gsl::Vector m_workspace;
106 };
107 
108 
109 typedef std::shared_ptr<CFastICADeflNonlinearity> PFastICADeflNonlinearity;
110 
111 
112 EXPORT_CORE PFastICADeflNonlinearity produce_fastica_nonlinearity(const std::string& descr);
113 
114 
116 
122 
123 }
124 
125 #endif
the singleton that a plug-in handler really is
Definition: handler.hh:157
THandlerSingleton< TFactoryPluginHandler< CFastICADeflNonlinearityPlugin > > CFastICADeflNonlinearityPluginHandler
std::shared_ptr< CFastICADeflNonlinearity > PFastICADeflNonlinearity
CFastICADeflNonlinearity plugin_type
helper typedef for plugin handling
This is tha base of all plugins that create "things", like filters, cost functions time step operator...
Definition: factory.hh:49
This is the base clase for non-linearities used in deflation based ICA.
EXPORT_CORE PFastICADeflNonlinearity produce_fastica_nonlinearity(const std::string &descr)
TFactory< CFastICADeflNonlinearity > CFastICADeflNonlinearityPlugin
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition: defines.hh:101
The base class for all plug-in created object.
Definition: product_base.hh:40
CFastICANonlinearityBase plugin_data
helper typedef for plugin handling