Skip to content

Latest commit

 

History

History
91 lines (66 loc) · 2.57 KB

README.md

File metadata and controls

91 lines (66 loc) · 2.57 KB

fidder

License PyPI Python Version CI codecov

fidder is a Python package for detecting and erasing gold fiducials in cryo-EM images.

Fiducials are detected using a pre-trained residual 2D U-Net at 8 Å/px. Segmented regions are replaced with white noise matching the local mean and global standard deviation of the image.

The package can be used from both Python and the command line.


Quickstart

Python

import mrcfile
import torch
from fidder.predict import predict_fiducial_mask
from fidder.erase import erase_masked_region

# load your image
image = torch.tensor(mrcfile.read('my_image_file.mrc'))

# use a pretrained model to predict a mask
mask, probabilities = predict_fiducial_mask(
    image, pixel_spacing=1.35, probability_threshold=0.5
)

# erase fiducials
erased_image = erase_masked_region(image=image, mask=mask)

Command Line

# predict fiducial mask
fidder predict \
--input-image example.mrc \
--probability-threshold 0.5 \
--output-mask mask.mrc

# erase masked region
fidder erase \
--input-image example.mrc \
--input-mask mask.mrc \
--output-image erased.mrc

Installation

pip:

pip install fidder

Compatibility

If trying to use an 10.X CUDA runtime you may have to install older versions of torch and pytorch-lightning, see teamtomo/fidder#17 for details.

Notes

This package provides similar functionality to BoxNet from Warp when retrained for gold fiducial segmentation.

This package was developed to make this functionality available in a standalone, easy to install Python package. The architecture and training data preprocessing are based on the description in the Warp paper.