Advertisement

QuPath and scripting – why isn’t it easier?

Posted by , on 29 March 2024

As I explained in my previous post, this journey began because I needed to learn how to master QuPath. I turned it into a vlogging affair to be held accountable, help others, and use it to find common user problems. For the last six weeks I have explored all the ways QuPath can easily help you analyse your images, and I’ve learned SO much. However, I have reached the end of the “pretty” QuPath commands and I must now learn Groovy to tackle scripting.  

If you have tried scripting in QuPath and found it decidedly more difficult than everything else you have tried with the software, you are not alone. If it feels like trudging through a muddy field, it is because it … kind of is. When I spoke to Pete about it, we realised I had not fully understood the aim of QuPath. He shared that his intention was never to make QuPath super-generic to solve all bioimage analysis-related problems. Instead, he wanted QuPath to solve a range of common, difficult problems and to solve them WELL – in an open, reproducible, and transparent way. A key goal was that domain experts (e.g. biologists, pathologists) should be able to use it and interpret the results, and they shouldn’t need a degree in computer science to do so. Over time, QuPath is being developed and improved to solve more and more problems in this way. 

But developing new algorithms and user-friendly software is slow and difficult. A lot of the time, researchers need something slightly different from everyone else. It’s not really possible to predict all these needs in advance, and people can’t wait a couple of years for a new version of the software that might do what they need. Scripting was added to QuPath to fill in the gaps, and help prototype new features that could be added in a future version. Scripting was never meant to become the main thing that all users need to learn, but instead a tool for power-users to do even more. 

However, if you visit the forum (https://forum.image.sc/tag/qupath) you’ll find a high percentage of questions dealing with scripting – because it has proven so useful. There is probably some selection bias: it doesn’t mean that most users need scripting, but rather that scripting is what people need most help with. And this makes sense, because it is not as easy and streamlined as the other QuPath features. But if lots of people require a script to solve a common task today, then that’s a good candidate for a new built-in feature for us to try to add tomorrow. 

So, if you seem to be unable to do what you want with QuPath scripting, it isn’t really your fault… although it isn’t really QuPath’s either. It just means you need to do something beyond what QuPath’s built-in features can handle. When this happens, the forum is a great place to ask for help. There you might discover there is some other software that solves your problem already (you should use the best software for the job, which doesn’t have to be QuPath!). Experienced scripters on the forum can also help you figure out the code you need to write. And your question might even inspire the QuPath developers to add a new feature in the next release, so that it’s easier to solve the problem in the future. 

For my part, I DO really need to learn how to perfect scripting with QuPath because my job is to develop new algorithms that will be part of QuPath in the future – and scripting is the magical prototyping tool that will help me do it. ThereforeTherefore, I will be recording videos showing the most useful tips to use it without needing to be an expert. Below you can find a link to my latest video, an introduction to scripting, and let me tell you, it was quite the journey. 

I started by attempting simple tasks, like creating pop-up messages. Despite some initial errors, I persevered and eventually got it working (it turned out something in the documentation was out-of-date, so now we know to fix that!). I then moved on to working with the images and learned how to extract information from a whole project and from individual images. After spending some time creating annotations and tiles, I finally learned how to export regions to ImageJ to continue to image analysis outside of QuPath.  

This video was the most frustrating for me to date, because I hate feeling like I do not have a good enough grasp of what I am exploring, but I reminded myself that every mistake is a lesson, and every obstacle is an opportunity to grow. So, join me in my journey, keep pushing forward, keep learning, and who knows what amazing things we will achieve next!  

Happy analysing! 

1 Star (No Ratings Yet)

Tags: , , , ,
Categories: From Zero to Qupath Hero

Leave a Reply

Your email address will not be published. Required fields are marked *

Get involved

Create an account or log in to post your story on FocalPlane.

More posts like this

Filter by