1 /*
2   Teem: Tools to process and visualize scientific data and images             .
3   Copyright (C) 2012, 2011, 2010, 2009  University of Chicago
4   Copyright (C) 2008, 2007, 2006, 2005  Gordon Kindlmann
5   Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998  University of Utah
6 
7   This library is free software; you can redistribute it and/or
8   modify it under the terms of the GNU Lesser General Public License
9   (LGPL) as published by the Free Software Foundation; either
10   version 2.1 of the License, or (at your option) any later version.
11   The terms of redistributing and/or modifying this software also
12   include exceptions to the LGPL that facilitate static linking.
13 
14   This library is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17   Lesser General Public License for more details.
18 
19   You should have received a copy of the GNU Lesser General Public License
20   along with this library; if not, write to Free Software Foundation, Inc.,
21   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 */
23 
24 #include "ten.h"
25 #include "privateTen.h"
26 
27 #define PARM_NUM 0
28 static const tenModelParmDesc
29 parmDesc[] = {
30   /* dummy to avoid compiler error */
31   {"dummy", 0.0, 0.0, AIR_FALSE, AIR_FALSE, 0},
32 };
33 
34 static void
simulate(double * dwiSim,const double * parm,const tenExperSpec * espec)35 simulate(double *dwiSim, const double *parm, const tenExperSpec *espec) {
36   unsigned int ii;
37 
38   AIR_UNUSED(parm);
39   AIR_UNUSED(espec);
40   for (ii=0; ii<espec->imgNum; ii++) {
41     dwiSim[ii] = 0;
42   }
43   return;
44 }
45 
46 static char *
parmSprint(char str[AIR_STRLEN_MED],const double * parm)47 parmSprint(char str[AIR_STRLEN_MED], const double *parm) {
48 
49   AIR_UNUSED(parm);
50   sprintf(str, "constant 0");
51   return str;
52 }
53 
54 static double *
parmAlloc(void)55 parmAlloc(void) {
56 
57   return NULL;
58 }
59 
60 static void
parmRand(double * parm,airRandMTState * rng,int knownB0)61 parmRand(double *parm, airRandMTState *rng, int knownB0) {
62   AIR_UNUSED(parm);
63   AIR_UNUSED(rng);
64   AIR_UNUSED(knownB0);
65 }
66 
67 static void
parmStep(double * parm1,const double scl,const double * grad,const double * parm0)68 parmStep(double *parm1, const double scl,
69          const double *grad, const double *parm0) {
70   AIR_UNUSED(parm1);
71   AIR_UNUSED(scl);
72   AIR_UNUSED(grad);
73   AIR_UNUSED(parm0);
74 }
75 
76 static double
parmDist(const double * parmA,const double * parmB)77 parmDist(const double *parmA, const double *parmB) {
78   AIR_UNUSED(parmA);
79   AIR_UNUSED(parmB);
80   return 0.0;
81 }
82 
83 static void
parmCopy(double * parmA,const double * parmB)84 parmCopy(double *parmA, const double *parmB) {
85   AIR_UNUSED(parmA);
86   AIR_UNUSED(parmB);
87 }
88 
89 static int
parmConvert(double * parmDst,const double * parmSrc,const tenModel * modelSrc)90 parmConvert(double *parmDst, const double *parmSrc,
91             const tenModel *modelSrc) {
92   AIR_UNUSED(parmDst);
93   AIR_UNUSED(parmSrc);
94   AIR_UNUSED(modelSrc);
95   return 0;
96 }
97 
98 _TEN_SQE
99 
100 static void
sqeGrad(double * grad,const double * parm0,const tenExperSpec * espec,double * dwiBuff,const double * dwiMeas,int knownB0)101 sqeGrad(double *grad, const double *parm0,
102         const tenExperSpec *espec,
103         double *dwiBuff, const double *dwiMeas,
104         int knownB0) {
105   AIR_UNUSED(grad);
106   AIR_UNUSED(parm0);
107   AIR_UNUSED(espec);
108   AIR_UNUSED(dwiBuff);
109   AIR_UNUSED(dwiMeas);
110   AIR_UNUSED(knownB0);
111 }
112 
_TEN_SQE_FIT(tenModelZero)113 _TEN_SQE_FIT(tenModelZero)
114 
115 _TEN_NLL
116 _TEN_NLL_GRAD_STUB
117 
118 static double
119 nllFit(double *parm, const tenExperSpec *espec,
120        const double *dwiMeas, const double *parmInit,
121        int rician, double sigma, int knownB0) {
122   AIR_UNUSED(parm);
123   AIR_UNUSED(espec);
124   AIR_UNUSED(dwiMeas);
125   AIR_UNUSED(parmInit);
126   AIR_UNUSED(rician);
127   AIR_UNUSED(sigma);
128   AIR_UNUSED(knownB0);
129   return AIR_NAN;
130 }
131 
132 tenModel
133 _tenModelZero = {
134   TEN_MODEL_STR_ZERO,
135   _TEN_MODEL_FIELDS
136 };
137 const tenModel *const tenModelZero = &_tenModelZero;
138