drawing a circle with specified circle and center

119 views
Skip to first unread message

Niki

unread,
Dec 30, 2018, 6:28:04 PM12/30/18
to QuPath users
hello, i have an image with several(~100) detection objects. if i draw a circle manually, the objects encapsulated inside the circle are selected right?

i'd like to do that by script. so is their a way to draw a circle with specified circle and center so that the objects in the circle are selected?

thanks to the amazing Qupath and kind people in this forum, my paper is getting finished. i'd like to share a detailed protocol and scripts (and journals want me to do so as well). i don't know much about the open source thing, so i ask this. do you think it's fine to share my scripts at github? (my protocol uses QuPath and python, and i also added a python script which modifies some directory settings of the groovy script for the user)

micros...@gmail.com

unread,
Dec 30, 2018, 9:14:12 PM12/30/18
to QuPath users
I am not sure what you mean by selected. If you technically mean selected in the sense that if you click on something, or highlight a group of somethings they are "selected" then no. The objects inside would not be selected. They would, however, be considered child objects of the parent circle object. If you selected that circle, you could rerun cell detection, or something else, and it would wipe out the detections inside of it and re-check for cells with the new settings.

If you still want to script it, Pete has an example in his Gists here for creating rectangles, but you can alter it for circles: https://gist.github.com/petebankhead/31291fa61d2032cd2da0e8ef4d24a5d5
I also post many of the scripts I find/create on my Gist here: https://gist.github.com/Svidro

I have a few scripts that involve calling things from python (email alerts for when a run is done, checking for blur in images, pipelines, I think they are all in the "Coding helper scripts"), but am not expert and would always like to see what other people are doing!

Back to your original question, if you want only a particular set of objects "selected," you may want to do something like create the circle at X,Y coordinates, use getChildObjects() to get the detections, and then add them to the selection model, see the "Selecting objects in QuPath" section of my Gists if you want more details.

micros...@gmail.com

unread,
Dec 30, 2018, 10:28:46 PM12/30/18
to QuPath users

Pete

unread,
Dec 31, 2018, 4:11:53 AM12/31/18
to QuPath users
Adding to what microscopyra writes, the last link is the one I'd have posted: https://petebankhead.github.io/qupath/scripting/2018/03/09/script-create-fixed-size-region.html
But the usefulness of this will depend on what you mean by 'selected'.

I personally find GitHub a good place to share code and methods, not least because it can also store a history of any updates and improvements along with documentation.  I would suggest creating a 'standard' GitHub repository (like the one containing QuPath) rather than relying on Gists (https://gist.github.com)... mostly because Gists can be quite hard to find.  I use them a lot myself, but will probably switch to using a GitHub repository for my QuPath scripts eventually.
Reply all
Reply to author
Forward
0 new messages