LieberInstitute / spatialLIBD

Code for the spatialLIBD R/Bioconductor package and shiny app
http://LieberInstitute.github.io/spatialLIBD/
80 stars 16 forks source link

Investigate if it's possible to pass grob to plotly #5

Closed lcolladotor closed 3 years ago

lcolladotor commented 3 years ago

Currently run_app() has the argument image_path at https://github.com/LieberInstitute/spatialLIBD/blob/49d0735a779211da86e8efb119fd6872e3960c81/R/run_app.R#L57 which then is used at https://github.com/LieberInstitute/spatialLIBD/blob/49d0735a779211da86e8efb119fd6872e3960c81/R/app_ui.R#L553 because the images are read with readPNG() at https://github.com/LieberInstitute/spatialLIBD/blob/49d0735a779211da86e8efb119fd6872e3960c81/R/app_server.R#L360-L365 and then converted to a raster at https://github.com/LieberInstitute/spatialLIBD/blob/49d0735a779211da86e8efb119fd6872e3960c81/R/app_server.R#L514.

There might be a way to do this directly from the rastergrob objects now included in SpatialExperiment. Can you check if there's such a way? Thanks!

Hopefully there's a way, that way we can eliminate this argument and make run_app() more flexible to use with new data.

FYI https://github.com/drighelli/SpatialExperiment/issues/27 might be related

bpardo99 commented 3 years ago

Hi Leo, so until now, I think Plotly can't receive grobs. I think we could convert the grab to a raster object.

LTLA commented 3 years ago

Wandered onto this thread from the linked issue above. The raster object is what will be returned by imgRaster() in the next development version, so that should avoid the need for further interconversions.

lcolladotor commented 3 years ago

Thanks for the heads up Aaron!

@bpardo99 can you check https://github.com/drighelli/SpatialExperiment/commit/d537102fc54ec3b2c13c5843481c2dd9aafe6f0d? Thanks!