Saving Image Layers Together

Hi everyone,
I am trying to figure out how to save two image layers together as a single image in a .tiff file. I have a shape on top of an image in 3D.
Thanks for all help!

Right now we don’t have any convenient ways to do that.

Depending on what you want it could be possible to write a custom plugin writer to do that, or we could think about making an option for our default plugin writer. There is a PR in progress here which would combine layers https://github.com/napari/napari/pull/1322 which could be one approach.

Just to check something though when you say “shape on top of image” though do you mean a “Shapes” layer in napari (i.e. vector object/ polygon etc) or do you mean your image layer has a “shape” in it, but it is still array data?

tiff also isn’t the best for handling multidimensional data, on often has to think about interleaving data (particularly if your data is 3D to begin with) so if you could give a little more detail/ a minimal example that might help us help you more.

I meant a “shapes” layer in napari and it is still array data.
I have a 3D image(.tiff) and then I layer the “shape”, which is a 3D line segment on top. The “shape” layer is defined from a .csv file. I want to save the layering as one image.
Thanks so much!

Ok great, I understand now. Saving all the data in one tiff file might involve you writing an ome-tiff and encoding the 3D line segment in their metadata. I’ve not done this myself, but that’s the first place I’d look. Eventually it would be nice for us to have a standard ome-tiff writer plugin that did that. Maybe @joshmoore knows if someone is already working on napari-ome-tiff?

Eventually it would be nice for us to have a standard ome-tiff writer plugin that did that

It’s planned on the aicsimageio to do list but after we rewrite our own writers module: https://github.com/AllenCellModeling/napari-aicsimageio/issues/6

Writers rewrite is actively happening, hopefully about two weeks out.

1 Like