This repository contains a set of scripts to export QuPath annotations as GeoJSON and split the exported ROI coordinates by cell type (classification) for further analysis.
v0.3.2
ExAnnoClassifications.groovy: A Groovy script for QuPath to extract cell detection-based annotations (classifications) from QuPath TMA projects and save them as GeoJSON files.qupath_roi_splitter.py: A Python script to split the ROI coordinates of QuPath TMA annotations by cell type (classification) and save them as tab-separated text files.qupath_roi_splitter_folder.py: A folder version of thequpath_roi_splitter.pyscript that processes all GeoJSON files in a specified folder.
- QuPath (for
ExAnnoClassifications.groovy) - Python 3.6 or later
- OpenCV (cv2)
- GeoJSON
- Pandas
- NumPy
- Open QuPath and load your TMA project.
- In QuPath, go to
Automate > Show script editor. - Copy the content of the
ExAnnoClassifications.groovyscript into the script editor. - Run the script. It will save the exported annotations as GeoJSON files in a folder named
annotations_export_[TMA_name]within your QuPath project directory.
- Run
qupath_roi_splitter.pywith the--qupath_roiargument pointing to the GeoJSON file you want to process.--fillis an optional argument to fill the ROI polygons.--allis an optional argument to export all features of GeoJSON (ignores if classification is present).
python qupath_roi_splitter.py --qupath_roi path/to/your/geojson_file.geojson --fill- Run
qupath_roi_splitter_folder.pywith thequpath_roi_folderargument pointing to the folder containing the GeoJSON files you want to process.
python qupath_roi_splitter_folder.py path/to/your/geojson_folder --fillThe script will create a tab-separated text file for each cell type (classification) in the same folder as the GeoJSON files. The text files will be named as follows: [TMA_name]_[cell_type].txt.
This project is licensed under the MIT License. See the LICENSE file for details.