Giter Site home page Giter Site logo

movea's Introduction

MOVEA: Multi-Objective Optimization via Evolutionary Algorithm for High-Definition Transcranial Electrical Stimulation of the Human Brain

Introduction

This repository contains the official implementation of the MOVEA algorithm for optimizing high-definition transcranial electrical stimulation (HD-tES) of the human brain. MOVEA is a multi-objective optimization approach that utilizes an evolutionary algorithm to find optimal stimulation parameters for a given target brain area. The code has been tested on a Linux system.

Dependencies

  • Linux
  • Python >= 3.8
  • To run the code, you need to have the following dependencies installed:
pip install geatpy nibabel nilearn

Quick Start

To get started, you can run the main.py script with the following command-line options:

  • -t: Stimulation method (e.g., tdcs, ti)
  • -m: Head model (e.g., hcp4)
  • -p: Target name or MNI coordinate (e.g., motor)
  • -g: Maximum epochs (default: 100)

You can customize the pool size in P_objective according to your device's specifications, facilitating a more expedited optimization process.

Input Data

The input consists of two parts: the lead field matrix file and the voxel position file. These files are used to calculate the electric field and to determine the voxel indices corresponding to MNI coordinates. You can create these files yourself or get them from an h5py file in the output folder of SimNIBS (tdcsleadfield) by running convert.ipynb. In this repository, we provide files for the HCP4 head model from the Human Connectome Project (HCP) dataset in release. Due to constraints related to the permissible file upload size, only a segment of the LFM for the EEG 10-10 is uploaded. You can adjust the number of channels to suit your specific data and electrode layout by altering the NUM_ELE parameter found in glo.py.

Output

The output files are located in the "Output" folder and 'pic' folder. The "fitness" file contains the results of the objectives, and the "in" file contains information about the montage and current. Each line represents a solution. The relationship between array indices and activated channels is specified in the "hcp4.csv" file. For TI, output will be four pairs of values, with each pair consisting of the first indicating intensity and the second indicating channel index. The Cz channel is the reference.

Example Command

Here is an example command to optimize the motor area for the HCP4 head model using the tTIS stimulation method:

python main.py -t ti -m hcp4 -p motor

You will get two files in the "Output" folder. In the first line of the "fitness" file, you may see values such as 1.972386587771203 1.819407772791436506e-01, which represent the two objectives defined in util.py. The first is the reciprocal of the ROI electric field, and the second is the mean of the whole brain electric field (V/m). In the first line of the "in" file, you may see values such as 46 1.0 2 -1.0 74 1.0 23 -1.0, indicating that the Cp2 channel (47th row in "hcp4.csv") injects 1 mA and so on. For HD-based methods, the currents for all channels are displayed.

Visualization

If you want to see the optimization effect, you can additionally specify the path of the m2m file:

  • -f: M2M file path
# example
python main.py -t ti -m hcp4 -p motor -f './data/m2m.nii.gz'

# your own m2m file
python main.py -t ti -m hcp4 -p motor -f '/path/to/your/m2m'

The electric field files and images will be outputted in the results folder.

Citation

If you find this code useful for your research, please consider citing the following paper: https://doi.org/10.48550/arXiv.2211.05658

Contact

We provide some results from the paper in 'others', for any questions or issues related to this implementation, please contact the authors.

movea's People

Contributors

ncclabsustech avatar onemore1 avatar tangchings avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.