carobellum / functional_atlas_explorer

Functional Atlas Explorer Project for Brainhack Western 2022

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Functional Atlas Explorer

The Functional Atlas Explorer was built during Western Brainhack 2022. It has two main features:

  1. On clicking on a cerebellar region, it shows the functions that this region is involved in.
  2. On clicking on a cerebellar region, it shows the functional connectivity of this region with the neocortex.

These features are currently running for the cerebellum (showing connectivity with the neocortex), although the atlas explorer could be extended to other brain regions.

🏆 Thank you to Brainhack Western for awarding us the Open Science Award for this project! 🏆

Exploring Functions

To run the word cloud app:

  • Run python flatmap_app_click_WC.py
  • In your preferred browser, open the server link that is displayed (usually http://127.0.0.1:8050).
  • Click on a region in the cerebellum and the word cloud of functions will pop up.
  • Change the dataset from which you would like to see the functions displayed in the drop-down menu.

Functional_App

Exploring Connectivity

To run the connectivity app:

  • Run python flatmap_app_clickable_connectivity.py
  • Open the server link that is displayed (usually http://127.0.0.1:8050).
  • Click on a region in the cerebellum and the cortical map will show cortical regions that are functionally connected to this cerebellar region.
  • The app will also display the 3 most highly activated task conditions from the cerebellar region for a chosen dataset (change the dataset in the drop-down menu).

Connectivity_App

Installation

These instructions were written for the Brainhack Project Participants with little to no coding experience, hence the detailed instructions. But they still work for getting the app to run.

  1. Clone this repository. git clone https://github.com/carobellum/functional_atlas_explorer.git

  2. Navigate to the repository (cd /path/to/your/repository/cone/functional_atlas_explorer) and make a new environment. python -m venv env

  3. Activate your new environment. source env/bin/activate

  4. Install the packages that we need for this project. pip install pandas numpy scipy nibabel SUITPy matplotlib seaborn pickle5 ipykernel neuroimagingtools ipykernel torch nilearn dash jupyter-dash dash_boostrap_components

  5. You might have to update your nbformat package (this might only be the case for some of you), so to be sure run pip install --upgrade nbformat

  6. Clone the surfAnalysisPy repository and add it to your PYTHONPATH so that Python finds it. Run git clone https://github.com/DiedrichsenLab/surfAnalysisPy.git.

Done! Now try running the cells in the jupyter notebook brainhack_example.ipynb and explore the plots. Try to understand what the code is doing and what you see in the plots. On Day 2, we are going to work on making integrative plots of the functional profiles of the voxels!

Let me know if you ran into any errors and we will fix them together :)

Troubleshooting

If you run into errors, there is a few things to check before looking further:

  • Are you running your python code in the correct environment?
    • Did you activate the environment for your terminal only, but your jupyter notebook is not using your environment? Depending on which code editor you use (I prefer VSCode), you will have to look in different places. For VSCode, have a look here.
  • Did you install all of the packages in step 4? Did you install them into the correct environment?

Getting started with dash

Have a look at the scripts starting with app.

tutorials/app.py Tutorial

tutorials/app_hover.py Tutorial

tutorials/app_tooltip.py Tutorial

More Dash Tutorials can be found here.

These are example scripts taken from the Plotly Dash Guide. Try playing around with these and understanding the code, particularly of app_tooltip.py - this is pretty close to what we want to build!

Links

Have a look at the cerebellar atlas viewer to see an example of an interactive visualisation tool.

We will be working with plotly to get our interactive functional atlas explorer running. Check out this chapter of the plotly guide that covers interactive graphing.

About

Functional Atlas Explorer Project for Brainhack Western 2022

License:MIT License


Languages

Language:Jupyter Notebook 98.7%Language:Python 1.3%Language:CSS 0.0%