La continuité du service gitlab.irstea.fr sera assurée en 2020. Nous envisageons ensuite une évolution vers une forge nationale INRAE encore à construire. Nous vous tiendrons au courant des évolutions futures.

Commit 0f0191ca authored by Monnet Jean-Matthieu's avatar Monnet Jean-Matthieu

Fixed bug in examples when first loading chmchablais3 data

parent 8370600f
......@@ -25,6 +25,7 @@
#' @param nlsize numeric. kernel width in pixel for non-linear filtering
#' @examples
#' data(chmchablais3)
#' chmchablais3 <- chmchablais3
#' # fill NA values in canopy height model
#' chmchablais3[is.na(chmchablais3)] <- 0
#'
......
......@@ -43,6 +43,7 @@ createDisk <- function(width=5)
#' @param padding boolean. Whether image should be padded by duplicating edge values before filtering to avoid border effects
#' @examples
#' data(chmchablais3)
#' chmchablais3 <- chmchablais3
#'
#' # filtering with median and Gaussian smoothing
#' im <- demFiltering(chmchablais3, nlFilter="Median", nlSize=3, sigmap=0.8)
......@@ -162,6 +163,7 @@ demFiltering <- function(dem, nlFilter="Closing", nlSize=5, sigmap=0.3, padding=
#' @return A cimg object or RasterLayer object which values are the radius (n) in meter of the square window (width 2n+1) where the center pixel is global maximum
#' @examples
#' data(chmchablais3)
#' chmchablais3 <- chmchablais3
#'
#' # maxima detection
#' maxi <- maximaDetection(chmchablais3)
......@@ -230,6 +232,7 @@ maximaDetection <- function(dem, dem.res=1, max.width=21, jitter=TRUE)
#' @return A cimg object or rasterLayer object which values are the radius (n) in meter of the square window (width 2n+1) where the center pixel is global maximum and which fulfill the selection criteria
#' @examples
#' data(chmchablais3)
#' chmchablais3 <- chmchablais3
#'
#' # maxima detection
#' maxi <- maximaDetection(chmchablais3)
......@@ -282,11 +285,12 @@ maximaSelection <- function(maxi,dem.nl,hmin=0,dmin=0,dprop=0)
#'
#' performs a seed-based watershed segmentation (wrapper for imager::watershed)
#'
#' @param maxi cimg or rasterLayer object. image with seed points (e.g. from \code{\link{maximaDetection}} or \code{\link{maximaSelection}} )
#' @param maxi cimg or rasterLayer object. image with seed points (e.g. from \code{\link{maximaDetection}} or \code{\link{maximaSelection}})
#' @param dem.nl cimg or rasterLayer object. image for seed propagation (typically initial image used for maxima detection).
#' @return A cimg object or rasterlayer object with segments id
#' @examples
#' data(chmchablais3)
#' chmchablais3 <- chmchablais3
#'
#' # median filter
#' chmchablais3 <- demFiltering(chmchablais3, nlFilter="Median", nlSize=3, sigmap=0)$non.linear.image
......@@ -310,7 +314,7 @@ maximaSelection <- function(maxi,dem.nl,hmin=0,dmin=0,dprop=0)
#' seg.maxi[seg.maxi==0] <- NA
#' plot(seg.maxi %% 8, main="Segments, no maxima selection", col=rainbow(8))
#' seg.selected.maxi[seg.selected.maxi==0] <- NA
#' plot(seg.selected.maxi %% 8, main="Segments, maxima selection", col=rainbow(8))
#' plot(seg.selected.maxi %% 8, main="Segments, maxima selection", col=rainbow(8))}
#'
#' @seealso \code{\link{maximaDetection}}, \code{\link{maximaSelection}}, \code{\link{segAdjust}}
#' @export
......@@ -356,6 +360,7 @@ segmentation <- function(maxi,dem.nl)
#' @return A cimg object or raster object with values of the statistic
#' @examples
#' data(chmchablais3)
#' chmchablais3 <- chmchablais3
#'
#' # median filter
#' chmchablais3 <- demFiltering(chmchablais3, nlFilter="Median", nlSize=3, sigmap=0)$non.linear.image
......@@ -419,6 +424,7 @@ rasterZonalStats <- function(segms,dem.nl,fun=max)
#' @return A cimg or rasterLayer object: image with modified segments.
#' @examples
#' data(chmchablais3)
#' chmchablais3 <- chmchablais3
#'
#' # median filter
#' chmchablais3 <- demFiltering(chmchablais3, nlFilter="Median", nlSize=3, sigmap=0)$non.linear.image
......@@ -496,6 +502,7 @@ segAdjust <- function(dem.w, dem.wh, dem.nl, prop=0.3, min.value=2, min.maxvalue
#' Monnet, J.-M., Mermin, E., Chanussot, J., Berger, F. 2010. Tree top detection using local maxima filtering: a parameter sensitivity analysis. Silvilaser 2010, the 10th International Conference on LiDAR Applications for Assessing Forest Ecosystems, September 14-17, Freiburg, Germany, 9 p. \url{https://hal.archives-ouvertes.fr/hal-00523245/document}
#' @examples
#' data(chmchablais3)
#' chmchablais3 <- chmchablais3
#'
#' # tree segmentation
#' segments <- treeSegmentation(chmchablais3)
......@@ -577,6 +584,7 @@ treeSegmentation <- function(dem, nlFilter="Closing", nlSize=5, sigma=0.3, dmin=
#' @return A spatial data.frame with tree id, local maximum stats (height, dominance radius), segment stats (surface and volume).
#' @examples
#' data(chmchablais3)
#' chmchablais3 <- chmchablais3
#'
#' # tree segmentation
#' segments <- treeSegmentation(chmchablais3)
......@@ -659,6 +667,7 @@ treeExtraction <- function(r.dem.nl, r.maxi, r.dem.w, r.mask=NULL)
#' @return A RasterLayer
#' @examples
#' data(chmchablais3)
#' chmchablais3 <- chmchablais3
#'
#' # convert rasterLayer to cimg object
#' chm.cim <- raster2Cimg(chmchablais3)
......@@ -708,6 +717,7 @@ cimg2Raster <- function(cimg, rasterLayer=NULL)
#' @return A cimg object
#' @examples
#' data(chmchablais3)
#' chmchablais3 <- chmchablais3
#' chm.cim <- raster2Cimg(chmchablais3)
#' chm.cim
#' summary(chm.cim)
......
......@@ -19,6 +19,7 @@ converts a cimg object to RasterLayer object
}
\examples{
data(chmchablais3)
chmchablais3 <- chmchablais3
# convert rasterLayer to cimg object
chm.cim <- raster2Cimg(chmchablais3)
......
......@@ -30,6 +30,7 @@ applies two filters to an image:
}
\examples{
data(chmchablais3)
chmchablais3 <- chmchablais3
# filtering with median and Gaussian smoothing
im <- demFiltering(chmchablais3, nlFilter="Median", nlSize=3, sigmap=0.8)
......
......@@ -38,6 +38,7 @@ Performs gaps detection in a canopy height model. Function \code{\link{demFilter
}
\examples{
data(chmchablais3)
chmchablais3 <- chmchablais3
# fill NA values in canopy height model
chmchablais3[is.na(chmchablais3)] <- 0
......
......@@ -23,6 +23,7 @@ Variable window size maxima detection is performed on the image to extract local
}
\examples{
data(chmchablais3)
chmchablais3 <- chmchablais3
# maxima detection
maxi <- maximaDetection(chmchablais3)
......
......@@ -29,6 +29,7 @@ In a maxima image (output of \code{\link{maximaDetection}}), sets values to zero
}
\examples{
data(chmchablais3)
chmchablais3 <- chmchablais3
# maxima detection
maxi <- maximaDetection(chmchablais3)
......
......@@ -21,6 +21,7 @@ converts a RasterLayer object to Cimg object. NA values in raster are replaced.
}
\examples{
data(chmchablais3)
chmchablais3 <- chmchablais3
chm.cim <- raster2Cimg(chmchablais3)
chm.cim
summary(chm.cim)
......
......@@ -21,6 +21,7 @@ compute zonal statistic of an image
}
\examples{
data(chmchablais3)
chmchablais3 <- chmchablais3
# median filter
chmchablais3 <- demFiltering(chmchablais3, nlFilter="Median", nlSize=3, sigmap=0)$non.linear.image
......
......@@ -28,6 +28,7 @@ in a segmented image, removes from segments the pixels which values in a referen
}
\examples{
data(chmchablais3)
chmchablais3 <- chmchablais3
# median filter
chmchablais3 <- demFiltering(chmchablais3, nlFilter="Median", nlSize=3, sigmap=0)$non.linear.image
......
......@@ -7,7 +7,7 @@
segmentation(maxi, dem.nl)
}
\arguments{
\item{maxi}{cimg or rasterLayer object. image with seed points (e.g. from \code{\link{maximaDetection}} or \code{\link{maximaSelection}} )}
\item{maxi}{cimg or rasterLayer object. image with seed points (e.g. from \code{\link{maximaDetection}} or \code{\link{maximaSelection}})}
\item{dem.nl}{cimg or rasterLayer object. image for seed propagation (typically initial image used for maxima detection).}
}
......@@ -16,6 +16,35 @@ A cimg object or rasterlayer object with segments id
}
\description{
performs a seed-based watershed segmentation (wrapper for imager::watershed)
}
\examples{
data(chmchablais3)
chmchablais3 <- chmchablais3
# median filter
chmchablais3 <- demFiltering(chmchablais3, nlFilter="Median", nlSize=3, sigmap=0)$non.linear.image
# maxima detection
maxi <- maximaDetection(chmchablais3)
# maxima selection
selected.maxi <- maximaSelection(maxi, chmchablais3, dm=1, dprop=0.1)
# segmentation
seg.maxi <- segmentation(maxi, chmchablais3)
seg.selected.maxi <- segmentation(selected.maxi, chmchablais3)
\dontrun{
# plot original image
plot(chmchablais3, main="Median filter")
# plot segmented image
# replace segment with id 0 (not a tree) with NA
seg.maxi[seg.maxi==0] <- NA
plot(seg.maxi \%\% 8, main="Segments, no maxima selection", col=rainbow(8))
seg.selected.maxi[seg.selected.maxi==0] <- NA
plot(seg.selected.maxi \%\% 8, main="Segments, maxima selection", col=rainbow(8))}
}
\seealso{
\code{\link{maximaDetection}}, \code{\link{maximaSelection}}, \code{\link{segAdjust}}
......
......@@ -23,6 +23,7 @@ creates a dataframe with segment id, height and coordinates of maxima, surface a
}
\examples{
data(chmchablais3)
chmchablais3 <- chmchablais3
# tree segmentation
segments <- treeSegmentation(chmchablais3)
......
......@@ -37,6 +37,7 @@ global function for preprocessing (filtering), maxima detection and selection, s
}
\examples{
data(chmchablais3)
chmchablais3 <- chmchablais3
# tree segmentation
segments <- treeSegmentation(chmchablais3)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment