Nextflow pipeline for exporting tiles from images in a QuPath project using QuPath headless mode and TileExporter.
- Runs QuPath from CLI in headless mode.
- Iterates through all images in a
.qpprojproject. - Exports image tiles using user-defined tile size and overlap.
- Creates one folder per image containing that image's tile files.
--projectPath to QuPath project (.qpproj).--tile_sizeTile size in pixels (for example1024).--tile_overlapTile overlap in pixels (for example128).
Optional:
--qupath_binPath to QuPath executable (default:/stornext/System/data/software/rhel/9/base/tools/QuPath/0.6.0/bin/QuPath).--scriptGroovy script path (default:bin/export_image_tiles.groovy). Relative paths are resolved from the pipeline directory.--downsampleDownsample factor for tile export (default:1.0).--include_partial_tilesInclude edge tiles smaller than tile size (default:true).--outdirOutput directory (default:results).
Run on HPC with Singularity and medium resources:
nextflow run main.nf \
-profile singularity,medium \
--project /path/to/project.qpproj \
--qupath_bin /stornext/System/data/software/rhel/9/base/tools/QuPath/0.6.0/bin/QuPath \
--tile_size 1024 \
--tile_overlap 128 \
--downsample 1.0 \
--include_partial_tiles true \
--outdir /path/to/outputtiles/output directory containing one folder per image in the QuPath project.- Per-image folder names are sanitized from QuPath image names.
qupath_tile_export.logwith the full QuPath export log.
Use bin/merge_tile_geojson.py after segmentation on tiles.
Example:
python bin/merge_tile_geojson.py \
--input-dir /path/to/tile_geojson \
--output-dir /path/to/merged_geojson \
--overlap 200 \
--core-filter \
--dedup-iou 0.4Notes:
- The script parses tile offsets from filenames like
[x=824,y=1648,w=1024,h=400]. - It shifts polygons into global coordinates before merging.
--core-filterkeeps objects whose centroid falls in the non-overlap core of each tile.--dedup-iouapplies NMS-style duplicate removal in overlap regions.