Commit a201218d authored by Martin Uecker's avatar Martin Uecker

model-based change parameter

parent d0e66487
......@@ -37,7 +37,6 @@ const struct iter3_irgnm_conf iter3_irgnm_defaults = {
.cgiter = 100,
.cgtol = 0.1,
.step = 0.9,
.nlinv_legacy = false,
};
......
......@@ -23,7 +23,6 @@ struct iter3_irgnm_conf {
int cgiter;
float cgtol;
float step;
_Bool nlinv_legacy;
};
......
......@@ -22,8 +22,6 @@
#include "misc/opts.h"
#include "misc/debug.h"
#include "noir/recon.h"
#include "moba/recon_T1.h"
......@@ -39,7 +37,7 @@ int main_moba(int argc, char* argv[])
float restrict_fov = -1.;
const char* psf = NULL;
struct noir_conf_s conf = noir_defaults;
struct moba_conf conf = moba_defaults;
bool out_sens = false;
bool usegpu = false;
bool unused = false;
......@@ -51,6 +49,9 @@ int main_moba(int argc, char* argv[])
OPT_UINT('i', &conf.iter, "iter", "Number of Newton steps"),
OPT_FLOAT('R', &conf.redu, "", "(reduction factor)"),
OPT_FLOAT('j', &conf.alpha_min, "", "Minimum regu. parameter"),
OPT_UINT('C', &conf.inner_iter, "iter", "inner iterations"),
OPT_FLOAT('s', &conf.step, "step", "step size"),
OPT_FLOAT('B', &conf.lower_bound, "bound", "lower bound for relaxivity"),
OPT_INT('d', &debug_level, "level", "Debug level"),
OPT_SET('N', &unused, "(normalize)"), // no-op
OPT_FLOAT('f', &restrict_fov, "FOV", ""),
......@@ -130,7 +131,7 @@ int main_moba(int argc, char* argv[])
if (-1 == restrict_fov)
restrict_fov = 0.5;
conf.noncart = true;
conf.noncartesian = true;
} else {
......
......@@ -43,7 +43,7 @@ struct T1inv_s {
INTERFACE(iter_op_data);
const struct nlop_s* nlop;
const struct iter3_irgnm_conf* conf;
const struct mdb_irgnm_l1_conf* conf;
long size_x;
long size_y;
......@@ -97,7 +97,7 @@ static void pos_value(iter_op_data* _data, float* dst, const float* src)
md_select_dims(DIMS, FFT_FLAGS, dims1, data->dims);
md_zsmax(DIMS, dims1, (_Complex float*)dst + (parameters - 1) * res * res,
(const _Complex float*)src + (parameters - 1) * res * res, 0.1);
(const _Complex float*)src + (parameters - 1) * res * res, data->conf->lower_bound);
}
......@@ -140,7 +140,7 @@ static void inverse_fista(iter_op_data* _data, float alpha, float* dst, const fl
wavthresh_rand_state_set(data->prox1, 1);
int maxiter = MIN(data->conf->cgiter, 10 * powf(2, data->outer_iter));
int maxiter = MIN(data->conf->c2->cgiter, 10 * powf(2, data->outer_iter));
float* tmp = md_alloc_sameplace(1, MD_DIMS(data->size_y), FL_SIZE, src);
......@@ -155,7 +155,7 @@ static void inverse_fista(iter_op_data* _data, float alpha, float* dst, const fl
itrdata->scale = data->alpha;
};
fista(maxiter, data->conf->cgtol * alpha * eps, step,
fista(maxiter, data->conf->c2->cgtol * alpha * eps, step,
data->size_x,
select_vecops(src),
continuation,
......@@ -223,7 +223,7 @@ static void T1inv_del(const operator_data_t* _data)
}
static const struct operator_p_s* T1inv_p_create(const struct iter3_irgnm_conf* conf, const long dims[DIMS], struct nlop_s* nlop)
static const struct operator_p_s* T1inv_p_create(const struct mdb_irgnm_l1_conf* conf, const long dims[DIMS], struct nlop_s* nlop)
{
PTR_ALLOC(struct T1inv2_s, data);
SET_TYPEID(T1inv2_s, data);
......@@ -285,7 +285,7 @@ static void nlop_der_iter(iter_op_data* _o, float* _dst, const float* _src)
void mdb_irgnm_l1(const iter3_conf* _conf,
void mdb_irgnm_l1(const struct mdb_irgnm_l1_conf* conf,
const long dims[],
struct nlop_s* nlop,
long N, float* dst,
......@@ -297,13 +297,11 @@ void mdb_irgnm_l1(const iter3_conf* _conf,
assert(M * sizeof(float) == md_calc_size(cd->N, cd->dims) * cd->size);
assert(N * sizeof(float) == md_calc_size(dm->N, dm->dims) * dm->size);
struct iter3_irgnm_conf* conf = CAST_DOWN(iter3_irgnm_conf, _conf);
struct iterT1_nlop_s nl_data = { { &TYPEID(iterT1_nlop_s) }, *nlop };
const struct operator_p_s* inv_op = T1inv_p_create(conf, dims, nlop);
irgnm2(conf->iter, conf->alpha, 0., conf->alpha_min, conf->redu, N, M, select_vecops(src),
irgnm2(conf->c2->iter, conf->c2->alpha, 0., conf->c2->alpha_min, conf->c2->redu, N, M, select_vecops(src),
(struct iter_op_s){ nlop_for_iter, CAST_UP(&nl_data) },
(struct iter_op_s){ nlop_der_iter, CAST_UP(&nl_data) },
OPERATOR_P2ITOP(inv_op),
......
struct iter3_conf_s;
struct iter3_irgnm_conf;
struct nlop_s;
......@@ -8,7 +8,15 @@ struct nlop_s;
#define DIMS 16
#endif
void mdb_irgnm_l1(const struct iter3_conf_s* _conf,
struct mdb_irgnm_l1_conf {
struct iter3_irgnm_conf* c2;
float step;
float lower_bound;
};
void mdb_irgnm_l1(const struct mdb_irgnm_l1_conf* conf,
const long dims[DIMS],
struct nlop_s* nlop,
long N, float* dst,
......
......@@ -34,8 +34,21 @@
#include "recon_T1.h"
struct moba_conf moba_defaults = {
void T1_recon(const struct noir_conf_s* conf, const long dims[DIMS], complex float* img, complex float* sens, const complex float* pattern, const complex float* mask, const complex float* TI, const complex float* kspace_data, _Bool usegpu)
.iter = 8,
.alpha = 1.,
.alpha_min = 0.,
.redu = 2.,
.step = 0.9,
.lower_bound = 0.,
.tolerance = 0.01,
.inner_iter = 250,
.noncartesian = false,
};
void T1_recon(const struct moba_conf* conf, const long dims[DIMS], complex float* img, complex float* sens, const complex float* pattern, const complex float* mask, const complex float* TI, const complex float* kspace_data, _Bool usegpu)
{
long imgs_dims[DIMS];
long coil_dims[DIMS];
......@@ -63,13 +76,12 @@ void T1_recon(const struct noir_conf_s* conf, const long dims[DIMS], complex flo
md_copy(DIMS, coil_dims, x + skip, sens, CFL_SIZE);
struct noir_model_conf_s mconf = noir_model_conf_defaults;
mconf.rvc = conf->rvc;
mconf.noncart = conf->noncart;
mconf.rvc = false;
mconf.noncart = conf->noncartesian;
mconf.fft_flags = fft_flags;
mconf.a = 880.;
mconf.b = 32.;
//struct noir_s nl = noir_create(dims, mask, pattern, &mconf);
struct T1_s nl = T1_create(dims, mask, TI, pattern, &mconf, usegpu);
struct iter3_irgnm_conf irgnm_conf = iter3_irgnm_defaults;
......@@ -78,10 +90,11 @@ void T1_recon(const struct noir_conf_s* conf, const long dims[DIMS], complex flo
irgnm_conf.alpha = conf->alpha;
irgnm_conf.redu = conf->redu;
irgnm_conf.alpha_min = conf->alpha_min;
irgnm_conf.cgtol = 0.1f;
irgnm_conf.cgiter = 300;
irgnm_conf.cgtol = conf->tolerance;
irgnm_conf.cgiter = conf->inner_iter;
irgnm_conf.nlinv_legacy = true;
irgnm_conf.step = 0.475;
struct mdb_irgnm_l1_conf conf2 = { .c2 = &irgnm_conf, .step = conf->step, .lower_bound = conf->lower_bound };
long irgnm_conf_dims[DIMS];
md_select_dims(DIMS, fft_flags|MAPS_FLAG|CSHIFT_FLAG|COEFF_FLAG|TIME2_FLAG, irgnm_conf_dims, imgs_dims);
......@@ -92,7 +105,7 @@ void T1_recon(const struct noir_conf_s* conf, const long dims[DIMS], complex flo
debug_print_dims(DP_INFO, DIMS, irgnm_conf_dims);
mdb_irgnm_l1(CAST_UP(&irgnm_conf),
mdb_irgnm_l1(&conf2,
irgnm_conf_dims,
nl.nlop,
size * 2, (float*)x,
......
......@@ -4,8 +4,25 @@
#include "misc/mri.h"
struct noir_conf_s;
extern void T1_recon(const struct noir_conf_s* conf, const long dims[DIMS], _Complex float* img, _Complex float* sens, const _Complex float* pattern, const _Complex float* mask, const _Complex float* TI, const _Complex float* kspace_data, _Bool usegpu);
struct moba_conf {
unsigned int iter;
float alpha;
float alpha_min;
float redu;
float step;
float lower_bound;
float tolerance;
unsigned int inner_iter;
bool noncartesian;
};
extern struct moba_conf moba_defaults;
extern void T1_recon(const struct moba_conf* conf, const long dims[DIMS], _Complex float* img, _Complex float* sens, const _Complex float* pattern, const _Complex float* mask, const _Complex float* TI, const _Complex float* kspace_data, _Bool usegpu);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment