Skip to content

Latest commit

 

History

History

developers

BRAPH 2.0 — For Developers

Welcome to the BRAPH 2.0 development guide!

This section provides instructions and examples for developers who want to extend and enhance BRAPH 2.0 with new functionalities. Whether you want to adapt existing pipelines, modify example scripts, or implement completely new features, this guide will walk you through the different levels of complexity in BRAPH 2.0 development.

The software architecture of BRAPH 2.0 provides a clear structure for developers to understand and extend its functionalities. All objects in BRAPH 2.0 are derived from a base object called Element. The core code includes the compiler (genesis), the essential source code (src), and the GUI functionalities (gui). Developers can easily add new elements such as brain surfaces, atlases, example scripts, GUI pipelines, graphs, measures, data types, data importers, data exporters, and analyses. By writing new elements and recompiling the code, the new elements and their functionalities are immediately integrated into the GUI.

BRAPH 2.0 software architecture

BRAPH 2.0 software architecture. Directory structure of BRAPH 2.0 GENESIS (left) and BRAPH 2.0 (right). All objects are derived from a base object called Element and written in a simplified pseudocode (files *.gen.m) that is compiled into the actual elements (files *.m) by the command braph2genesis (some examples of these elements are shown). The compiled code can be launched by the command braph2. The core of BRAPH 2.0 (gray shaded area) includes the compiler (genesis), the essential source code (src), and the essential functionalities for the GUI (gui, yellow-shaded area). The users can easily add new brain surfaces (brainsurfs), atlases (atlases), example scripts and GUI pipelines (in the corresponding folder under pipelines). Furthermore, the users can add new elements such as new graphs (e.g., GraphWU in graphs), measures (e.g., Strength in measures), data types (e.g., SubjectCON in pipelines/connectivity), data importers (e.g., ImporterGroupSubjectCON_XLS in pipelines/connectivity), data exporters (e.g., ExporterGroupSubjectCON_XLS in pipelines/connectivity), and analyses (e.g., AnalyzeEnsemble_CON_WU in pipelines/connectivity) by writing new elements and recompiling the whole code: the new elements and their functionalities will be immediately available also in the GUI. Finally, BRAPH 2.0 is provided with a set of unit tests (executable by the command test_braph2) that ensure the formal correctness of the code, including that of any newly added elements.

Adapting a Pipeline Script

The simplest way to customize BRAPH 2.0 is by modifying a .braph2 pipeline script. This permits one to define parameters and adjust the analysis steps according to their specific requirements. The Developer Tutorial to Adapt a Pipeline Script provides guidance on adapting pipeline scripts.

Editing an Example Script

Developers can also edit the example scripts provided with the software to have more control over the analysis workflow and leverage parallel computing for faster calculations. For example, these scripts can be used to run calculations on a cluster. The developer tutorial Developer Tutorial to Adapt an Example Script demonstrates how to modify example scripts.

Expanding BRAPH 2.0 with New Functionalities

BRAPH 2.0's object-oriented programming architecture makes it easy to expand its capabilities by introducing new elements and features. An overview of the software architecture can be found in General Developer Tutorial for BRAPH 2.0

Here are some of the specific ways you can extend BRAPH 2.0:

Expanding BRAPH 2.0 with New Graphical Elements

BRAPH 2.0's object-oriented programming architecture also simplifies the process of designing your own panels to visualize new properties and figures. Here are some ways by which you can expand the graphical capabilities of BRAPH 2.0:

These tutorials provide step-by-step instructions and examples to guide developers in expanding BRAPH 2.0 with new functionalities and graphical elements. We encourage developers to contribute to the growth and improvement of BRAPH 2.0 by introducing new elements, measures, and analyses. Feel free to share your implementations, ask questions, and engage with the BRAPH community through the BRAPH forum and GitHub page.

Happy developing!