Spatialdata.aggregate, image and segmentation_mask have different shape, but aligned in 'global'

Thanks for the great package!

I have an image and a cell mask, I want to quantify the mean intensity of the signal measured in the image within each cell, using the cell mask. The image is a lot smaller, with size (3,912,1488), while the cell mark is a dataTree with varying sizes, the smallest is (2129,3198).

I have a global coordinate system where there two modalities are aligned, but when I use spatialdata.aggregate, (1) it does not accept the “cell_labels” mask, as it is a DataTree rather than a DataArray, (2) when I supply a specific element in the DataTree, it says the mask and image do not have the same size. Seems like aggregate() was not able to leverage the alignment information stored in the ‘global’ coordinate system.

I still have the option of resizing my image to the same shape as the cell mask, but just wanted to check to see if you have any comments or suggestions.

Thank you very much.

Best regards,
Michelle

I have the same question. Even after resizing, the aggregate step threw the out of memory error. I am wondering if we need to crop and stitch the images. Any suggestions or comments are appreciated