CellArchLab / slabify-et

A CLI tool to segment the lamella slab in cryo-ET volumes
BSD 3-Clause "New" or "Revised" License
6 stars 1 forks source link

Slabify

A CLI tool to automatically segment the lamella slab in cryo-ET volumes

DOI slabify

Overview

Slabify is a Python command-line tool to automatically segment the lamella slab from cellular cryo-electron tomography (cryo-ET) volumes. The program analyzes the local variance around random points inside the tomogram to find where the "interesting" density is. There are three modes of operation:

  1. Find the lamella boundaries by fitting two planes to the top and bottom sides of the slab iteratively (default).
  2. Fit a single plane through the center of the lamella, then expand a slab mask of the given --thickness in Z. This mode is enabled by the --simple flag, and tends to work better in "difficult" cases.
  3. If all else fails, you can still manually define the lamella boundaries by clicking a few points (12, to be precise) in IMOD and have slabify fit two planes defining the top and bottom sides of the slab. See instructions for details.

The first two modes employ robust fitting through the RANSAC algorithm to prevent outliers from perturbing the boundary estimation too much.

Applications

A lamella slab mask can be useful in different scenarios when processing cellular cryo-ET data, for example:

Installation

  1. Create a conda environment (or use an existing one if you prefer):
    conda create -n slabify python=3.12
  2. Activate the environment:
    conda activate slabify
  3. Clone the repo and install Slabify using pip:
    git clone https://github.com/CellArchLab/slabify-et.git
    cd slabify-et
    pip install .

    Now, you should be able to run the slabify command.

Optional dependencies

Usage

Using Slabify is straightforward:

slabify --input tomogram.mrc --output tomogram_slab_mask.mrc

You may want to turn a few knobs to fine tune your results of course. Type slabify --help to see all options. See also the FAQ below.

FAQ

What tomogram dimensions are good for Slabify?

The following tomogram sizes have been tested:

Anything in this range of tomogram dimensions and pixel sizes should work well. The --boxsize and --n-samples options might need to be adjusted if you have something very different.

What kind of filtering should I apply to my tomograms?

While Slabify should work on any tomogram, high-contrast and "clean" tomos tend to give the best results. These can be obtained by applying a denoising tool such as cryoCARE, IsoNet or DeepDeWedge to your data before running Slabify. For a quicker alternative, the deconvolution filter from Warp also works well for our purposes. See here how to apply it using IMOD.

The estimated slab is too thin, how can I improve it?

It is known that Slabify can be quite conservative in its estimation of the lamella boundaries. There are a few tips you can try to get thicker slab masks:

Acknowledgments

The manual boundary masking is based on code from Will Wan for STOPGAP. Thanks to Caitie McCafferty and Philippe Van der Stappen for discussions and feature suggestions.