This repository contains a guide on how to use Groovy code in QuPath for automation and customization purposes. QuPath offers a built-in script editor that allows you to write and run Groovy scripts to perform various tasks and extend the functionality of the software.
- Clone this repository to your local machine.
- Follow the official QuPath installation guide to set up QuPath on your computer.
- Open the QuPath application.
- Load your images and annotations into QuPath.
- Navigate to Automate > Show script editor in the menu bar to open the script editor.
- Write or paste your Groovy script into the script editor. You can also load an existing script using the File > Open... option in the script editor.
- Save your script (optional) using the File > Save as... option in the script editor.
- Run your script by clicking the Run button in the script editor. You can also use the Ctrl+R (or Cmd+R on macOS) keyboard shortcut to run the script.
The following is an example Groovy script that prints the names of all the images currently open in QuPath:
import qupath.lib.projects.Project
import qupath.lib.images.ImageData
Project project = qupath.getProject()
List<ImageData> imageDataList = project.getImageList()
imageDataList.each { imageData ->
println "Image name: ${imageData.getServer().getMetadata().getName()}"
}
Copy and paste this script into the QuPath script editor and run it to see the output.
- Exporting images with QuPath
- Exporting annotations with QuPath
- Json Annotation: Sharing annotated QuPath files with other users
If you'd like to contribute to this project, please create a fork of this repository, make your changes, and submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or issues, please use the QuPath forum or open an issue in this repository.