1 | roi2polygon(roi.path, tif.path)
|
roi.path |
|
tif.path |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (roi.path, tif.path)
{
library(RImageJROI)
roi.file.names <- roi.path
x_roi5 <- read.ijroi(roi.file.names, verbose = FALSE)
library(spatstat)
x_owin5 <- ij2spatstat(x_roi5)
first.tif.filename <- Sys.glob(paste0(tif.path, "vis/*.tif"))[[1]]
library(raster)
RGB_stack_DEM <- stack(first.tif.filename)
bandred <- raster(first.tif.filename, band = 1)
w5_y_corr <- (nrow(as.matrix(bandred)) - (as.data.frame(x_owin5))$y)/nrow(RGB_stack_DEM)
w5_x <- (as.data.frame(x_owin5))$x/ncol(RGB_stack_DEM)
xym5 <- cbind(x = w5_x, y = w5_y_corr)
p5 <- Polygon(xym5)
ps5 <- Polygons(list(p5), "pocillo 5")
sps <- SpatialPolygons(list(ps5))
return(sps)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.