You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The contract for the SpatialExperiment::imgRaster() generic expects a raster object to be returned. This is not satisfied by the imgRaster() metbods in SpatialFeatureExperiment, which return instances of various other classes like SpatRaster and Image as per
This discrepancy causes problems when an SFE is supplied to a function that accepts a SpatialExperiment. Functions calling imgRaster(imgData(spe)$data[[i]]) expect to get a raster object back, and fail when they are confronted with something else.
It would be best if your imgRaster() methods called as.raster() to comply with the generic contract. Of course, you can have other functions to return SpatRaster and Image directly, but those should not be called imgRaster().
The text was updated successfully, but these errors were encountered:
Sorry I didn't know that. Initially I thought the purpose of imgRaster() was just to access the image itself, so in early versions of SFE, imgRaster SpatRaster method would return the original SpatRaster object when SpatRasterImage did not directly inherit from SpatRaster. Later I changed SpatRasterImage to directly inherit from SpatRaster just because it's kind of annoying to have to call imgRaster before any terra functions can be applied to the image.
The contract for the
SpatialExperiment::imgRaster()
generic expects araster
object to be returned. This is not satisfied by theimgRaster()
metbods in SpatialFeatureExperiment, which return instances of various other classes likeSpatRaster
andImage
as perSpatialFeatureExperiment/R/image.R
Lines 1012 to 1021 in af85a1c
AFAICT these are not subclasses of
raster
.This discrepancy causes problems when an SFE is supplied to a function that accepts a
SpatialExperiment
. Functions callingimgRaster(imgData(spe)$data[[i]])
expect to get araster
object back, and fail when they are confronted with something else.It would be best if your
imgRaster()
methods calledas.raster()
to comply with the generic contract. Of course, you can have other functions to returnSpatRaster
andImage
directly, but those should not be calledimgRaster()
.The text was updated successfully, but these errors were encountered: