Skip to main content

Quick Start Guide

This guide will help you launch DigiPathAI and perform your first whole slide image segmentation.

Prerequisites

Before starting, ensure you have:
  • DigiPathAI installed (see Installation)
  • At least one WSI file in a supported format (TIFF, SVS, MRXS, NDPI, etc.)
  • For AI segmentation: GPU dependencies installed via pip install "DigiPathAI[gpu]"

Launch the Server

1

Navigate to Your Slides Directory

Open a terminal and navigate to the directory containing your whole slide images:
cd /path/to/your/slides
DigiPathAI will serve all WSI files in the current directory and subdirectories. Organize your slides accordingly.
2

Start the DigiPathAI Server

Launch the server with the digipathai command:
digipathai localhost 8080
Command syntax:
digipathai <host> <port>
  • host: IP address to bind to (default: localhost or 127.0.0.1)
  • port: Port number to listen on (default: 8080)
# Accessible only from your machine
digipathai localhost 8080
The server runs in viewer-only mode by default if GPU dependencies are not installed. To explicitly disable segmentation features, use the --viewer-only flag.
3

Open the Web Interface

Open your web browser and navigate to:
http://localhost:8080
You should see the DigiPathAI file browser listing all available WSI files in your directory.
4

View a Whole Slide Image

Click on any WSI file in the browser to open the interactive viewer. You can:
  • Pan: Click and drag to move around the image
  • Zoom: Use mouse wheel or zoom controls
  • Navigate: Use the navigation pane in the corner
The viewer uses DeepZoom technology for smooth, responsive navigation of gigapixel images.

Running Segmentation

DigiPathAI provides two ways to perform AI-powered tissue segmentation:

Method 1: Through the Web UI

1

Open an Image

Navigate to a WSI file in the web interface to open the viewer.
2

Select Tissue Type

Choose the appropriate tissue type from the dropdown menu:
  • Colon: For colorectal tissue (DigestPath models)
  • Liver: For liver tissue (PAIP models)
  • Breast: For breast tissue (Camelyon models)
3

Run Segmentation

Click the “Segment” button to start the AI analysis.The process will:
  1. Download pre-trained models (first time only)
  2. Process the image in patches
  3. Generate segmentation mask
  4. Display results overlaid on the original image
Model files are cached in ~/.DigiPathAI/ and automatically downloaded on first use. This may take several minutes depending on your connection.
4

View Results

The segmentation mask will be displayed with:
  • Mask overlay: Cancerous regions highlighted
  • Uncertainty map: Model confidence visualization
  • Toggle controls: Show/hide different layers
Results are automatically saved as TIFF files with -dgai-mask and -dgai-uncertainty suffixes.

Method 2: Using the Python API

For programmatic access and custom workflows, use the Python API:
from DigiPathAI.Segmentation import getSegmentation

# Run segmentation with default parameters
prediction = getSegmentation(
    img_path='path/to/slide.tiff',
    patch_size=256,
    stride_size=128,
    batch_size=32,
    quick=True,
    mode='colon'
)

API Parameters

ParameterTypeDefaultDescription
img_pathstrRequiredPath to WSI file (TIFF, SVS, etc.)
patch_sizeint256Size of patches for inference
stride_sizeint128Stride between patches (lower = more overlap)
batch_sizeint32Number of patches per GPU batch
quickboolTrueSingle model (True) vs ensemble (False)
tta_listlistNoneTest-time augmentations to apply
crfboolFalseApply CRF post-processing
modestr’colon’Tissue type: ‘colon’, ‘liver’, ‘breast’
modelstr’dense’Model: ‘dense’, ‘inception’, ‘deeplabv3’
The quick parameter significantly affects processing time:
  • quick=True: Uses single model (~5-10 min for typical slide)
  • quick=False: Uses ensemble of 3 models (~15-30 min for typical slide)

Understanding the Output

Generated Files

When segmentation completes, DigiPathAI creates three files:
  1. Probability Map (-dgai-probs.tiff): Raw probability values (0-1) for each pixel
  2. Binary Mask (-dgai-mask.tiff): Thresholded segmentation (0 or 255)
  3. Uncertainty Map (-dgai-uncertainty.tiff): Model uncertainty/variance

Interpreting Results

  • White regions in the mask indicate detected cancerous tissue
  • Black regions indicate normal/background tissue
  • Uncertainty map shows where the model is less confident (brighter = more uncertain)
Use the uncertainty map to identify regions that may need manual review by a pathologist.

Performance Optimization

GPU Memory Management

If you encounter out-of-memory errors:
# Reduce batch size
prediction = getSegmentation(
    img_path='large_slide.svs',
    batch_size=16,  # Default is 32
)

# Or reduce patch size
prediction = getSegmentation(
    img_path='large_slide.svs',
    patch_size=128,  # Default is 256
)

Speed vs Accuracy Trade-offs

# Single model, large stride, no TTA
prediction = getSegmentation(
    img_path='slide.tiff',
    quick=True,
    stride_size=256,  # No overlap
    batch_size=64
)

Advanced Server Options

The digipathai command supports additional configuration:
# Run with custom slide directory
digipathai --slide_dir /path/to/slides localhost 8080

# Viewer-only mode (disable segmentation)
digipathai --viewer-only localhost 8080

# Enable debug mode
digipathai --debug localhost 8080

# Custom tile size and quality
digipathai --size 512 --quality 90 localhost 8080
Run digipathai --help to see all available options from main_server.py:246-275.

Next Steps

API Reference

Detailed documentation of all functions and parameters

User Guide

Learn how to run segmentation and understand results

Tissue Types

Explore models for colon, liver, and breast cancer

Contributing

Contribute to the project on GitHub

Build docs developers (and LLMs) love