Home

Awesome

LLSpy: Lattice light-sheet post-processing utility

license_shield python_shield travis_shield Documentation Status doi_shield

image

Copyright © 2019 Talley Lambert, Harvard Medical School.

LLSpy is a python library to facilitate lattice light sheet data processing. It extends the cudaDeconv binary created in the Betzig lab at Janelia Research Campus, adding features that auto-detect experimental parameters from the data folder structure and metadata (minimizing user input), auto-choose OTFs, perform image corrections and manipulations, and facilitate file handling. Full(er) documentation available at http://llspy.readthedocs.io/

There are three ways to use LLSpy:

1. Graphical User Interface

The GUI provides access to the majority of functionality in LLSpy. It includes a drag-and drop queue, visual progress indicator, and the ability to preview data processed with the current settings using the (awesome) 4D-viewer, Spimagine, and experimental support for napari.

LLSpy graphical interface

2. Command Line Interface

The command line interface can be used to process LLS data in a server environment (linux compatible).

$ lls --help

Usage: lls [OPTIONS] COMMAND [ARGS]...

  LLSpy

  This is the command line interface for the LLSpy library, to facilitate
  processing of lattice light sheet data using cudaDeconv and other tools.

Options:
  --version          Show the version and exit.
  -c, --config PATH  Config file to use instead of the system config.
  --debug
  -h, --help         Show this message and exit.

Commands:
  camera    Camera correction calibration
  clean     Delete LLSpy logs and preferences
  compress  Compression & decompression of LLSdir
  config    Manipulate the system configuration for LLSpy
  decon     Deskew and deconvolve data in LLSDIR.
  deskew    Deskewing only (no decon) of LLS data
  gui       Launch LLSpy Graphical User Interface
  info      Get info on an LLSDIR.
  install   Install cudaDeconv libraries and binaries
  reg       Channel registration

# process a dataset
$ lls decon --iters 8 --correctFlash /path/to/dataset

# change system or user-specific configuration
$ lls config --set otfDir path/to/PSF_and_OTFs

# or launch the gui
$ lls gui

3. Interactive data processing in a python console

>>> import llspy

# the LLSdir object contains most of the useful attributes and
# methods for interacting with a data folder containing LLS tiffs
>>> E = llspy.LLSdir('path/to/experiment_directory')
# it parses the settings file into a dict:
>>> E.settings
{'acq_mode': 'Z stack',
 'basename': 'cell1_Settings.txt',
 'camera': {'cam2name': '"Disabled"',
            'cycle': '0.01130',
            'cycleHz': '88.47 Hz',
            'exp': '0.01002',
    ...
}

# many important attributes are in the parameters dict
>>> E.parameters
{'angle': 31.5,
 'dx': 0.1019,
 'dz': 0.5,
 'nc': 2,
 'nt': 10,
 'nz': 65,
 'samplescan': True,
  ...
}

# and provides methods for processing the data
>>> E.autoprocess()

# the autoprocess method accepts many options as keyword aruguments
# a full list with descriptions can be seen here:
>>> llspy.printOptions()

              Name  Default                    Description
              ----  -------                    -----------
      correctFlash  False                      do Flash residual correction
flashCorrectTarget  cpu                        {"cpu", "cuda", "parallel"} for FlashCor
            nIters  10                         deconvolution iters
         mergeMIPs  True                       do MIP merge into single file (decon)
            otfDir  None                       directory to look in for PSFs/OTFs
            tRange  None                       time range to process (None means all)
            cRange  None                       channel range to process (None means all)
               ...  ...                        ...

# as well as file handling routines
>>> E.compress(compression='lbzip2')  # compress the raw data into .tar.(bz2|gz)
>>> E.decompress()  # decompress files for re-processing
>>> E.freeze()  # delete all processed data and compress raw data for long-term storage.

Note: The LLSpy API is currently unstable (subject to change). Look at the llspy.llsdir.LLSdir class as a starting point for most of the useful methods. Minimal documentation available in the docs. Feel free to fork this project on github and suggest changes or additions.

Requirements

Installation

  1. Install conda/mamba

  2. Launch a terminal window (Linux), or Miniforge Prompt (Windows)

  3. Install LLSpy into a new conda environment

    conda create -n llsenv python=3.11 cudadecon
    conda activate llsenv
    pip install llspy
    

    The create -n llsenv line creates a virtual environment. This is optional, but recommended as it easier to uninstall cleanly and prevents conflicts with any other python environments. If installing into a virtual environment, you must source the environment before proceeding, and each time before using llspy.

Each time you use the program, you will need to activate the virtual environment. The main command line interface is lls, and the gui can be launched with lls gui. You can create a bash script or batch file to autoload the environment and launch the program if desired.

# Launch Anaconda Prompt and type...
conda activate llsenv

# show the command line interface help menu
lls -h
# process a dataset
lls decon /path/to/dataset
# or launch the gui
lls gui

See complete usage notes in the documentation.

Features of LLSpy

Bug Reports, Feature requests, etc

Pull requests are welcome!

To report a bug or request a feature, please submit an issue on github

Please include the following in any bug reports:

The most system-dependent component (and the most likely to fail) is the OpenCL dependency for Spimagine. LLSpy will fall back gracefully to the built-in Qt-based viewer, but the Spimagine option will be will be unavailble and grayed out on the config tab in the GUI. Submit an issue on github for help.