3d/fuzzyclustersolver_cg.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 __SOLVERCG_HH
22
#define __SOLVERCG_HH
23
24
#ifdef HAVE_CONFIG_H
25
#include <config.h>
26
#endif
27
28
#include <mia/3d.hh>
29
#include <cstdio>
30
#include <stdexcept>
31
#include <string>
32
33
34
35
NS_MIA_BEGIN
36
37
using namespace
std
;
38
39
40
51
extern
bool
fborder
(
long
index,
long
nx,
long
ny,
long
nz);
52
65
class
solve_sCG
{
66
67
private
:
68
69
double
__lambda1;
70
double
__lambda2;
71
72
// Dimension of images
73
long
__iter;
74
unsigned
int
__nx, __ny, __nz;
75
unsigned
long
__count;
76
77
// Pointer to Elements of w
78
float
*__weight_imagePtr;
79
float
*__fptr;
80
float
*__gain_image_ptr;
81
82
83
84
// b and x for solution of system
85
double
*__b;
86
double
*__v;
87
88
// counts iterations
89
90
91
// help pointers for one iteration cycle
92
double
*__r;
// r^(k)
93
double
*__rho;
// p^(k)
94
double
*__g;
95
double
*__Ag;
// speichert A * p
96
// Field of scaling factors
97
double
*__scale;
98
double
*__scale2;
99
100
// field for border voxels
101
bool
*__border;
102
103
104
double
__r1rho1;
// speichert r1 * rho1
105
double
__r2rho2;
// speichert r2 * rho2
106
double
__normr0;
107
double
__q, __e, __sprod;
108
109
// minimal residuum
110
double
__min_res, __relres;
111
114
void
init();
115
116
public
:
126
solve_sCG
(
C3DFImage
& w1,
C3DFImage
& f1,
C3DFImage
& g1,
double
l1,
double
l2,
double
r_res,
double
m_res);
127
128
~
solve_sCG
();
129
135
int
solve(
long
max_iterations,
double
*firstnormr0);
136
140
inline
long
get_iterations
() {
return
__iter;}
141
151
void
multA(
double
*x,
double
*result,
long
start,
long
ende);
152
160
void
multA_float(
float
*x,
float
*result);
161
165
void
get_solution(
C3DFImage
& gain);
166
170
void
add_to_solution(
C3DFImage
*e);
171
177
void
solvepar(
long
*max_iteration,
double
*normr,
double
*firstnormr0);
178
179
};
180
181
NS_MIA_END
182
183
#endif
T3DImage
Specific type of the 3D images that hold real pixel data.
Definition:
3d/image.hh:148
std
Definition:
gsl_iterator.hh:288
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition:
defines.hh:33
fborder
bool fborder(long index, long nx, long ny, long nz)
function defining field borders
solve_sCG
a class providing a CG solver
Definition:
3d/fuzzyclustersolver_cg.hh:65
solve_sCG::get_iterations
long get_iterations()
Definition:
3d/fuzzyclustersolver_cg.hh:140
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition:
defines.hh:36
mia
3d
fuzzyclustersolver_cg.hh
Generated by
1.8.13