-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HESTData: update to_spatial_data()
``
#63
Conversation
Thanks @konst-int-i! A couple of things to add:
@pauldoucet, let me know if I'm missing anything. Pushing for better interfacing with spatial data seems like a good direction. |
src/hest/HESTData.py
Outdated
@@ -12,6 +12,9 @@ | |||
from hestcore.wsi import (WSI, CucimWarningSingleton, NumpyWSI, | |||
contours_to_img, wsi_factory) | |||
from loguru import logger | |||
from spatialdata import SpatialData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to move this import line inside the to_spatial_data() method, the SpatialData is huge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved in 98d0acf - I had it outside to enable the type hint in the function, but appreciate that it comes with a lot of overhead
tissue_hires_scalef = scalefactors[TISSUE_HIRES_SCALEF] | ||
else: | ||
pixel_size=self.meta['pixel_size_um_estimated'] | ||
ds_factor = 4/pixel_size # proxy for visium hires scale factor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this part going to work for non-visium ST?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - the hires
image here is an approximation for ~4 MPPs which is standard with Visium. I have tested it with non-visium slides and the same logic works and accurately downsamples the image, although the hires
terminology is not normally given for these slides to my knowledge.
…stology-loader into feature/to_spatial_data
Hi @konst-int-i great work on your PR! I added some checks and modified the conditional import statement (one cool trick, if you use |
Addressed the additional requests from @guillaumejaume in 82f0779 |
This PR
Makes several changes to the
HESTData.to_spatial_data()
behaviour:fullres
,hires_downsampled
andlowres_downsampled
).datatree
to prevent buffer error raised in How to use Xenium data for cell segmentations? #61Test instructions
Alternatively, run the first cell in
tutorials/2-Interacting-with-HEST-1k.ipynb
.Expected behaviour
Old
SpatialData
conversion for sampleTENX68
⬇️ ⬇️ ⬇️
New
SpatialData
conversion: