Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

model_diffusion.c File Reference

#include <math.h>
#include "NLfit_model.h"

Go to the source code of this file.


Functions

void signal_model (float *gs, int ts_length, float **x_array, float *ts_array)
DEFINE_MODEL_PROTOTYPE MODEL_interfaceinitialize_model ()

Function Documentation

DEFINE_MODEL_PROTOTYPE MODEL_interface* initialize_model  
 

Definition at line 40 of file model_diffusion.c.

References MODEL_interface::call_func, MODEL_interface::label, MODEL_interface::max_constr, MODEL_interface::min_constr, MODEL_SIGNAL_TYPE, MODEL_interface::model_type, MODEL_interface::params, MODEL_interface::plabel, signal_model(), and XtMalloc.

00041 {
00042   MODEL_interface * mi = NULL;
00043  
00044   /*----- allocate memory space for model interface -----*/
00045   mi = (MODEL_interface *) XtMalloc (sizeof(MODEL_interface));
00046 
00047 
00048   /*----- define interface for the diffusion model -----*/   
00049 
00050   /*----- name of this model -----*/
00051   strcpy (mi->label, "ADC");
00052 
00053   /*----- this is a signal model -----*/
00054   mi->model_type = MODEL_SIGNAL_TYPE;
00055 
00056   /*----- number of parameters in the model -----*/
00057   mi->params = 2;
00058 
00059   /*----- parameter labels -----*/
00060   strcpy (mi->plabel[0], "So");
00061   strcpy (mi->plabel[1], "D");
00062 
00063   /*----- minimum and maximum parameter constraints -----*/
00064   mi->min_constr[0] =  0.0;    mi->max_constr[0] =   32256.0;
00065   mi->min_constr[1] =  0.00;    mi->max_constr[1] =   .004;
00066 
00067 
00068   /*----- function which implements the model -----*/
00069   mi->call_func = &signal_model;
00070 
00071 
00072   /*----- return pointer to the model interface -----*/
00073   return (mi);
00074 }

void signal_model float *    gs,
int    ts_length,
float **    x_array,
float *    ts_array
 

Definition at line 90 of file model_diffusion.c.

Referenced by initialize_model().

00097 {
00098   int it;                           /* time index */     
00099   float t;                          /* time = in this case actually b factor */
00100   float fval;                       /* time series value at time t */  
00101 
00102 
00103   for (it = 0;  it < ts_length;  it++)
00104     {
00105       t = x_array[it][1];
00106       fval = gs[0] * exp(-t*gs[1]);
00107       ts_array[it] = fval;
00108     }
00109   
00110 }
 

Powered by Plone

This site conforms to the following standards: