test5.cpp

Go to the documentation of this file.
00001 #include "indii/fmri/hemodynamic/NeuralBalloonModel.hpp"
00002 #include "indii/fmri/hemodynamic/FlowBalloonModel.hpp"
00003 #include "indii/fmri/hemodynamic/BOLDCalculator.hpp"
00004 #include "indii/ml/ode/AdaptiveRungeKutta.hpp"
00005 
00006 #include <iostream>
00007 #include <string.h>
00008 #include <math.h>
00009 
00010 using namespace std;
00011 using namespace indii::fmri::hemodynamic;
00012 using namespace indii::ml::ode;
00013 
00014 /**
00015  * @file test5.cpp
00016  *
00017  * Rest test of NeuralBalloonModel.
00018  *
00019  * This test uses a completely vanilla NeuralBalloonModel to test the
00020  * behaviour of the model with no neural activity.
00021  *
00022  * \li \f$t\f$; time
00023  * \li \f$f_{in}(t)\f$
00024  * \li \f$f_{out}(t)\f$
00025  * \li \f$u(t)\f$
00026  * \li \f$q\f$
00027  * \li \f$v\f$
00028  * \li \f$f\f$
00029  * \li \f$s\f$
00030  * \li \f$y\f$; BOLD response
00031  *
00032  * Results are as follows:
00033  *
00034  * \image html test5.png "Results"
00035  * \image latex test5.eps "Results"
00036  *
00037  * As the system is never perturbed by a change in neural activity all
00038  * properties should remain constant at their initial values.
00039  */
00040 
00041 
00042 /**
00043  * Duration of simulation (s).
00044  */
00045 static const double END = 60.0;
00046 
00047 /**
00048  * Write out current state as row of results.
00049  */
00050 void outputState(AdaptiveRungeKutta* ode, BalloonModel* bm,
00051     BOLDCalculator* bc) {
00052   cout << ode->getTime() << "\t";
00053   cout << bm->getFunction(FlowBalloonModel::F_IN) << "\t";
00054   cout << bm->getFunction(FlowBalloonModel::F_OUT) << "\t";
00055   cout << bm->getFunction(NeuralBalloonModel::U) << "\t";
00056   cout << ode->getVariable(FlowBalloonModel::Q) << "\t";
00057   cout << ode->getVariable(FlowBalloonModel::V) << "\t";
00058   cout << ode->getVariable(NeuralBalloonModel::F) << "\t";
00059   cout << ode->getVariable(NeuralBalloonModel::S) << "\t";
00060   cout << bc->calculate(ode->getState()) * 100.0 << "\t";
00061   cout << endl;
00062 }
00063 
00064 /**
00065  * Run tests.
00066  */
00067 int main(int argc, const char* argv[]) {
00068   NeuralBalloonModel bm;
00069   BOLDCalculator bc(&bm);
00070   AdaptiveRungeKutta ode(&bm, bm.suggestInitialState());
00071   double t = 0.0;
00072 
00073   outputState(&ode, &bm, &bc);
00074   while (t < END) {
00075     t = ode.step(END);
00076     outputState(&ode, &bm, &bc);
00077   }
00078 
00079   return 0;
00080 }

Generated on Mon Aug 13 19:51:39 2007 for fmrii Hemodynamic Models Test Suite by  doxygen 1.5.2