Skip to main content

PyPI Downloads Python 3.11+ License: MIT PyPI version DOI Code style: black Tests codecov Documentation Documentation Status

cryoblob

cryoblob is a JAX-based, JIT-compiled, scalable package for detection of amorphous blobs in low SNR cryo-EM images. It provides both traditional circular blob detection and advanced multi-method detection for complex morphologies including elongated objects and overlapping structures.

Features

  • JAX-powered: Leverages JAX for high-performance computing with automatic differentiation
  • GPU acceleration: Can utilize both CPUs and GPUs for processing
  • Multi-method detection: Advanced detection algorithms for diverse blob morphologies:
    • Traditional LoG: Excellent for circular blobs
    • Ridge detection: Specialized for elongated (pill-shaped) objects
    • Watershed segmentation: Separates overlapping circular structures
    • Hessian-based detection: Superior boundary localization
  • Adaptive filtering: Includes adaptive Wiener filtering and thresholding
  • Batch processing: Memory-optimized batch processing for large datasets
  • Validation: Comprehensive parameter validation using Pydantic models

Installation

pip install cryoblob

Quick Start

Basic Blob Detection

import cryoblob as cb

# Load an MRC file
mrc_image = cb.load_mrc("your_file.mrc")

# Traditional circular blob detection
blobs = cb.blob_list_log(mrc_image)

# Process a folder of images
results = cb.folder_blobs("path/to/folder/")

# Plot results
cb.plot_mrc(mrc_image)

Enhanced Multi-Method Detection

# For complex scenarios with multiple blob types
circular, elongated, overlapping = cb.enhanced_blob_detection(
    mrc_image,
    use_ridge_detection=True,    # Detect elongated objects
    use_watershed=True           # Separate overlapping blobs
)

print(f"Found {len(circular)} circular, {len(elongated)} elongated, "
      f"and {len(overlapping)} overlapping blobs")

Specialized Detection

from cryoblob.valid import (create_elongated_objects_pipeline, 
                           create_overlapping_blobs_pipeline,
                           create_comprehensive_pipeline)

# For elongated (pill-shaped) objects
config = create_elongated_objects_pipeline()
_, elongated_blobs, _ = cb.enhanced_blob_detection(mrc_image, **config.to_enhanced_kwargs())

# For overlapping circular structures  
config = create_overlapping_blobs_pipeline()
circular, _, separated_blobs = cb.enhanced_blob_detection(mrc_image, **config.to_enhanced_kwargs())

# For comprehensive analysis (all methods)
config = create_comprehensive_pipeline()
all_results = cb.enhanced_blob_detection(mrc_image, **config.to_enhanced_kwargs())

Detection Methods

Blob Type Method Best For Key Function
Circular LoG Standard round particles blob_list_log()
Elongated Ridge Detection Pill-shaped, rod-like objects ridge_detection()
Overlapping Watershed Touching circular structures watershed_segmentation()
Mixed/Complex Enhanced Detection Multiple morphologies enhanced_blob_detection()

Package Structure

The cryoblob package is organized into the following modules:

  • adapt: Adaptive image processing with gradient descent optimization
  • blobs: Core blob detection algorithms and preprocessing
  • files: File I/O operations and batch processing
  • image: Basic image processing functions (filtering, resizing, etc.)
  • multi: Multi-method detection for elongated objects and overlapping blobs
  • plots: Visualization functions for MRC images and results
  • types: Type definitions and PyTree structures
  • valid: Parameter validation using Pydantic models

Use Cases

Standard Cryo-EM Particles

# Traditional circular blob detection
blobs = cb.blob_list_log(mrc_image, min_blob_size=5, max_blob_size=20)

Elongated Biological Structures

# Detect pill-shaped, rod-like, or filamentous objects
_, elongated, _ = cb.enhanced_blob_detection(
    mrc_image, use_ridge_detection=True, use_watershed=False
)

Overlapping or Touching Particles

# Separate overlapping circular structures
_, _, separated = cb.enhanced_blob_detection(
    mrc_image, use_ridge_detection=False, use_watershed=True
)

Complex Heterogeneous Samples

# Comprehensive analysis for mixed morphologies
circular, elongated, overlapping = cb.enhanced_blob_detection(
    mrc_image, use_ridge_detection=True, use_watershed=True
)

Performance

  • Memory Efficient: Automatic batch size optimization and memory management
  • Scalable: Multi-device and multi-host processing support
  • Fast: JIT compilation and GPU acceleration where available
  • Flexible: Selective method usage to optimize speed vs. comprehensiveness

Package Organization

  • The codes are located in /src/cryoblob/
  • The notebooks are located in /tutorials/

Documentation

For detailed API documentation and tutorials, visit: https://cryoblob.readthedocs.io

License

This project is licensed under the MIT License - see the LICENSE file for details.

Authors

Metadata

Release files for cryoblob 2025.8.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cryoblob 2025.8.2
File Size Uploaded Provenance Actions
cryoblob-2025.8.2.tar.gz 39.3 kB Without provenance Details for cryoblob-2025.8.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cryoblob 2025.8.2
File Interpreter ABI Platform Actions
cryoblob-2025.8.2-py3-none-any.whl Python 3 none any Details for cryoblob-2025.8.2-py3-none-any.whl

Total release size: 87.8 kB

Release files / cryoblob-2025.8.2.tar.gz

Download URL cryoblob-2025.8.2.tar.gz
Size 39.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7815e7b1110c3626b4bc071038e0ea1f6588ac828ff5fa5e933f37f0b990fd49
BLAKE2b-256 checksum
How to use checksums
b4c0b7f0417be97231f8a4b151db699451be47585b88b70b9348c98dec598516
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.11

Release files / cryoblob-2025.8.2-py3-none-any.whl

Download URL cryoblob-2025.8.2-py3-none-any.whl
Size 48.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1329365e0e398a19938e311b637d110a3b21f88dc1aa95d97b0e52652e0f50e6
BLAKE2b-256 checksum
How to use checksums
c567d8cc2d64f16ecef1fc545177a5572f2cfd4f1bb92bfc041d06e1fc7738be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.11

Security for cryoblob 2025.8.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page