How to take a snapshot in every point of the grid?

Hi all!

I am using QuPath 0.2.3 and I need to take one snapshot at every grid point (see attached image 01).

Right now I am doing: Zoom in at every grid point and then manually “File / Export snapshot / Main window screenshot” to get “Main window screenshot” (image 02).

Question 1: is there a way to create a keyboard shortcut for the function “File / Export snapshot / Main window screenshot”? If so, the manual process of exporting snapshots will be less tedious.

Question 2: Even better than previous question, is there any way to automatize this manual exporting snapshots process? I mean to automatically take a snapshot at a selected zoom level in every grid point?

Question 3: Could be possible to take snapshots at every grid point of “current viewer content” in an automatic way? I mean to have just one image file with the two images one above and the other one below (see attached image 03)

Thanks

Mc A.


Hi @User333, have you looked at the TileExporter?

https://qupath.readthedocs.io/en/latest/docs/advanced/exporting_images.html#tile-exporter

If the TileExporter doesn’t do what you need, can you explain more why you need the snapshots?

2 Likes

Thanks Pete!

I am loving the TileExporter, never used before. That solved part of my problem: so I am able to extract tiles corresponding to each point of the grid for each image (i.e. channel) but now I need to combine in one single image, let’s say side by side, two equivalent tile images in position, one from each image (channel).

So, the need is to automatise image combination side by side using file name, as the output tiles are: “sample1-channel1-x=4531,y=3456,h=4532” and the same tile in the other image is “sample2-channel1-x=4531,y=3456,h=4532”. I have hundreds of paired tiles and I need to get only one image file with the combination of both images side by side. Any idea? Maybe I need to go to the Fiji forum.

Hmmm, so long as you’re inside QuPath, then View ‣ Mini viewers ‣ Show channel viewer should remove most of the need to split channels explicitly for visualization (among the tricks at the bottom of this page).

Otherwise, you could use a QuPath script to merge your two images together, but it would involve a dip into Java BufferedImages, ImageJ images or OpenCV Mats – all of which are pretty low-level, and none of which are entirely straightforward.

Since your images are now small, it’s probably easier to go straight to ImageJ/Fiji. If that’s the goal, I think it’s made harder by having your channels split. If you instead export as a 2-channel image, you can use ImageJ’s Image &rarr: Hyperstacks → Hyperstack to Stack followed by Image → Stacks → Make Montage….

Ok, I see. It would be really useful to find a way to create a montage of two images, sorry they are not really channels, but same sample with different stains, so two images in QuPath. And the two equivalent images tiles, extracted from two different images have same coordinates that are in the name of the file. I attached the tiles extracted from image “106”, imaging that I am extracting tiles from image “107” and I get equivalent tiles with same coordinates. Then I need to combine side by side both images and the only thing relating paired tile images is the coordinates in the file name.

Ah ok, that sounds like a problem that might be solved more easily in other software. That could be scripted in QuPath (since more or less anything can be scripted…), but no more easily than in Fiji or Python.