Skip to content

Example: Brain activity

YannCobigo edited this page Sep 10, 2014 · 5 revisions

http://www.mediawiki.org/wiki/Manual:Math

Table of Contents

Introduction

Input

Ouput

<math> i \partial \psi = m \psi </math>

Production of the head model and neuron population

Example: Head model

 * Production of the head model
   * mesh
   * dipoles.xml and paracellation.xml
   * physics data (conductivity, domains...)
 * production of the neurons' populations based on dipoles.xml. Data are saved in output/alpha_rhythm.xml
   * Show example of population production

Island

In Fijee, an island is a high level interface offering different combination of types to reach the user goal.

Example

int 
main()
{
  // 
  // Time log
  FIJEE_TIME_PROFILER("main");

  //
  // TODO remove VTK traces
  // Time log
  vtkSmartPointer<vtkTimerLog> timerLog = 
    vtkSmartPointer<vtkTimerLog>::New();
  //
  std::cout << "Process started at: " << timerLog->GetUniversalTime() << std::endl;

  // 
  // Access parameters
  Domains::Access_parameters* parameters = Domains::Access_parameters::get_instance();
  parameters->init();

  
  // 
  // Head simulation:    
  //   - Domains::Head_labeled_domain 
  //   - Domains::Head_conductivity_tensor
  //   - Domains::Build_mesh
  //   - Dipole generation
  //     - Domains::Build_dipoles_list_high_density
  //     - Build_dipoles_list_knn
  //
  // Spheres simulation: 
  //   - Domains::Spheres_labeled_domain 
  //   - Domains::Spheres_conductivity_tensor
  //   - Domains::Build_mesh
  //   - Dipole generation
  //     - Domains::Build_dipoles_list_high_density
  //     - Build_dipoles_list_knn
  // 
  Domains::Mesh_generator< Domains::Head_labeled_domain, 
			   Domains::Head_conductivity_tensor,
			   Domains::Build_mesh,
			   Domains::Build_dipoles_list_high_density > generator;
  //
  generator.make_inrimage();
  generator.make_conductivity();
  // 
  generator.make_output();

  // 
  // Modelisation of alpha rhythm
  //  - Utils::Biophysics::Jansen_Rit_1995
  //  - Utils::Biophysics::Wendling_2002
  //  - Utils::Biophysics::Molaee_Ardekani_Wendling_2009
  // 
  Utils::Biophysics::Brain_rhythm_models< Utils::Biophysics::Jansen_Rit_1995, 
					  /*solver_parameters->get_number_of_threads_()*/ 4 > 
    alpha;
  //
  alpha.modelization( parameters->get_files_path_output_() );
  alpha.output();


  //
  // Time log 
  timerLog->MarkEvent("Stop the process");
  std::cout << "Events log:" << *timerLog << std::endl;
 
  //
  //
  return EXIT_SUCCESS;
}

Production of the leadfield matrix

 * What is the leadfield matrix
 * Mathematics of the leadfield matrix
int main()
{
  //
  //
  Solver::PDE_solver_parameters* solver_parameters = Solver::PDE_solver_parameters::get_instance();
  // 
  solver_parameters->init();

  //
  // Physical models:
  //  - Source localization
  //    - Solver::SL_subtraction
  //    - Solver::SL_direct
  //  - Transcranial current stimulation
  //    - Solver::tCS_tDCS
  //    - Solver::tCS_tACS
  //  - Local conductivity estimation
  //    - Solver::tCS_tDCS_local_conductivity
  //
  // export OMP_NUM_THREADS=2
  Solver::Model_solver< /* physical model */ Solver::SL_subtraction,
		        /*solver_parameters->get_number_of_threads_()*/ 4 >  model;
  //
  std::cout << "Loop over solvers" << std::endl;
  model.solver_loop();
  model.XML_output();

  //
  //
  return EXIT_SUCCESS;
}

Alpha-rhythm simulated at the electrodes

  * load the leadfield matrix 
  * load the alpha_rhythm file
  * produce ...
int main()
{
  //
  //
  Solver::PDE_solver_parameters* solver_parameters = Solver::PDE_solver_parameters::get_instance();
  // 
  solver_parameters->init();


  // 
  // Simulation of alpha rhythm at the electrodes
  // 
  Utils::Biophysics::Device_model< Utils::Biophysics::EEG_simulation, 4 > eeg_simulation;
  eeg_simulation.alpha_rhythm_at_electrodes( solver_parameters->get_files_path_output_() );
  eeg_simulation.output();


  //
  //
  return EXIT_SUCCESS;
}

Impact of a tCS injection at the electrodes

 * Create electrode polarity
 * Produce tACS over a periode
 * electrodes_tACS.xml -> electrodes.xml
int main()
{
  //
  //
  Solver::PDE_solver_parameters* solver_parameters = Solver::PDE_solver_parameters::get_instance();
  // 
  solver_parameters->init();

  // 
  // tACS electrodes' setup
  std::vector< std::tuple<std::string, double> > positive_electrodes;
  positive_electrodes.push_back( std::make_tuple("T7", 0.00112 /*[A]*/) );
  //  positive_electrodes.push_back( std::make_tuple("FT7", 0.00112 /*[A]*/) );
  std::vector< std::tuple<std::string, double> > negative_electrodes;
  negative_electrodes.push_back( std::make_tuple("T8", -0.00112 / 4. /*[A]*/) );
  negative_electrodes.push_back( std::make_tuple("F8", -0.00112 / 4. /*[A]*/) );
  negative_electrodes.push_back( std::make_tuple("C4", -0.00112 / 4. /*[A]*/) );
  negative_electrodes.push_back( std::make_tuple("P8", -0.00112 / 4. /*[A]*/) );
  //  Electrodes::Electrodes_setup< Electrodes::Electrodes_tACS >
  Electrodes::Electrodes_tACS test_electrodes( positive_electrodes, negative_electrodes,
					       10 /*[Hz]*/, 0.0005 /*[A] Amplitude*/,
					       0.1 /*[s] elapse time*/, 
					       1. /*[s] starting time*/ );
  // 
  test_electrodes.output_XML("/home/cobigo/subjects/GazzDCS0004mgh_GPU4/fem/output/");
  
  //
  // Physical models:
  //  - Source localization
  //    - Solver::SL_subtraction
  //    - Solver::SL_direct
  //  - Transcranial current stimulation
  //    - Solver::tCS_tDCS
  //    - Solver::tCS_tACS
  //  - Local conductivity estimation
  //    - Solver::tCS_tDCS_local_conductivity
  //
  // export OMP_NUM_THREADS=2
  Solver::Model_solver< /* physical model */ Solver::tCS_tACS,
		        /*solver_parameters->get_number_of_threads_()*/ 4 >  model;
  //
  std::cout << "Loop over solvers" << std::endl;
  model.solver_loop();
  model.XML_output();

  // 
  // Simulation of alpha rhythm at the electrodes
  // 
  Utils::Biophysics::Device_model< Utils::Biophysics::EEG_simulation, 4 > eeg_simulation;
  eeg_simulation.alpha_rhythm_at_electrodes( solver_parameters->get_files_path_output_() );
  eeg_simulation.output();


  //
  //
  return EXIT_SUCCESS;
}