Metadata-Version: 2.4
Name: emfet
Version: 2.0.0
Summary: Patient-grouped, nested-CV-evaluated handcrafted feature extraction and classification for pre-cropped malaria cell images
Author: Supta Das Dip, Raka Moni
Author-email: Md Abdullah Al Kafi <kafi.cse@diu.edu.bd>
License: MIT
Project-URL: Homepage, https://github.com/abkafi1234/cell_image
Project-URL: Repository, https://github.com/abkafi1234/cell_image
Project-URL: Issues, https://github.com/abkafi1234/cell_image/issues
Keywords: malaria,cell classification,medical imaging,feature extraction,cross-validation,computer vision
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Healthcare Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Image Processing
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Operating System :: OS Independent
Requires-Python: <3.13,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy<2.0,>=1.24
Requires-Dist: opencv-python>=4.8
Requires-Dist: scikit-image>=0.21
Requires-Dist: scikit-learn>=1.1
Requires-Dist: scikit-optimize>=0.9
Requires-Dist: scipy>=1.10
Requires-Dist: pandas>=2.0
Requires-Dist: matplotlib>=3.7
Requires-Dist: joblib>=1.3
Requires-Dist: streamlit>=1.30
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: psutil>=5.9; extra == "dev"
Requires-Dist: tqdm>=4.65; extra == "dev"
Dynamic: license-file

# EMFET

**Research use only.** EMFET classifies individual, pre-cropped blood-cell images (from the
NIH malaria single-cell dataset or similarly structured data) as *Parasitized* or *Uninfected*
using a handcrafted 5-feature pipeline and a classical ML classifier. It does **not** detect
cells in a whole blood smear, estimate parasitemia, identify parasite species/stage, or produce
a patient-level diagnosis. It has not been validated as a clinical or diagnostic device.

## Install

```bash
pip install emfet
```

## Quick start: run the app

```bash
emfet
```

Launches the bundled Streamlit demonstration app in your browser — upload a pre-cropped cell
image, see the step-by-step feature-extraction pipeline, and get a prediction from the
bundled, pre-trained model. No separate model file or dataset needed to try it.

## Quick start: use the library

```python
from emfet.features import extract_features

features = extract_features("sample_cell.png")
# array([n_spots, max_spot_area, total_spot_area, spot_saturation, gray_std])
```

## What's in the package

- `emfet.app` / the `emfet` console command — a Streamlit demonstration app, bundled with a
  pre-trained model, launchable with zero setup.
- `emfet.features` — the feature-extraction pipeline (Gray World color normalization, adaptive
  spot detection, morphological cleaning, HSV saturation), driven by a `FeatureConfig` so every
  processing stage is a configuration, not a code fork.
- `emfet.data` — dataset loading and patient-ID resolution for patient-grouped evaluation
  (required to avoid patient-level leakage on datasets with multiple images per patient).
- `emfet.evaluate` — a patient-grouped nested cross-validation harness with a built-in
  leakage guard, a full diagnostic-metrics suite, a permutation significance test, and paired
  Wilcoxon comparisons for ablation studies.
- `emfet.ablation` — stage/feature ablations and classical baseline descriptors (color
  histogram, LBP, GLCM, HOG) for comparison under the identical evaluation protocol.
- `emfet.benchmark` — controlled latency/memory/CPU measurement, reporting model size, load
  memory, and peak inference memory as distinct, explicitly-labeled quantities.

## Labels

`Parasitized = 0`, `Uninfected = 1` (`emfet.data.LABEL_NAMES`). The positive class for every
metric in `emfet.evaluate` is `Parasitized` (`emfet.data.POSITIVE_CLASS`).

## Security note

Loading a pickled/joblib model executes arbitrary code during deserialization. Only load model
files from sources you trust.

## Full project, training/evaluation scripts, and reproducibility harness

This package is the importable library. The full research repository — CLI scripts for
patient-grouped nested cross-validation, ablation sweeps, benchmarking, a Streamlit
demonstration app, tests, and the manuscript this software accompanies — is at
<https://github.com/abkafi1234/cell_image>.

## License

MIT.
