drighelli / SpatialExperiment

55 stars 20 forks source link

Rebased the SpatialImage classes on Annotated. #122

Closed LTLA closed 2 years ago

LTLA commented 2 years ago

Since no one else seems to want to do this...

Closes #25 by enabling storage of diameters on a per-image basis.

example(SpatialImage, ask=FALSE, verbose=FALSE)
metadata(spi)$spot_diameter <- 1
metadata(spi)$fiducial_diameter <- 2

metadata(spi)
## $spot_diameter
## [1] 1
## 
## $fiducial_diameter
## [1] 2

Works for images inside an SPE as well:

example(SpatialExperiment, ask=FALSE)
metadata(imgData(spe)$data[[1]]) <- list(foo=1, bar=2)
metadata(imgData(spe)$data[[1]])
## $foo
## [1] 1
## 
## $bar
## [1] 2

I will leave it to someone else to edit readVisium to store the diameters inside each image. Duplication is fine, there's no guarantee that all images in an SPE have the same diameters anyway, e.g., if the object is created by combining different experiments with different resolutions, Visium versions, whatever.

lmweber commented 2 years ago

Thanks for this, yes this looks good. I think we can merge this and then make a note to update read10xVisium() and add examples separately.

@drighelli @HelenaLC let me know if you have any comments, otherwise I'll merge tomorrow. Thanks!

(The failed checks above are unrelated. I ran checks locally and they are ok.)