Setting color display thresholds for fluorescence in script

266 views
Skip to first unread message

Finn

unread,
Sep 14, 2017, 3:07:19 PM9/14/17
to QuPath users
Hi -

First I'd like to say a huge thanks for making this program -- I'm just starting to learn this type of image analysis, but it's been working amazingly for me so far.

Right now, I'm trying to optimize an immunofluorescence project, and the auto-set channel display thresholds are leading to saturated images. I can set this manually, but was wondering if I can automate this in my project script for all images? The command history script doesn't seem to track these commands, so I am not sure how to script this...

Unfortunately we can't do whole slide IF scanning, so I (think I) can't do the project as a TMA which would be ideal here....  Thanks again!

Finn

Pete

unread,
Sep 14, 2017, 3:22:12 PM9/14/17
to QuPath users
That's an excellent question, for which I didn't know the answer...

From memory I don't think that the display range info is stored in the .qpdata files, but rather it just survives for as long as the current QuPath session is open.  That limits what you can do a bit; for proper batch processing it would help if these values were kept somewhere.

However, this script might help a bit:

// Get access to the display info for each channel
def viewer = getCurrentViewer()
def channels = viewer.getImageDisplay().getAvailableChannels()

// Set the range for the first two channels
channels[0].setMinDisplay(0)
channels[0].setMaxDisplay(100)
channels[1].setMinDisplay(0)
channels[1].setMaxDisplay(500)

// Ensure the updates are visible
viewer.repaintEntireImage()

// Usually a good idea to print something, so we know it finished
print 'Done!'


Something like this allows you to set the display range for the image currently open in the viewer, and could be a bit more convenient than opening the Brightness/Contrast tool and moving the sliders every time.

Finn

unread,
Sep 14, 2017, 4:24:15 PM9/14/17
to QuPath users
Thanks!

That seems to work well -- for the open image at least, which is good enough for now.
Reply all
Reply to author
Forward
0 new messages