Skip to content

brainstorm-tools/bst-duneuro

Repository files navigation

bst-duneuro

Integration between Brainstorm and Duneuro projects.

This project is a spin-off from brainstorm3, Brainstorm Toolbox's main repository. It is intended to be a place to store all the necesary tools and configuration files in order to recompile bst_duneuro. This application allows Brainstorm to compute FEM-based head models through duneuro project.

You can read about this whole integration here:

brainstorm-tools/brainstorm3#242

The first and full discussion regarding the FEM integration :

brainstorm-tools/brainstorm3#185

Download

Distribution within Brainstorm:

Release version

In the release version, this is, the version that will be downloaded by a Brainstorm Toolbox user, only the bin/ and the matlab/ folders will be saved. All other files and folders will be discarded since they are oriented towards development of the tool.

Development

Duneuro is based on Dune project, developed in C++, in a linux based OS. Thus, there is no windows version directly available. Windows binary application is built by cross-compiling with cygwin. Mac version is compiled with g++ in a MacOS.

During a typical compilation process, first the code will be downloaded from the Duneuro gitlab server. If the download fails, there is an arhchived copy of the code inside the config/ folder. The downloaded code will be saved in a newly created src/ folder. After some small modifications to the code are done, the building process will start and the result will be saved in another new folder named build_release_TARGET_OS where "TARGET_OS" will be "linux" or "windows". Finally, if the compilation went ok, the result binary application will be saved to the test/ folder with the date and time included in the name of the file. If the tests are good, you can manually copy the results to the bin/ folder and push updates to the repo.

In order to compile the application you will need a linux OS and follow these steps:

  1. Before starting, make sure your system is updated sudo apt-get update. Then install the necessary tools/packages for the compilation chain to work. In a new 18.04 lts ubuntu you will need the following packages:
sudo apt-get install git pkg-config cmake mingw-w64 g++-mingw-w64 libc6-dev-i386 python3-pip libeigen3-dev
  1. Clone this repository:
git clone https://github.com/brainstorm-tools/bst-duneuro.git
  1. We have developed a setup automatic script called setup_bst_duneuro.sh which is in the config folder. In order to use it, make sure the script is executable chmod +x setup_bst_duneuro.sh and run it.

The setup script is designed to go through the compilation steps even when the user's experience with C++, linux and development in general is scarce. Basically, you can execute config/setup_bst_duneuro.sh and it will show you different options and examples through its help message.

This whole chain has proven to work on a fresh/new Ubuntu instance, so we hope you don't find problems with your system, although we are not sure of how previous configurations with MINGW or other sw might possibly interact with this whole build process.

So, in order to do everything in a single command (download, configure, compile and copy the binary application files into bin/), execute:

cd config/
./setup_bst_duneuro.sh all

In case further development has to be made, you can delete previous builds with setup_bst_duneuro.sh clean or download the newest source code version before compiling with setup_bst_duneuro.sh download. You can also compile only one operating system by calling setup_bst_duneuro.sh build windows or setup_bst_duneuro.sh build linux.

Usual compilations times take about 15-20 minutes for each target operating system. If you want to test small modifications to your application and you don't want to compile the whole duneuro project in every iteration you can use the rebuild command. This way you will only build the specific part of duneuro which interacts directly with your application. For instance, in this case the module directly interacting with our app is duneuro-matlab. You can do:

setup_bst_duneuro.sh rebuild windows duneuro-matlab
setup_bst_duneuro.sh rebuild linux duneuro-matlab

or

setup_bst_duneuro.sh rebuild all duneuro-matlab

to rebuild both linux and window's applications.

Mac version

For Mac x64 version all you need to do is clone the repository, install boost, dpkg-config and gcc compiler, then use the same command as you would use for linux. Beware this is a intel-mac version, not a powerPc, thus, Mac earlier than 2006 will not run. Depending on your Mac installation you might have to install additional packages, like pyenv or pkg-config. Sometimes, you might have to install additional python packages, i.e. pip install virtualenv, but generally you will be able to follow instructions given by the Dune environment.

In a mac envoronment, the compiling instruction is setup_bst_duneuro.sh build linux, yes linux. Since the linux code builds more or less directly in the mac envoronment, the same instruction is kept to avoid further complexity. The resulting app will be copied as usual to the test/ folder. Typically that app can be manually renamed as a mac64 version binary and copied to the bin/ folder.

Comments on Matlab and mex file implementation.

If you have Matlab installed in your linux version and you plan to use Brainstorm in this system, you can take advantage of the possibility of building the application as a mex file which will decrease execution times and allow for more interaction between Matlab and duneuro.

In order to do this modify Matlab's path in config/config_release_linux.opts and modify src/duneuro-matlab/toto/CMakeLists.txt file in order to add a separate mex application.

Troubleshooting

Sometimes, depending on each linux installation, some of the libraries needed to run the application will be missing. In order to try to solve these issues, try installing:

sudo apt-get install libdune-common-dev libdune-geometry-dev libdune-grid-dev libdune-localfunctions-dev libdune-istl-dev libdune-typetree-dev libdune-uggrid-dev libdune-functions-dev libdune-pdelab-dev

About

Brainstorm-Duneuro integration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •