A Lightweight, Modular, and Production-Ready Python Toolkit for Medical Imaging AI
MedXAI is an open-source Python library that simplifies the development of modern Medical Imaging Artificial Intelligence (Medical AI) applications. The library provides a carefully designed collection of reusable components for medical image preprocessing, segmentation evaluation, loss functions, radiomics analysis, explainable AI, and post-processing utilities.
The primary goal of MedXAI is to reduce the amount of boilerplate code researchers repeatedly implement across projects while promoting reproducibility, modularity, and clean software engineering practices.
Whether you are building a segmentation model for ultrasound, CT, MRI, retinal imaging, histopathology, or dermoscopy, MedXAI provides standardized implementations of commonly used algorithms so researchers can focus on model development instead of repeatedly rewriting utility code.
Unlike many research repositories that contain task-specific implementations, MedXAI is designed as a general-purpose toolkit that integrates naturally into existing PyTorch pipelines while remaining lightweight, dependency-conscious, and easy to extend.
The library emphasizes
- Reproducible research
- Modular software design
- High-performance implementations
- CPU and CUDA compatibility
- Clean APIs
- Easy integration into existing projects
- Research-friendly documentation
- Production-ready code quality
MedXAI provides a high-performance, end-to-end ecosystem designed for reproducible medical imaging research and production-grade clinical AI pipelines. Seamlessly integrated with PyTorch, NumPy, and scikit-image, the toolkit delivers GPU-accelerated spatial segmentation metrics, numerically stable hybrid loss functions (such as Dice-BCE and Focal Tversky), clinical-grade preprocessing, and automated post-processing utilities for boundary refinement. Additionally, it empowers advanced diagnostic workflows with vectorized radiomics feature extraction (GLCM and LBP), model-agnostic Explainable AI (Grad-CAM), epistemic uncertainty estimation, and memory-safe sliding-window inference for large multi-dimensional volumetric arrays.
medxai/
├── metrics/
├── losses/
├── preprocessing/
├── radiomics/
├── explain/
├── postprocessing/
├── models/
├── utils/
├── tests/
├── docs/
└── examples/
pip install medxaipip install git+https://github.com/aman0311x/medxai.gitgit clone https://github.com/aman0311x/medxai.git
cd medxai- Python 3.9+
- PyTorch
- NumPy
- OpenCV
- scikit-image
- matplotlib
Create a virtual environment.
python -m venv .venvActivate it.
source .venv/bin/activate.venv\Scripts\activateInstall MedXAI in editable mode.
pip install -e .Install development dependencies.
pip install -r requirements-dev.txtExecute all unit tests.
pytestRun with coverage.
pytest --cov=medxaiComprehensive documentation, API references, and tutorials are available in the docs/ directory.
Future online documentation will be available via GitHub Pages.
Upcoming releases aim to include
- MONAI interoperability
- 3D medical image support
- Transformer-based utilities
- Diffusion model utilities
- Vision-Language Model helpers
- Additional radiomics descriptors
- Medical foundation model interfaces
- DICOM utilities
- ONNX export
- Benchmark datasets
- More XAI algorithms
- Clinical evaluation metrics
We welcome contributions from researchers, students, clinicians, and open-source developers.
There are many ways you can contribute to MedXAI:
- Report bugs
- Improve documentation
- Suggest new features
- Improve existing implementations
- Add unit tests
- Optimize performance
- Add new Medical AI utilities
- Improve API consistency
- Fix typos
- Review pull requests
- Fork the repository.
- Create a new branch.
git checkout -b feature/my-feature- Commit your changes.
git commit -m "Add new feature"- Push your branch.
git push origin feature/my-feature- Open a Pull Request.
Please ensure that all new code
- follows PEP8
- includes documentation
- passes all tests
- maintains backward compatibility where possible
We appreciate every contribution, regardless of size.
Please be respectful and constructive when participating in discussions, reporting issues, or contributing code.
By participating in this project, you agree to foster a welcoming and inclusive community.
If you discover a security vulnerability, please do not create a public issue.
Instead, contact the maintainer directly so the issue can be responsibly addressed before public disclosure.
This project is distributed under the MIT License.
You are free to
- use
- modify
- distribute
- sublicense
- include in commercial projects
provided that the original copyright notice and license are retained.
See the LICENSE file for complete details.
If MedXAI contributes to your research, software, or publication, please cite the project.
@software{rahman2026medxai,
author = {Mohammad Amanour Rahman},
title = {MedXAI: A Lightweight Python Toolkit for Medical Imaging AI},
year = {2026},
publisher = {GitHub},
url = {https://github.com/aman0311x/medxai},
license = {MIT}
}If MedXAI has been useful in your research or projects, consider supporting the project by
⭐ Starring the repository
🐛 Reporting bugs
💡 Suggesting new features
📝 Improving documentation
🤝 Contributing code
📢 Sharing the project with the Medical AI community
Every contribution helps make MedXAI better for researchers worldwide.