Hi there! First of all, thank you so much for this amazing package - it is currently my bread and butter, and I really appreciate your team! Second, I am writing this issue about aligning a post-Xenium IF staining with our Xenium image.
I have a multi-channel OME-TIFF (20 channels), with IF staining for the same tissue section as the Xenium (staining was done post-Xenium). I ran MCMICRO on this and obtained quantifications, but I need to align this to the Xenium image, and either re-quantify per cell using the Xenium segmentation mask, or somehow import the quantification into a combined SpatialData.
I aligned this image to the Xenium image using Xenium Explorer (by following this tutorial), and it worked beautifully in the Xenium Explorer. The images were perfectly aligned, and I could see the IF staining from multiple channels. However, I've had the following issues:
- When I run the xenium_aligned_image function, I get an assertion error since the function expects there to be (I think) only 3-4 channels.
image = xenium_aligned_image(image_path=he_path, alignment_file= alignment_matrix_path)
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
Cell In[14], [line 9](vscode-notebook-cell:?execution_count=14&line=9)
6 he_path = os.path.join(base_dir, "registration/BDBAT0246.ome.tif")
8 assert image.shape[0] in [3, 4, 20] # Allow 20 channels in addition to 3 and 4
----> [9](vscode-notebook-cell:?execution_count=14&line=9) image = xenium_aligned_image(image_path=he_path, alignment_file= alignment_matrix_path)
File ~/miniconda3/envs/napari-env/lib/python3.11/site-packages/spatialdata_io/readers/xenium.py:654, in xenium_aligned_image(image_path, alignment_file, imread_kwargs, image_models_kwargs, dims, rgba, c_coords)
652 else:
653 assert len(image.shape) == 3
--> [654](https://file+.vscode-resource.vscode-cdn.net/Users/bhavyasingh/Library/CloudStorage/OneDrive-TheMountSinaiHospital/Falcomata%2C%20Chiara%27s%20files%20-%20Xenium_Perturbmap/Xenium_Custom1/~/miniconda3/envs/napari-env/lib/python3.11/site-packages/spatialdata_io/readers/xenium.py:654) assert image.shape[0] in [3, 4]
655 dims = ("c", "y", "x")
656 else:
AssertionError:
- I tried to do a manual affine transformation (not involving xenium explorer), which worked. But when I try to output the new transformed image, there's still a very strange offset. The IF images are a different resolutoin from the Xenium.
The alignment works beautifully in Xenium explorer (and when I do the affine transformation), but how do I actually implement it and output a new OME-TIFF with new coordinates? Or alternatively, add this information to my Xenium SpatialData? Your help is greatly appreciated!
Hi there! First of all, thank you so much for this amazing package - it is currently my bread and butter, and I really appreciate your team! Second, I am writing this issue about aligning a post-Xenium IF staining with our Xenium image.
I have a multi-channel OME-TIFF (20 channels), with IF staining for the same tissue section as the Xenium (staining was done post-Xenium). I ran MCMICRO on this and obtained quantifications, but I need to align this to the Xenium image, and either re-quantify per cell using the Xenium segmentation mask, or somehow import the quantification into a combined SpatialData.
I aligned this image to the Xenium image using Xenium Explorer (by following this tutorial), and it worked beautifully in the Xenium Explorer. The images were perfectly aligned, and I could see the IF staining from multiple channels. However, I've had the following issues:
The alignment works beautifully in Xenium explorer (and when I do the affine transformation), but how do I actually implement it and output a new OME-TIFF with new coordinates? Or alternatively, add this information to my Xenium SpatialData? Your help is greatly appreciated!