Core library for neutrophils classification with unified 2D/3D model interface
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neutrophils_core-0.1.1.tar.gz.
File metadata
- Download URL: neutrophils_core-0.1.1.tar.gz
- Upload date:
- Size: 152.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f318bb02f31443eaa580a651a5f085f8a2bafeb05a644ac5e0c5ccdd4332898
|
|
| MD5 |
cd6fb2452e68176e967a4b2649334884
|
|
| BLAKE2b-256 |
9a1d3015d695e681d604a8c3f15b7e4cc40042d12783c96afdee818ed4324a47
|
File details
Details for the file neutrophils_core-0.1.1-py3-none-any.whl.
File metadata
- Download URL: neutrophils_core-0.1.1-py3-none-any.whl
- Upload date:
- Size: 147.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ab5ef31cef18ad20c8b4b1bf4ac3beaf6705495a9b9da2151a3b25b72da3897
|
|
| MD5 |
67c5254fdfc9a66857e29ed9084ee643
|
|
| BLAKE2b-256 |
9f9f85c28720343f1d95f2ddefaf91cec9de7bf19c5b2e300d703ef59489c1dd
|