Z-stack to Pyramid OME-TIFF

I have saved a sequence of z-stack tif images to ome.tiff using ImageJ, I can open the file fine with Qupath-0.2.0-m4 , I hit yes when asked for pyramids. All works good I can scroll through z-stacks using the little slider. When I export the same file as Pyramid OME-TIFF from QuPath it seems to only include the first z plane (in 3 pyramid resolutions). Is there a way to write pyramidal OME-TIFF with a z-stack ?

My test file is shared via dropbox:
Dropbox

EM data downloaded from https://www.ebi.ac.uk/pdbe/emdb/

You could try it in a script, e.g.


import loci.formats.out.PyramidOMETiffWriter
import qupath.lib.images.writers.ome.OMEPyramidWriter

def server = getCurrentServer()

def pathOutput = buildFilePath(PROJECT_BASE_DIR, 'EM-export.ome.tif')

long startTime = System.currentTimeMillis()

new OMEPyramidWriter.Builder(server)
    .scaledDownsampling(4)
    .tileSize(512)
    .channelsInterleaved()
    .parallelize()
    .allZSlices()
    .allTimePoints()
    .compression(PyramidOMETiffWriter.COMPRESSION_LZW)
    .build()
    .writePyramid(pathOutput)
    
long endTime = System.currentTimeMillis()
print 'Write time ' + (endTime - startTime) + ' ms'

It should be possible without a script, but apparently isn’t… I’ve started to change the default behavior to export the full image (including z-slices and timepoints) if no region is specified to address this.

2 Likes

Yes, that worked well. Thank you.
Is there a key combination I can use along with mouse scroll wheel to cycle through z-stack ? currently I am using that little slider on top left to navigate the z-stack ?

You can use the up and down arrow keys (I admit I had to check the code to remember that one…)

1 Like

Thank you for looking that one up for me! There are so many great features and shortcuts. The arrow keys seems to only work after you click the slider (when the slider is in focus?) else it moves the image within the viewer window. Is that the expected behavior ! While this isn’t a high priority feature would be better to use PgUp-PgDown keys and may be “Alt+scroll wheel” down the road?

1 Like

For me it works as long as the viewer is in focus, there is no need to have the slider in focus.

I admit that I’ve also been working with z-stacks a bit recently, and trying shortcuts to change slices because I thought I’d bound it to the scroll wheel… but apparently not. I would also like it connected with scrolling somehow.

I’ve just tried it with the Alt key and I find this appears to block the scroll events (at least on Windows); so does the Shift key. Because Ctrl/Cmd + scrolling is bound to the overlay opacity, I’ve run out of modifier keys to use and can’t think of a way to do it…

Switching to page up/down would be ok; the reason for the arrows is so that left/right can be used to time points as well.

Sidenote: I don’t think QuPath is used a lot with z-stacks, so i’m curious about how you are using it (for me, it’s applying the pixel classifier to confocal stacks). Also, I find the direction of the slider… unintuitive, with slice 0 at the bottom. i wonder if you have also noticed this, and would prefer slice 0 at the top - or a preference to toggle between them?

I haven’t noticed the sequence order of my z-stack, now that you have brought it up I will have to check !

I was planning to use it for annotating TEM images and serial block face EM images (for training dataset) since QuPath interface is very intuitive and is very easy to use and learn, I am still exploring the workflow and am in very early stages. Plus, as a Research Core Facility team member I am constantly exploring software solutions, features, and image processing workflows to be able to provide best solution for client researchers.

I do have bright field whole slide z-stack svs file if you need a test file, also a serial EM stack in ome.tif (written by QuPath) file.

At least in Zen, slice 1 is usually the “lowest” or closest to the objective, so that seems consistent with being the bottom from a microscopy standpoint.