Skip to content

CVD Risk Prediction API v1.0.0

Choose a tag to compare

@Moobbot Moobbot released this 08 May 04:56
· 6 commits to v.1.0.0 since this release
08b4db6

CVD Risk Prediction API v1.0.0

Overview

This release introduces the CVD Risk Prediction API, a FastAPI-based service that provides cardiovascular disease (CVD) risk prediction from DICOM images using the Tri2D-Net deep learning model.

Key Features

  • DICOM Processing: Upload and process DICOM images in ZIP format
  • Heart Detection: Automatic heart region detection using RetinaNet
  • Risk Prediction: CVD risk prediction using Tri2D-Net model
  • Visualization: Grad-CAM visualization of regions contributing to prediction
  • Attention Scoring: Analysis of attention scores for each image slice
  • REST API: Complete REST API with documentation

API Endpoints and Response Formats

POST /api_predict

Upload a ZIP file containing DICOM images for CVD risk prediction.

Response Format:

{
  "session_id": "uuid-string",
  "predictions": [
    {
      "score": 0.75  // CVD risk score between 0-1
    }
  ],
  "overlay_images": "http://server/download_zip/uuid-string",
  "attention_info": {
    "attention_scores": [
      {
        "file_name_pred": "pred_image1.png",
        "attention_score": 0.85
      }
    ],
    "total_images": 120,
    "returned_images": 45
  },
  "message": "Prediction successful."
}

GET /download_zip/{session_id}

Download a ZIP file containing visualization results.

Response:

  • Binary file (application/zip) containing Grad-CAM visualizations

GET /preview/{session_id}/{filename}

Preview a specific visualization image.

Response:

  • Image file (image/png) showing the requested visualization

Technical Details

  • Built with FastAPI for high-performance API endpoints
  • Integrates SimpleITK for medical image processing
  • Implements PyTorch-based deep learning models
  • Provides comprehensive logging and error handling
  • Includes automatic cleanup of temporary files

Installation

# Clone the repository
git clone https://github.com/your-username/cvd-risk-prediction.git

# Install dependencies
cd cvd-risk-prediction
python setup.py

Usage

# Start the API server
python api.py

API Documentation

Once running, API documentation is available at:

Model Information

The Tri2D-Net model is based on research published in Nature Communications.

License

This project is licensed under the MIT License - see the LICENSE file for details.