Skip to main content

U-Net for 2D fiducial segmentation in cryo-EM

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fidder-0.0.7.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

fidder-0.0.7-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

Details for the file fidder-0.0.7.tar.gz.

File metadata

  • Download URL: fidder-0.0.7.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for fidder-0.0.7.tar.gz
Algorithm Hash digest
SHA256 e8ab9cc7fee83252a79aed3470f71212b7f53846f658705414186a4fe146f874
MD5 4223574c553f87910290e2c6852f857f
BLAKE2b-256 248ee77a074ad128dd2a8af07e2cbb5a53d1a5c76e60374fbe0a7355b61142dc

See more details on using hashes here.

File details

Details for the file fidder-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: fidder-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for fidder-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5934203ddf01e6e0dec1cf420490834e01f1ed7bbcc176f8ed61de489f4e5385
MD5 3c095788582145c0b34ec9ae23278ab7
BLAKE2b-256 2b387e462fc21f1764913318ec4d48f56f932475436a7f14909336c6c06b8e3c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page