Neutrophils Core
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
- Follow the existing module structure
- Add comprehensive tests
- Update documentation
- Ensure backward compatibility
License
This project is licensed under the MIT License.
Metadata
Release files for neutrophils-core 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| neutrophils_core-0.1.1.tar.gz | 152.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| neutrophils_core-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 299.8 kB
Release files / neutrophils_core-0.1.1.tar.gz
| Download URL | neutrophils_core-0.1.1.tar.gz |
|---|---|
| Size | 152.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f318bb02f31443eaa580a651a5f085f8a2bafeb05a644ac5e0c5ccdd4332898
|
|
BLAKE2b-256 checksum How to use checksums |
9a1d3015d695e681d604a8c3f15b7e4cc40042d12783c96afdee818ed4324a47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Release files / neutrophils_core-0.1.1-py3-none-any.whl
| Download URL | neutrophils_core-0.1.1-py3-none-any.whl |
|---|---|
| Size | 147.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ab5ef31cef18ad20c8b4b1bf4ac3beaf6705495a9b9da2151a3b25b72da3897
|
|
BLAKE2b-256 checksum How to use checksums |
9f9f85c28720343f1d95f2ddefaf91cec9de7bf19c5b2e300d703ef59489c1dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|