Software Development

Design Philosophy

Tools designed in the STIM Lab follow a general set of rules designed to optimize their use in future lab projects as well as their usability to outside research groups. In general:

  • Major algorithms are coded in C++ as classes and functions under the stim namespace. These algorithms are available in the stimlib repository, which is comprised of a series of header files designed be included in more general applications.
  • Various software tools are optimized for use in our lab, often providing a command-line interface. These tools use algorithms available in the stimlib repository, but are optimized for our own workflow. Source code and executables are generally available through our Git repository or software page.
  • Prototyping and scripting are generally done with Python.

Development Tools

The following section includes a list of development tools that are frequently used, along with some of the best tutorials and advice that we have found for using them.

Git

Source code is managed using a Git repository, and developers are expected to make regular commits.

CMake

We use CMake as a build system in order to generate cross-platform applications where possible. Good tutorials on CMake are difficult to find, so my recommendation is to look at CMakeLists.txt files available in our public repositories and use those to model your own CMake files.

Python

Python is commonly used as a scripting language to "glue" together various command-line applications that we have developed. It is also useful as an alternative to Matlab using both NumPy and SciPy.

C/C++ Development

C/C++ Libraries

This section includes a list of libraries that are commonly used in STIM Lab code. All of these are available in most Linux repositories (I use Ubuntu's apt-get). All will require some amount of stress to get working in Windows (the source of this stress changes from release-to-release so I can't really write a tutorial).

 Setting up your workstation

I recommend the following configuration for any system that you use for development:

  • Create a /source directory, which will contain separate directories containing the source code for each application. This is where you will pull any repositories that you are contributing to.
  • Clone the stimlib repository to your source directory and point the STIMLIB_PATH environment variable to this directory.
  • Create a /build directory, which will contain a separate directory for each build configuration.
    • I generally name each directory with a "-bld" suffix. For example, the hsiproc source code will be kept in /source/hsiproc and the build configuration (*.sln files, etc.) will be generated by CMake in the /build/hsiproc-bld directory. This suffix makes it easier to differentiate between the two when you have a file browser window open.
  • Create a /bin directory containing hard symbolic links to executable files in your build directory. For example, this directory will contain a hard link called hsiproc pointing to the hsiproc executable (in Windows, this will be /build/hsiproc-bld/Release/hsiproc.exe).
  • Put the /bin directory on your personal PATH. This will allow you to run all of your compiled code from anywhere using a command window.
  • For Windows systems, use ConEmu, or some other console emulator. The standard Windows console sucks.

Clone and build the following repositories to make sure everything is working correctly:

Comments are closed