Installation#

  • Please send questions/issues to danrijs@stanford.edu, so we can improve UNRAVEL and/or its documentation

  • If you are new to the terminal, please see the start of the UNRAVEL guide

TL;DR on Installation#

  • Activate a virtual environment in Python

# Installing UNRAVEL
git clone https://github.com/b-heifets/UNRAVEL.git
cd UNRAVEL
pip install -e .

# Updating UNRAVEL
git pull 
pip install -e . 
  • Confirm that installation worked by running:

unravel_commands -c  # or run: uc -c
# This should print common UNRAVEL commands

# For more info, run
uc -h 
  • Download atlas/template files

  • Required software:

    • FSL for voxel-wise stats, CLI tools, and viewing .nii.gz images with FSLeyes

      • See below on setting this up by adding lines to a terminal configuration file (e.g., .bashrc or .zshrc)

      • Extra steps are required for Windows

    • Ilastik for segmenting features of interest

      • See below for .bashrc configuration

  • Recommended software:

TL;DR on Getting Started#

  • Review the UNRAVEL guide for analysis steps.

  • Add raw stitched LSFM data into sample?? folders (e.g., sample01, sample02, …).

  • Try out the command utils_get_samples to test out batch processing of sample?? folders.

  • The first command in the workflow is io_metadata.

  • Each command has a help guide with inputs, outputs, next steps, etc.

  • For example, run io_metadata -h to get started.


Installing UNRAVEL on Linux or WSL#

Running Linux Applications in WSL#

If you install graphical applications like FSL (which includes FSLeyes) or Ilastik for Linux in WSL, the graphical user interface may not work out of the box.

  • Option 1: Install the Windows versions of these tools for GUI support (the linux versions could still be used for headless processing via commands in WSL)

  • Option 2: Set up a graphical server, such as VcXsrv, to enable GUIs for Linux applications running in WSL.

  1. Open a terminal

  2. Install venv, pyenv, conda, or other tool(s) to manage Python versions and create a virtual environment:

  1. Install UNRAVEL

    • With your virtual environment active, follow these steps to install UNRAVEL

    • This is allows for editing source code and incremental updates.

    cd <path>  # Insert path to where you want to clone the GitHub repository
    
    git clone https://github.com/b-heifets/UNRAVEL.git  # Code from the main branch is downloaded
    
    cd UNRAVEL
    
    pip install -e .  # This installs python dependencies and sets up commands (both defined in pyproject.toml)
    

    Option B: Install UNRAVEL via PyPI and use it as-is

    pip install heifetslab-unravel
    
  2. Download atlas/template files:

    • Google Drive Link

    • We use a 30 µm version of the mouse Allen brain atlas (CCFv3 with 2020 region labels): atlas_CCFv3_2020_30um.nii.gz

    • The left hemisphere region labels/IDs are increased by 20,000 in this version: atlas_CCFv3_2020_30um_split.nii.gz

    • For registeration with iDISCO/LSFM data, use this iDISCO_template_CCFv3_30um.nii.gz (we warped the Gubra atlas to CCFv3 space and refined alignment)

    • For registeration with serial 2P data, use: average_template_CCFv3_30um.nii.gz

    • This binary brain mask can be used for 3D brain models: mask_CCFv3_2020_30um.nii.gz

    • Use a template that matches your tissue, along with a mask that includes only regions of interest.

  3. Install Ilastik:

  4. Install FSL:

    • Follow the installation instructions from the FSL website.

    • FSL includes FSLeyes, which is useful for visualizing data in atlas space and with colored wireframe atlas.

    • Some scripts depend on FSL.

    • FSL has several command line tools (e.g., fslmaths, fslstats, fslroi, fslcpgeom) that are useful for working with .nii.gz images.

  5. Optional: Install 3D Slicer

    • 3D Slicer installation

    • This is useful for improving registration by making the autofluo tissue better match the average template (e.g., digitally trimming or adding tissue)

  6. Confirm that the installation worked

    unravel_commands -c 
    
  7. Edit .bashrc or .zshrc to set up dependencies

    • Add the following to your .bashrc or .zshrc shell configuration file, and change /usr/local/ to the path where FSL and Ilastik are installed:

    export PATH=$PATH:/usr/local/fsl/bin  # Update the path to FSL's binary folder
    export FSLDIR=/usr/local/fsl  # Update the path to where FSL was installed
    PATH=${FSLDIR}/bin:${PATH}
    . ${FSLDIR}/etc/fslconf/fsl.sh
    export FSLDIR PATH
    
    export PATH=/usr/local/ilastik-1.4.0.post1-Linux:$PATH  # Update the path and version
    
    • Apply the changes by restarting the terminal or source your shell configuration file:

    . ~/.bashrc
    
  8. Update scripts periodically:

    Hint

    Note the release/version and/or backup code before updating for reproducibility

    Option A. Updating UNRAVEL if installed via GitHub:

    cd <path/to/UNRAVEL>
    git pull  # This will update the local repo, pulling the latest code from the main branch
    pip install -e .  # This will update commands and install new dependencies
    

    Option B. Updating UNRAVEL if installed via PyPI:

    pip install --upgrade heifetslab-unravel
    
    # Check the installed version of UNRAVEL
    pip show heifetslab-unravel
    

    To check the latest version, go to the heifetslab-unravel PyPI page


Checking UNRAVEL Version Changes#


Viewing Images:#

  • For full-resolution LSFM images, use Fiji or napari.

  • NIfTI images (.nii.gz) are commonly used in neuroimaging analysis.

    • They compress well when the images are ~small or if there are many voxels with an intensity of zero.

    • They can be viewed with Fiji, napari, or neuroimaging viewers (e.g., FSLeyes or 3D Slicer).

    • Fiji needs the nifti_io plugin

    • Napari needs the napari-nifti plugin

    • FSLeyes is great for viewing the atlas_CCFv3_2020_30um.nii.gz and matching images; however, it does not work for the 10 µm atlas and larger images.

    • For larger .nii.gz images, use 3D Slicer, ITK-SNAP, Fiji, or napari

  • .zarr images are useful for fast compression of large images with lots of non-zero voxels (e.g., raw LSFM data)


Get Started With Analysis#

UNRAVEL guide