Skip to main content

Core library for neutrophils classification with unified 2D/3D model interface

Project description

Neutrophils Core

CI Pipeline Python 3.8+ License: MIT

A shared library for neutrophil classification providing unified interfaces for both 2D and 3D model inference, data preprocessing, and common utilities.

Overview

This package serves as the core shared library between:

  • The main neutrophils training repository
  • The neutrophils classifier frontend app

Features

  • Unified Model Interface: Support for both 2D and 3D neutrophil classification models
  • Data Preprocessing: Image augmentations, 3D→2D MIP projections, and normalization
  • Configuration Management: Unified configuration loading and validation
  • Metrics & Loss Functions: Comprehensive evaluation metrics and loss functions
  • Utilities: Image I/O, tracking, and visualization tools

Installation

As a Git Submodule

# Add as submodule to your project
git submodule add https://github.com/bpi-oxford/neutrophils-core.git

# Initialize and update
git submodule update --init --recursive

Development Installation

# Clone the repository
git clone https://github.com/bpi-oxford/neutrophils-core.git
cd neutrophils-core

# Install in development mode
pip install -e .

Quick Start

Unified Model Interface

from neutrophils_core.models import Classifier

# Auto-detect model type (2D/3D)
classifier = Classifier(model_path='path/to/model')
prediction = classifier.predict(input_data)

# Explicit 3D model with 2D MIP option
classifier = Classifier(model_type='3d', model_path='path/to/3d/model')
prediction = classifier.predict(image_3d, return_2d_mip=True)

Data Preprocessing

from neutrophils_core.preprocessing import load_image, create_mip_projection
from neutrophils_core.preprocessing.augmentations_2d import random_flip_2d

# Load and preprocess image
image = load_image('path/to/image.tiff')
mip_2d = create_mip_projection(image)
augmented = random_flip_2d(mip_2d)

Configuration Management

from neutrophils_core.config import ConfigManager

config = ConfigManager.load_config('path/to/config.toml')
model_config = config.get_model_config()

Architecture

neutrophils_core/
├── models/              # Unified model interface and loading
├── preprocessing/       # Data preprocessing and augmentations
├── config/             # Configuration management
├── metrics/            # Evaluation metrics and loss functions
└── utils/              # Common utilities

Development

Status Badges

The badges above show:

  • CI Pipeline: Status of automated testing
  • Python 3.8+: Supported Python versions
  • License: MIT License

Running Tests

pytest tests/

Adding New Features

  1. Follow the existing module structure
  2. Add comprehensive tests
  3. Update documentation
  4. Ensure backward compatibility

License

This project is licensed under the MIT License.

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

neutrophils_core-0.1.0.tar.gz (148.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neutrophils_core-0.1.0-py3-none-any.whl (147.3 kB view details)

Uploaded Python 3

File details

Details for the file neutrophils_core-0.1.0.tar.gz.

File metadata

  • Download URL: neutrophils_core-0.1.0.tar.gz
  • Upload date:
  • Size: 148.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for neutrophils_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1123e0fd0b5483979f083df38d1f6b25f3800b0e2ff0ed94be985e5a5eae53ad
MD5 fd8b31fd23b2c0a02bcc3e9d58484133
BLAKE2b-256 8fa59c973d6f9868f234d7ef92cd853145704e79e27ff9970e8e48088cab8577

See more details on using hashes here.

File details

Details for the file neutrophils_core-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for neutrophils_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e06b414d120ae0d9deaa259f850f04dd39aab74be71c2cf1a3792d9f5a868c10
MD5 4ffc60ce0910ca354999394ba4f4396d
BLAKE2b-256 5dde1ebce6bf1faef9ed51163e587ab5c0c1b1d2d3943f1cb762460a2ace2605

See more details on using hashes here.

Supported by

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