My Project
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 
31 
33 {
34 public:
35 
38 
39  static const char *data_descr;
40 
42 
43  void set_signal(const gsl::Matrix *signal);
44  void set_mu(double m);
45 
46 protected:
47  double get_sample_scale() const
48  {
49  return m_sample_scale;
50  }
51  double get_mu() const
52  {
53  return m_mu;
54  };
55  const gsl::Matrix& get_signal() const;
56 
57 private:
58  virtual void post_set_signal() = 0;
59  double m_mu;
60  double m_sample_scale;
61  const gsl::Matrix *m_signal;
62 };
63 
77 {
78 public:
79 
82 
83  static const char *type_descr;
84 
85 
86  void apply(gsl::Vector& w);
87  void apply(gsl::Matrix& W);
88 
89  std::vector<double> get_saddle_test_table(const gsl::Matrix& ics) const;
90  double get_saddle_test_value(const gsl::Vector& ic) const;
91 
92 protected:
93  virtual void post_set_signal();
94 private:
103  virtual double get_correction_and_scale(gsl::Vector& XTw, gsl::Vector& correction) = 0;
104 
109  virtual double do_get_saddle_test_value(const gsl::Vector& ic) const = 0;
110  void sum_final(gsl::Vector& w, double scale);
111  void sum_final_stabelized(gsl::Vector& w, double scale);
112 
113  gsl::Vector m_XTw;
114  gsl::Vector m_workspace;
115 };
116 
117 
118 typedef std::shared_ptr<CFastICADeflNonlinearity> PFastICADeflNonlinearity;
119 
120 
122 
123 
125 
131 
132 }
133 
134 #endif
The base class for all plug-in created object.
Definition: product_base.hh:41
This is tha base of all plugins that create "things", like filters, cost functions time step operator...
Definition: factory.hh:51
the singleton that a plug-in handler really is
Definition: handler.hh:159
This is the base clase for non-linearities used in deflation based ICA.
void apply(gsl::Matrix &W)
double get_saddle_test_value(const gsl::Vector &ic) const
CFastICADeflNonlinearity plugin_type
helper typedef for plugin handling
void apply(gsl::Vector &w)
std::vector< double > get_saddle_test_table(const gsl::Matrix &ics) const
CFastICANonlinearityBase plugin_data
helper typedef for plugin handling
const gsl::Matrix & get_signal() const
void set_signal(const gsl::Matrix *signal)
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition: defines.hh:101
THandlerSingleton< TFactoryPluginHandler< CFastICADeflNonlinearityPlugin > > CFastICADeflNonlinearityPluginHandler
EXPORT_CORE PFastICADeflNonlinearity produce_fastica_nonlinearity(const std::string &descr)
std::shared_ptr< CFastICADeflNonlinearity > PFastICADeflNonlinearity
TFactory< CFastICADeflNonlinearity > CFastICADeflNonlinearityPlugin