squidpy icon indicating copy to clipboard operation
squidpy copied to clipboard

multi-layer process operations for ImageContainer

Open ibsafa opened this issue 7 months ago • 5 comments

Hello! I am working with whole slide images, specifically IHC. In short, I would like to perform some operations that need to access information from multiple layers (before any segmentation or spatial data is generated). the layers are all images, and are spatially aligned. However, all the existing functions in the current implementation of ImageContainer can only take one layer at a time. My attempts at a workaround have so far failed. I'm very impressed with the image container storage, chunking and parallelization capabilities and would like to use it if at all possible. Looking through the code, it seems like the underlying architecture should be able to support multiple layers easily. First, is that true? I am happy to contribute this feature myself so I can use, and would appreciate your guidance in pointing me to what needs to be changed. Alternatively, if you have workarounds or other ideas on how to do this, I'm all ears. Thank you so much.

ibsafa avatar Aug 05 '25 18:08 ibsafa

Thank you for the response! Yes, I'm very interested in the workaround you mention.

ibsafa avatar Aug 06 '25 13:08 ibsafa

Sorry I went through this page you linked and it's not very intuitive what is going on there as it relates to this specific issue. All I'm attempting to do is perform an image processing step wherein a single function can access the same chunk (spatially) in two different layers in an image container. Apologies if I'm misunderstanding what you linked here, but I don't see anything in there that helps with this specific problem?

ibsafa avatar Aug 07 '25 13:08 ibsafa

Hey @ibsafa,

sorry about whatever onestardao was writing there, I've deleted it now since it seems like spam.

We're in the process of deprecating the ImageContainer in favor of https://spatialdata.scverse.org/en/stable/ which will support the same chunking logic. What is your exact usecase?

timtreis avatar Nov 17 '25 15:11 timtreis

Thank you. I am using it in order to combine two different image transformations (which I process as two layers). As a simple example, I basically want to create a function that acts on two or more layers. the functionality which exists now, iirc, can do transformations on a single layer. I will need spatial data down the line but my use case is more related to processing the image itself. Not sure if that made sense, let me know if you have any questions!

ibsafa avatar Nov 24 '25 13:11 ibsafa

SpatialData stores the images as zarr-backed xarray.DataArrays, so you can also directly access them there while still getting all the benefits of the other tooling around that - although I'm not fully sure about your usecase :)

timtreis avatar Nov 24 '25 17:11 timtreis