Giter Site home page Giter Site logo

qupath-gradle-scripting-project's Introduction

QuPath/Gradle scripting project

This repo contains a minimal Gradle project to help with QuPath scripting.

What's this for?

QuPath's script editor is pretty minimal. It's much easier to write complex scripts with the full power of an IDE (Integrated Development Environment).

A good IDE can provide autocompletion, direct links to QuPath source code & documentation, and help spot bugs and typos much earlier.

The tricky bit is setting up the IDE with all the QuPath dependencies so that this works.

Which is where this repo comes in.

How do I use it?

The IDE I've used more for writing QuPath scripts is IntelliJ IDEA Community Edition. Therefore the instructions focus on that - but potentially the approach could be used for other IDEs.

Scripting with IntelliJ

  • Download the latest release of the repo (or fork & clone)
    • Unzip the contents if needed
  • Within IntelliJ, use File → New... → Project from existing sources and provide the path to the download
  • Follow IntelliJ's prompts if needed, e.g. to set up a 'Groovy SDK'
  • Write your QuPath scripts as .groovy files inside the 'scripts' directory
    • Create a new script by right-clicking the 'scripts' directory in IntelliJ and choosing New → Groovy script
  • Enjoy IntelliJ's Groovy support to make scripting easier

Whenever you want to run the script in QuPath, drag it onto QuPath's main window and run it via the script editor as normal.

Tip!

If File → Auto refresh files is selected in QuPath's script editor, then saving the script in IntelliJ should result in it automatically being reloaded when you switch to QuPath.

(Full disclosure: a bug in QuPath v0.4.0 and v0.4.1 broke the auto-refresh feature - but it will be fixed in v0.4.2.)

Set a script directory in QuPath

In QuPath, Automate → Shared scripts allows you to specify a directory containing scripts.

You can set it to the directory containing your scripts here to make them available through QuPath's menus.

Specifying dependencies

You can change the QuPath version in settings.gradle.

You can change the dependencies in build.gradle.

Since v0.4.0, if you want to use a dependency already managed within QuPath you can use the Gradle category feature - requesting a library from libs.versions.toml to ensure the version matches.

License

There's nothing special here: it's just a template repo for convenience.

Use it as you wish (without warranty, of course).

If it had a license, it would be the Unlicense. I didn't include the unlicense file though, since if anyone forks the repo then they might forget to remove it - and inadvertently unlicense their own scripts.

qupath-gradle-scripting-project's People

Contributors

petebankhead avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.