├── .Rbuildignore ├── .github ├── .gitignore └── workflows │ ├── R-CMD-check.yaml │ └── rhub.yaml ├── .gitignore ├── DESCRIPTION ├── Dockerfile ├── ForestTools.Rproj ├── NAMESPACE ├── NEWS.md ├── R ├── Kootenay.R ├── Quesnel.R ├── glcm.R ├── mwcs.R └── vwf.R ├── README.md ├── cran-comments.md ├── data-raw ├── CHMdemo.tif ├── kootenayBlocks.CPG ├── kootenayBlocks.dbf ├── kootenayBlocks.prj ├── kootenayBlocks.sbn ├── kootenayBlocks.sbx ├── kootenayBlocks.shp ├── kootenayBlocks.shx └── kootenayCHM.tif ├── data ├── kootenayBlocks.rda ├── kootenayCHM.rda ├── kootenayCrowns.rda ├── kootenayOrtho.rda ├── kootenayTrees.rda ├── quesnelBlocks.rda ├── quesnelCHM.rda └── quesnelTrees.rda ├── inst └── guides │ ├── spatial_statistics.Rmd │ ├── spatial_statistics.md │ ├── spatial_statistics_files │ └── figure-gfm │ │ └── unnamed-chunk-1-1.png │ ├── treetop_analysis.Rmd │ ├── treetop_analysis.md │ └── treetop_analysis_files │ └── figure-gfm │ ├── unnamed-chunk-3-1.png │ ├── unnamed-chunk-5-1.png │ ├── unnamed-chunk-7-1.png │ └── unnamed-chunk-8-1.png ├── man ├── figures │ ├── logo.png │ └── treetops_segments.png ├── glcm.Rd ├── kootenayBlocks.Rd ├── kootenayCHM.Rd ├── kootenayCrowns.Rd ├── kootenayOrtho.Rd ├── kootenayTrees.Rd ├── mcws.Rd ├── quesnelBlocks.Rd ├── quesnelCHM.Rd ├── quesnelTrees.Rd └── vwf.Rd └── tests ├── testthat.R └── testthat ├── test_data ├── CHM_3amigos.tif ├── CHM_empty.tif ├── CHM_latlon.tif ├── CHM_lowres.tif ├── CHM_orphans.tif ├── CHM_test.tif ├── areas_outside.Rda ├── areas_overlap.Rda ├── areas_partial.Rda ├── glcm-bars.rda ├── glcm-hallbey.rda ├── glcm-noise.rda ├── glcm-psf.rda ├── glcm-tumor.rda ├── ttops_3amigos.Rda ├── ttops_orphans.Rda ├── ttops_orphans.gpkg ├── ttops_test.Rda └── ttops_test.gpkg ├── test_glcm.R ├── test_glcm_internal.R ├── test_mcws.R ├── test_vwf.R └── validation_data ├── glcm ├── bars0.csv ├── bars135.csv ├── bars45.csv ├── bars90.csv ├── hallbey0.csv ├── hallbey135.csv ├── hallbey45.csv ├── hallbey90.csv ├── noise0.csv ├── noise135.csv ├── noise45.csv ├── noise90.csv ├── tumor0.csv ├── tumor135.csv ├── tumor45.csv └── tumor90.csv └── glcm_metrics ├── bars0.csv ├── bars135.csv ├── bars45.csv ├── bars90.csv ├── hallbey0.csv ├── hallbey135.csv ├── hallbey45.csv ├── hallbey90.csv ├── noise0.csv ├── noise135.csv ├── noise45.csv ├── noise90.csv ├── tumor0.csv ├── tumor135.csv ├── tumor45.csv └── tumor90.csv /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^obsolete$ 2 | ^wip$ 3 | ^scratch\.R$ 4 | ^Rcpp_bugs.md$ 5 | ^README\.Rmd$ 6 | ^README-.*\.png$ 7 | ^CRAN-RELEASE$ 8 | ^cran-comments\.md$ 9 | ^tests/create_test_data$ 10 | ^tests/testthat/validation_data/glcm_metrics/obsolete 11 | ^.*\.Rproj$ 12 | ^\.Rproj\.user$ 13 | ^data-raw$ 14 | ^\.github$ 15 | ^man/figures/logo\.psd$ 16 | ^Dockerfile$ 17 | ^CRAN-SUBMISSION$ 18 | ^README.md$ 19 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | branches: [main, master] 8 | 9 | name: R-CMD-check 10 | 11 | jobs: 12 | R-CMD-check: 13 | runs-on: ${{ matrix.config.os }} 14 | 15 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 16 | 17 | strategy: 18 | fail-fast: false 19 | matrix: 20 | config: 21 | - {os: macos-latest, r: 'release'} 22 | - {os: windows-latest, r: 'release'} 23 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} 24 | - {os: ubuntu-latest, r: 'release'} 25 | - {os: ubuntu-latest, r: 'oldrel-1'} 26 | 27 | env: 28 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 29 | R_KEEP_PKG_SOURCE: yes 30 | 31 | steps: 32 | - name: Install XQuartz on macOS 33 | if: runner.os == 'macOS' 34 | run: brew install xquartz --cask 35 | 36 | - uses: actions/checkout@v3 37 | 38 | - uses: r-lib/actions/setup-pandoc@v2 39 | 40 | - uses: r-lib/actions/setup-r@v2 41 | with: 42 | r-version: ${{ matrix.config.r }} 43 | http-user-agent: ${{ matrix.config.http-user-agent }} 44 | use-public-rspm: true 45 | 46 | - uses: r-lib/actions/setup-r-dependencies@v2 47 | with: 48 | extra-packages: any::rcmdcheck 49 | needs: check 50 | 51 | - uses: r-lib/actions/check-r-package@v2 52 | with: 53 | upload-snapshots: true 54 | -------------------------------------------------------------------------------- /.github/workflows/rhub.yaml: -------------------------------------------------------------------------------- 1 | # R-hub's generic GitHub Actions workflow file. It's canonical location is at 2 | # https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml 3 | # You can update this file to a newer version using the rhub2 package: 4 | # 5 | # rhub::rhub_setup() 6 | # 7 | # It is unlikely that you need to modify this file manually. 8 | 9 | name: R-hub 10 | run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}" 11 | 12 | on: 13 | workflow_dispatch: 14 | inputs: 15 | config: 16 | description: 'A comma separated list of R-hub platforms to use.' 17 | type: string 18 | default: 'linux,windows,macos' 19 | name: 20 | description: 'Run name. You can leave this empty now.' 21 | type: string 22 | id: 23 | description: 'Unique ID. You can leave this empty now.' 24 | type: string 25 | 26 | jobs: 27 | 28 | setup: 29 | runs-on: ubuntu-latest 30 | outputs: 31 | containers: ${{ steps.rhub-setup.outputs.containers }} 32 | platforms: ${{ steps.rhub-setup.outputs.platforms }} 33 | 34 | steps: 35 | # NO NEED TO CHECKOUT HERE 36 | - uses: r-hub/actions/setup@v1 37 | with: 38 | config: ${{ github.event.inputs.config }} 39 | id: rhub-setup 40 | 41 | linux-containers: 42 | needs: setup 43 | if: ${{ needs.setup.outputs.containers != '[]' }} 44 | runs-on: ubuntu-latest 45 | name: ${{ matrix.config.label }} 46 | strategy: 47 | fail-fast: false 48 | matrix: 49 | config: ${{ fromJson(needs.setup.outputs.containers) }} 50 | container: 51 | image: ${{ matrix.config.container }} 52 | 53 | steps: 54 | - uses: r-hub/actions/checkout@v1 55 | - uses: r-hub/actions/platform-info@v1 56 | with: 57 | token: ${{ secrets.RHUB_TOKEN }} 58 | job-config: ${{ matrix.config.job-config }} 59 | - uses: r-hub/actions/setup-deps@v1 60 | with: 61 | token: ${{ secrets.RHUB_TOKEN }} 62 | job-config: ${{ matrix.config.job-config }} 63 | - uses: r-hub/actions/run-check@v1 64 | with: 65 | token: ${{ secrets.RHUB_TOKEN }} 66 | job-config: ${{ matrix.config.job-config }} 67 | 68 | other-platforms: 69 | needs: setup 70 | if: ${{ needs.setup.outputs.platforms != '[]' }} 71 | runs-on: ${{ matrix.config.os }} 72 | name: ${{ matrix.config.label }} 73 | strategy: 74 | fail-fast: false 75 | matrix: 76 | config: ${{ fromJson(needs.setup.outputs.platforms) }} 77 | 78 | steps: 79 | - uses: r-hub/actions/checkout@v1 80 | - uses: r-hub/actions/setup-r@v1 81 | with: 82 | job-config: ${{ matrix.config.job-config }} 83 | token: ${{ secrets.RHUB_TOKEN }} 84 | - uses: r-hub/actions/platform-info@v1 85 | with: 86 | token: ${{ secrets.RHUB_TOKEN }} 87 | job-config: ${{ matrix.config.job-config }} 88 | - uses: r-hub/actions/setup-deps@v1 89 | with: 90 | job-config: ${{ matrix.config.job-config }} 91 | token: ${{ secrets.RHUB_TOKEN }} 92 | - uses: r-hub/actions/run-check@v1 93 | with: 94 | job-config: ${{ matrix.config.job-config }} 95 | token: ${{ secrets.RHUB_TOKEN }} 96 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | scratch.R 2 | Rcpp_bugs.md 3 | .Rproj.user 4 | .Rhistory 5 | .RData 6 | .Ruserdata 7 | data-raw 8 | obsolete 9 | tests/create_test_data 10 | tests/testthat/validation_data/glcm_metrics/obsolete 11 | man/figures/logo.psd 12 | Meta 13 | wip 14 | CRAN-SUBMISSION 15 | inst/doc 16 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: ForestTools 2 | Type: Package 3 | Title: Tools for Analyzing Remote Sensing Forest Data 4 | Version: 1.0.3 5 | Date: 2025-02-02 6 | Authors@R: c( 7 | person("Andrew", "Plowright", email = "andrew.plowright@alumni.ubc.ca", role = c("aut", "cre")), 8 | person("Jean-Romain", "Roussel", email = "jean-romain.roussel.1@ulaval.ca", role = c("ctb"), comment = "Contributed to segment-based GLCM segmentation")) 9 | Description: Tools for analyzing remote sensing forest data, including functions for detecting treetops from canopy models, outlining tree crowns, and calculating textural metrics. 10 | Depends: R (>= 4.2) 11 | License: GPL-3 12 | Encoding: UTF-8 13 | LazyData: true 14 | Imports: 15 | terra, 16 | sf, 17 | Matrix, 18 | imager, 19 | GLCMTextures 20 | Suggests: 21 | testthat (>= 3.0.0), 22 | knitr, 23 | rmarkdown 24 | RoxygenNote: 7.3.2 25 | URL: https://github.com/andrew-plowright/ForestTools 26 | BugReports: https://github.com/andrew-plowright/ForestTools/issues 27 | Config/testthat/edition: 3 28 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM achubaty/r-spatial-base 2 | 3 | RUN apt-get update 4 | 5 | RUN apt-get install -y libcairo2-dev libxt-dev 6 | 7 | RUN R -e 'install.packages("ForestTools")' 8 | -------------------------------------------------------------------------------- /ForestTools.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: No 4 | SaveWorkspace: No 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageBuildArgs: --compact-vignettes=both 22 | PackageCheckArgs: --as-cran 23 | PackageRoxygenize: rd,collate,namespace 24 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(glcm) 4 | export(mcws) 5 | export(vwf) 6 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # ForestTools 2 | 3 | ## ForestTools 1.0.3 (2024-01-15) 4 | 5 | Updated compability with newest `GLCMTextures` package. 6 | 7 | ## ForestTools 1.0.2 (2024-04-27) 8 | 9 | Since version 0.2.4, the `glcm` function has used Rcpp code that was inherited from the now-defunct `radiomics` package. My intention was for `ForestTool` to adapt GCLM metrics for segmented tree crowns, not provide the foundational code to compute those metrics. Now that the [GLCMTextures](https://github.com/ailich/GLCMTextures) library is carrying the GLCM computation torch, I have added it as a dependency for `ForestTools`. 10 | 11 | The `glcm` function still works the same way, although it is now 1) a bit faster and 2) calculates fewer metrics. See table below for changes in metrics output by `glcm`. 12 | 13 | Metric | v1.0.1 | v1.0.2 | Notes 14 | -- | -- | -- | -- 15 | glcm_mean | ✔ | ✔ 16 | glcm_variance | ✔ | ✔ 17 | glcm_autoCorrelation | ✔ | 18 | glcm_cProminence | ✔ | 19 | glcm_cShade | ✔ | 20 | glcm_cTendency | ✔ | 21 | glcm_contrast | ✔ | ✔ 22 | glcm_correlation | ✔ | ✔ 23 | glcm_differenceEntropy | ✔ | 24 | glcm_dissimilarity | ✔ | ✔ 25 | glcm_energy | ✔ | 26 | glcm_entropy | ✔ | ✔ 27 | glcm_homogeneity1 | ✔ | ✔ | Renamed to 'glcm_honogeneity' 28 | glcm_homogeneity2 | ✔ | 29 | glcm_IDMN | ✔ | 30 | glcm_IDN | ✔ | 31 | glcm_inverseVariance | ✔ | 32 | glcm_maxProb | ✔ | 33 | glcm_sumAverage | ✔ | ✔ | Renamed to 'glcm_SA' 34 | glcm_sumEntropy | ✔ | 35 | glcm_sumVariance | ✔ | 36 | glcm_ASM | | ✔ 37 | 38 | 39 | 40 | ## ForestTools 1.0.1 (2023-09-27) 41 | 42 | Add additional tests and fixed a few bugs. 43 | 44 | ## ForestTools 1.0.0 (2023-04-10) 45 | 46 | Replaced `raster`, `sf`, and `rgeos` dependencies with `terra` and `sf`. 47 | 48 | Performance improvements for `glcm`. Tests indicate it's now running 2.7x faster than before. 49 | 50 | Removed `glcm_img`. If you would like to generate GLCM statistics for a single, unsegmented image, simply use 51 | `glcm` without a `segs` argument. 52 | 53 | Removed `sp_summarise`. Other packages offered better, more flexible options for summarizing tree-level information by geographical units. If you thought this tool was useful and would like me to restore it, please let me know. 54 | 55 | 56 | ## ForestTools 0.2.6 (2021-09-21) 57 | 58 | Behaviour change for `gclm`: images are now discretized BEFORE segmentation. Note that this will impact the results returned by the function. 59 | 60 | 61 | ## ForestTools 0.2.5 (2021-09-09) 62 | 63 | Added `glcm_img` to allow GLCM statistics to be computed for an entire unsegmented image. 64 | 65 | ## ForestTools 0.2.4 (2021-04-13) 66 | 67 | The `radiomics` package is no longer maintained, so with permission from the author, Joel Carlson, I've integrated the code for computing GLCM statistics into this library 68 | 69 | ## ForestTools 0.2.1 70 | 71 | Added: 72 | 73 | * `kootenayOrtho`, an orthographic image of the area covered by `kootenayCHM`, `kootenayTrees` and `kootenayCrowns` 74 | 75 | New function: 76 | 77 | * `glcm`, for computing textural metrics of a segmented canopy. Thanks to Jean-Romain Roussel for providing code for this function. 78 | 79 | ## ForestTools 0.2.0 80 | 81 | **BACKWARD INCOMPATIBILITY WARNING** 82 | 83 | Although this can cause backward compatibility issues, I felt it was necessary to rename the following functions: 84 | 85 | * `TreetopFinder` -> `vwf` (stands for _Variable Window Filter_) 86 | 87 | * `SegmentCrowns` -> `mcws` (stands for _Marker-Controlled Watershed Segmentation_) 88 | 89 | * `SpatialStatistics` -> `sp_summarise` 90 | 91 | Reasons for the changes are: 92 | 93 | 1. To follow the convention of avoiding capitalized function names. 94 | 2. To bring more specificity to the underlying algorithms involved. 95 | 3. To credit the developers of said algorithms by using the names assigned to them. 96 | 4. To acknowledge the fact that alternative algorithms are available for both finding trees and segmenting crowns. 97 | 98 | In addition, I've made the following changes to `vwf` (formerly `TreetopFinder`): 99 | 100 | * Extended the default value of the `maxWinDiameter` argument to 99. Note that this value sets the maximum width in _cells_ of the widest allowable window diameter. As explained in the documentation, this argument is to prevent the function from gobbling up too much memory, and can be disabled by setting to NULL. 101 | * In addition to controlling the _maximum_ window diameter, the user can now tweak the behavior of the _minimum_ diameter as well. Essentially, the smallest window will always be a 3x3 cell window, regardless of the computed window radius. The neighborhood of this smallest window can be set to either [a rook or a queen case contiguity](https://i.stack.imgur.com/CWIHi.jpg) using the `minWinNeib` argument. 102 | * I've removed the function's compatibility with the `TileManager` package. Although I had put considerable effort into adding this feature initially, I've realized that A) no one was using it, B) it is preferable for the user to manage tiles him or herself instead of having them managed "under the hood" by the `vwf` function. Let me know if you thought this feature was useful and perhaps I can write a vignette suggesting preferable ways to manage a tiled CHM. 103 | 104 | ## ForestTools 0.1.5 105 | 106 | * Fixed a persistent bug in 'TreeTopFinder' whereby CHMs with imprecise cell sizes (i.e.: cell dimensions that aren't accurate after a certain number of decimals), would cause issues with the shape of the focal windows. Internally, CHM cell dimensions are now rounded to the fifth decimal. 107 | 108 | ## ForestTools 0.1.4 109 | 110 | * Add a new option for generating polygonal tree crowns with 'SegmentCrowns' using GDAL utilities from OSGeo4W. See documentation for 'SegmentCrowns' as well as new vignette: "Options for creating polygonal crown maps". 111 | 112 | ## ForestTools 0.1.2 113 | 114 | * Added the 'Quesnel' dataset. Added a new vignette: "Calculating inventory attributes using Forest Tools". 115 | 116 | ## ForestTools 0.1.1 117 | 118 | * Modified 'SegmentCrowns' function so that it can produce tree crowns in polygon format. The function will also calculate crown area, and filter out crowns that are not associated with a treetop point location. 119 | 120 | * Changed name of 'TreeTopSummary' function to 'SpatialStatistics'. This reflects its new functionality, which allows crown maps to be inputted as well as treetop locations. 121 | 122 | ## ForestTools 0.1.0 123 | 124 | * Initial release of ForestTools 125 | 126 | -------------------------------------------------------------------------------- /R/Kootenay.R: -------------------------------------------------------------------------------- 1 | #' Kootenay forest - Canopy height model 2 | #' 3 | #' A canopy height model of a 1.5 hectare section of forest in the Kootenay mountains, in 4 | #' British Columbia, Canada. 5 | #' 6 | #' @format PackedSpatRaster object 7 | #' \describe{Cell values are equal to canopy height above ground (in meters)} 8 | #' @source Data acquired from a photogrammetric drone survey performed by Spire Aerobotics 9 | #' on June 16th, 2016. 10 | #' @seealso \link{kootenayTrees} \link{kootenayBlocks} \link{kootenayCrowns} \link{kootenayOrtho} 11 | "kootenayCHM" 12 | 13 | #' Kootenay forest - Dominant trees over 2 m 14 | #' 15 | #' Dominant trees from a 1.5 hectare section of forest in the Kootenay mountains, in 16 | #' British Columbia, Canada. Trees were detected by applying the \code{\link{vwf}} 17 | #' function to the \link{kootenayCHM} raster dataset. Only trees over 2 m above ground 18 | #' were detected. 19 | #' 20 | #' @format Simple point feature collection with the following attributes: 21 | #' \describe{ 22 | #' \item{height}{height of the tree's apex, in meters above ground} 23 | #' \item{winRadius}{radius of the moving window (see \code{\link{vwf}}) at 24 | #' the treetop's location} 25 | #' } 26 | #' @seealso \link{kootenayCHM} \link{kootenayBlocks} \link{kootenayCrowns} \link{kootenayOrtho} 27 | "kootenayTrees" 28 | 29 | #' Kootenay forest - Cut blocks 30 | #' 31 | #' Boundaries of cut blocks within a 1.5 hectare section of forest in 32 | #' the Kootenay mountains, in British Columbia, Canada. Each block contains trees of different 33 | #' levels of maturity. Overlaps with \link{kootenayTrees}, \link{kootenayCrowns}, \link{kootenayOrtho} and \link{kootenayCHM}. 34 | #' 35 | #' @format Simple polygon feature collection with the following attributes: 36 | #' \describe{ 37 | #' \item{BlockID}{numerical identifier for each block} 38 | #' \item{Shape_Leng}{length of polygon on meters} 39 | #' \item{Shape_Area}{area of polygon in square meters} 40 | #' } 41 | #' @seealso \link{kootenayTrees} \link{kootenayCHM} \link{kootenayCrowns} \link{kootenayOrtho} 42 | "kootenayBlocks" 43 | 44 | #' Kootenay forest - Tree crowns 45 | #' 46 | #' Outlines of tree crowns corresponding to the \link{kootenayTrees} treetops. Generated using \link{mcws}. 47 | #' 48 | #' @format Simple polygon feature collection with the following attributes: 49 | #' \describe{ 50 | #' \item{height}{height of the tree's apex, in meters above ground. Inherited from \link{kootenayTrees}.} 51 | #' \item{winRadius}{radius of the moving window at the treetop's location. Inherited from \link{kootenayTrees}.} 52 | #' \item{crownArea}{area of crown outline in square meters} 53 | #' } 54 | #' @seealso \link{kootenayTrees} \link{kootenayCHM} \link{kootenayBlocks} \link{kootenayOrtho} 55 | "kootenayCrowns" 56 | 57 | 58 | 59 | #' Kootenay forest - Orthomosaic 60 | #' 61 | #' An orthomosaic of a 1.5 hectare section of forest in the Kootenay mountains, in 62 | #' British Columbia, Canada. 63 | #' 64 | #' @format PackedSpatRaster object 65 | #' \describe{Cell values are equal to canopy height above ground (in meters)} 66 | #' @source Data acquired from a photogrammetric drone survey performed by Spire Aerobotics 67 | #' on June 16th, 2016. 68 | #' @seealso \link{kootenayTrees} \link{kootenayBlocks} \link{kootenayCrowns} \link{kootenayCHM} 69 | "kootenayOrtho" 70 | -------------------------------------------------------------------------------- /R/Quesnel.R: -------------------------------------------------------------------------------- 1 | #' Quesnel forest - Canopy height model 2 | #' 3 | #' A canopy height model of a 125 hectare section of forest in the Quesnel Timber Supply Area, in 4 | #' British Columbia, Canada. 5 | #' 6 | #' @format PackedSpatRaster object 7 | #' \describe{Cell values are equal to canopy height above ground (in meters)} 8 | #' @source Data acquired from a photogrammetric drone survey performed by Spire Aerobotics 9 | #' on September 15th, 2016. 10 | #' @seealso \link{quesnelTrees} \link{quesnelBlocks} 11 | "quesnelCHM" 12 | 13 | #' Quesnel forest - Dominant trees over 2 m 14 | #' 15 | #' Dominant trees from a 125 hectare section of forest in the Quesnel Timber Supply Area, in 16 | #' British Columbia, Canada. Trees were detected by applying the \code{\link{vwf}} 17 | #' function to the \link{quesnelCHM} raster dataset. Only trees over 2 m above ground 18 | #' were detected. 19 | #' 20 | #' @format Simple point feature collection with the following attributes: 21 | #' \describe{ 22 | #' \item{height}{height of the tree's apex, in meters above ground} 23 | #' \item{winRadius}{radius of the moving window (see \code{\link{vwf}}) at 24 | #' the treetop's location} 25 | #' } 26 | #' @seealso \link{quesnelCHM} \link{quesnelBlocks} 27 | "quesnelTrees" 28 | 29 | #' Quesnel forest - Cut blocks 30 | #' 31 | #' Boundaries of cut blocks within a 125 hectare section of forest in the Quesnel Timber Supply Area, 32 | #' in British Columbia, Canada. Each block contains trees of different 33 | #' levels of maturity. Overlaps with \link{quesnelTrees} and \link{quesnelCHM}. 34 | #' 35 | #' @format Simple polygon feature collection with the following attributes: 36 | #' \describe{ 37 | #' \item{BlockID}{numerical identifier for each block} 38 | #' \item{Shape_Leng}{length of polygon on meters} 39 | #' \item{Shape_Area}{area of polygon in square meters} 40 | #' } 41 | #' @seealso \link{quesnelTrees} \link{quesnelCHM} 42 | "quesnelBlocks" 43 | -------------------------------------------------------------------------------- /R/glcm.R: -------------------------------------------------------------------------------- 1 | #' Grey-Level Co-Occurrence Matrix 2 | #' 3 | #' Generate textural metrics using Grey-Level Co-Occurrence Matrices (GLCM). Can be applied to an entire or image or, if a coterminous 4 | #' raster of segments is provided, GLCM can be calculated for each segment. 5 | #' 6 | #' @param image SpatRaster. A single-band raster layer from which texture is measured 7 | #' @param segs SpatRaster. A segmented raster. Cell values should be equal to segment numbers. If \code{segs} are not provided, 8 | #' GLCM will be calculated for the entire image. 9 | #' @param n_grey integer. Number of grey levels into which the image will be discretized 10 | #' @param angle integer. Angle at which GLCM will be calculated. Ex.: `c(0,1)` 11 | #' @param discretize_range numeric. Vector of two values indicating the minimum and maximum input values for discretizing the image. 12 | #' This can be useful when processing tiles of a larger image, for which you may want to impose a consistent value range. 13 | #' 14 | #' @return data.frame 15 | #' 16 | #' @references Parmar, C., Velazquez, E.R., Leijenaar, R., Jermoumi, M., Carvalho, S., Mak, R.H., Mitra, S., Shankar, B.U., Kikinis, R., Haibe-Kains, B. and Lambin, P. (2014). 17 | #' \emph{Robust radiomics feature quantification using semiautomatic volumetric segmentation. PloS one, 9}(7) 18 | #' 19 | #' @seealso \code{\link{mcws}} 20 | #' 21 | #' @examples 22 | #' \dontrun{ 23 | #' library(terra) 24 | #' library(ForestTools) 25 | #' 26 | #' chm <- rast(kootenayCHM) 27 | #' image <- rast(kootenayOrtho)[[1]] 28 | #' 29 | #' # Generate raster segments 30 | #' segs <- mcws(kootenayTrees, chm, minHeight = 0.2, format = "raster") 31 | #' 32 | #' # Get textural metrics for ortho's red band 33 | #' tex <- glcm(image, segs) 34 | #' } 35 | #' 36 | #' @export 37 | 38 | glcm <- function(image, segs = NULL, n_grey = 32, angle = c(0,1), discretize_range = NULL){ 39 | 40 | # Check image 41 | if(any(dim(image) == 0)) stop("'image' must contain usable values") 42 | if(terra::nlyr(image) > 1) stop("'image' should have a single band") 43 | if(all(!is.finite(image[]))) stop("'image' must contain usable values") 44 | 45 | # Discretize image (this will replace NAs with 0) 46 | img_disc <- .discretize_rast(image, n_grey, discretize_range) 47 | 48 | # Compute GLCM for whole image 49 | if(is.null(segs)){ 50 | 51 | # Convert to matrix 52 | img_mat <- terra::as.matrix(img_disc, wide = TRUE) 53 | 54 | # 'GLCMTextures' wants the range to be 0 to n_grey-1 55 | img_mat <- img_mat - 1 56 | 57 | # Compute GLCM 58 | seg_glcm <- GLCMTextures::make_glcm(img_mat, n_levels=n_grey, shift=angle, na.rm=TRUE) 59 | 60 | # Compute GLCM metrics 61 | out_glcm <- GLCMTextures::glcm_metrics(seg_glcm) 62 | 63 | }else{ 64 | 65 | # Check segments 66 | if(all(!is.finite(segs[]))) stop("'segs' must contain usable values") 67 | terra::compareGeom(segs, image, res = TRUE) 68 | 69 | # Convert image to data.frame 70 | img_df = data.frame( 71 | terra::rowColFromCell(image, 1:(terra::ncell(img_disc))), 72 | val = img_disc[drop = TRUE] 73 | ) 74 | names(img_df)[1:3] <- c("row", "col", "val") 75 | 76 | # Split according to segment values 77 | seg_dfs <- split(img_df, segs[drop = TRUE]) 78 | 79 | # Remove non-finite segments 80 | seg_dfs <- seg_dfs[!names(seg_dfs) %in% c("Inf", "-Inf", "NaN", "NA")] 81 | 82 | # Make empty row 83 | empty_row <- GLCMTextures::glcm_metrics(matrix()) 84 | 85 | # Create worker function 86 | .glcm_by_seg <- function(seg_df){ 87 | 88 | seg_df[,"row"] <- seg_df[,"row"] - min(seg_df[,"row"]) + 1 89 | seg_df[,"col"] <- seg_df[,"col"] - min(seg_df[,"col"]) + 1 90 | 91 | if(all(is.na(seg_df[["val"]]))) return(empty_row) 92 | 93 | # NOTE: any space around the segment is filled by 0s at this stage 94 | seg_mat <- as.matrix(Matrix::sparseMatrix(i = seg_df[,"row"], j = seg_df[,"col"], x = seg_df[,"val"])) 95 | 96 | # 'sparseMatrix' doesn't allow 0s, so the original discretization will convert values to 1 to n_grey. 97 | # 'GLCMTextures', on the other hand, wants the range to be 0 to n_grey-1, and also wants NA values to be NA 98 | # Even if this involves extra steps, using 'sparseMatrix' is 10x faster than converting the data.frame 99 | # using 'terra' 100 | seg_mat[seg_mat == 0] <- NA 101 | seg_mat <- seg_mat - 1 102 | 103 | # Compute GLCM 104 | seg_glcm <- GLCMTextures::make_glcm(seg_mat, n_levels=n_grey, shift=angle, na.rm = T) 105 | 106 | # Compute GLCM metrics 107 | seg_metrics <- GLCMTextures::glcm_metrics(seg_glcm) 108 | 109 | return(seg_metrics) 110 | } 111 | 112 | # Apply worker to compute GLCMs 113 | out_glcm <- as.data.frame(do.call(rbind, lapply(seg_dfs, .glcm_by_seg))) 114 | 115 | # Test code for finding which segment is causing a bug 116 | # if(false){ 117 | # for(i in 1:length(seg_dfs)){ 118 | # cat(i,"\n") 119 | # seg_df <- seg_dfs[[i]] 120 | # .glcm_by_seg(seg_df) 121 | # } 122 | # } 123 | 124 | # Return result 125 | row.names(out_glcm) <- names(seg_dfs) 126 | } 127 | 128 | return(out_glcm) 129 | } 130 | 131 | 132 | .discretize_rast <- function(image, n_grey, discretize_range = NULL){ 133 | 134 | # Get range 135 | if(is.null(discretize_range)){ 136 | img_range <- terra::minmax(image, compute = TRUE) 137 | img_min <- img_range[1,] 138 | img_max <- img_range[2,] 139 | }else{ 140 | 141 | img_min <- min(discretize_range) 142 | img_max <- max(discretize_range) 143 | } 144 | 145 | if(img_min == img_max){ 146 | 147 | # This neatly sets NA to 0 and everything else to 1 148 | new_values <- as.integer(is.finite(image[drop = TRUE])) 149 | 150 | }else{ 151 | 152 | breaks <- seq(img_min, img_max, length.out=(n_grey + 1)) 153 | 154 | levels <- seq(1, n_grey, 1) 155 | 156 | new_values <- as.integer(cut(image[drop = TRUE], breaks = breaks, labels = levels, include.lowest = TRUE, right = FALSE)) 157 | } 158 | 159 | terra::setValues(image, new_values) 160 | } 161 | -------------------------------------------------------------------------------- /R/mwcs.R: -------------------------------------------------------------------------------- 1 | #' Marker-Controlled Watershed Segmentation 2 | #' 3 | #' This function implements the \link[imager]{watershed} function to segment (i.e.: outline) crowns from a CHM (canopy height model). 4 | #' Segmentation is guided by the point locations of treetops, typically detected using the \link{vwf} function. 5 | #' See Meyer & Beucher (1990) for details on watershed segmentation. 6 | #' 7 | #' Crown segments are returned as either a \code{SpatRaster} or a \code{sf} (Simple Feature) class object, 8 | #' as defined using the \code{format} argument. For many analytic purposes, it is preferable to have 9 | #' crown outlines as polygons. However, polygonal crown maps take up significantly more disk space, and take 10 | #' longer to process. It is advisable to run this function using a raster output first to review 11 | #' results and adjust parameters. 12 | #' 13 | #' NOTE: when setting \code{format} to 'polygons', orphaned segments (i.e.: outlines without an associated treetop) will be removed. 14 | #' This will NOT occur using 'raster' format. This issue will be resolved eventually but requires the watershed function to 15 | #' be rewritten. 16 | #' 17 | #' @param treetops sf. The point locations of treetops in \code{sf} format. 18 | #' @param CHM SpatRaster. Canopy height model in \code{SpatRaster} format. This should be the same CHM that was used to the detect the \code{treetops}. 19 | #' @param minHeight numeric. The minimum height value for a \code{CHM} pixel to be considered as part of a crown segment. 20 | #' All \code{CHM} pixels beneath this value will be masked out. Note that this value should be lower than the minimum 21 | #' height of \code{treetops}. 22 | #' @param format string. Format of the function's output. Can be set to either 'raster' or 'polygons'. 23 | #' @param OSGeoPath character. Obsolete. Will be removed next version 24 | #' @param IDfield character. Name of the field for storing the unique tree identifier 25 | #' 26 | #' @return Depending on the setting for \code{format}, this function will return a map of outlined 27 | #' crowns as either a \code{SpatRaster} class object, in which distinct crowns are given a unique cell value, or a \code{sf} class object, in which each crown 28 | #' is represented by a polygon. 29 | #' 30 | #' @references Meyer, F., & Beucher, S. (1990). Morphological segmentation. \emph{Journal of visual communication and 31 | #' image representation, 1}(1), 21-46. 32 | #' 33 | #' @seealso \code{\link{vwf}} 34 | #' 35 | #' @examples 36 | #' \dontrun{ 37 | #' library(terra) 38 | #' library(ForestTools) 39 | #' 40 | #' chm <- rast(kootenayCHM) 41 | #' 42 | #' # Use variable window filter to detect treetops 43 | #' ttops <- vwf(chm, winFun = function(x){x * 0.06 + 0.5}, minHeight = 2) 44 | #' 45 | #' # Segment tree crowns 46 | #' segs <- mcws(ttops, chm, minHeight = 1) 47 | #' } 48 | #' 49 | #' @export 50 | 51 | mcws <- function(treetops, CHM, minHeight = 0, format = "raster", OSGeoPath = NULL, IDfield = "treeID"){ 52 | 53 | if(!is.null(OSGeoPath)) message("'OSGeoPath' argument is now obsolete. Rasters are polygonized using the new 'terra' package now.") 54 | 55 | ### INPUTS ---- 56 | 57 | # Convert 'raster' and 'sp' class types to 'terra' and 'sf' 58 | if(inherits(treetops, "SpatialPointsDataFrame")) treetops <- sf::st_as_sf(treetops) 59 | if(inherits(CHM, "RasterLayer")) CHM <- terra::rast(CHM) 60 | 61 | # Check classes for 'treetops' and 'CHM' 62 | if(!inherits(treetops, "sf") || sf::st_geometry_type(treetops, by_geometry = FALSE) != "POINT") stop("Invalid input: 'treetops' should be 'sf' class with 'POINT' geometry") 63 | if(!inherits(CHM, 'SpatRaster')) stop("Invalid input: CHM should be a 'SpatRaster' class") 64 | 65 | # Ensure that 'format' is set to either 'raster' or 'polygons'. 66 | if(!toupper(format) %in% c("RASTER", "POLYGONS", "POLYGON", "POLY")) stop("Invalid input: 'format' must be set to either 'raster' or 'polygons'") 67 | 68 | # Get maximum height and ensure that 'minHeight' does not exceed it 69 | CHM_max <- terra::global(CHM, fun = max, na.rm = TRUE)[1,"max"] 70 | if(!is.finite(CHM_max)) stop("'CHM' does not contain any usable values.") 71 | if(minHeight > CHM_max) stop("'minHeight' is set higher than the highest cell value in 'CHM'") 72 | 73 | # Remove treetops that are not within the CHM's input extent, or whose height is lower than 'minHeight' 74 | treetop_heights <- terra::extract(CHM, treetops)[,2] 75 | treetops <- treetops[!is.na(treetop_heights) & treetop_heights >= minHeight,] 76 | if(length(treetops) == 0){stop("No usable treetops. Treetops are either outside of CHM's extent, or are located below the 'minHeight' value")} 77 | 78 | 79 | ### CHECK UNIQUE IDENTIFIER ---- 80 | 81 | # Check existence of 'IDfield' 82 | if(!IDfield %in% names(treetops)) stop("Could not find ID field '", IDfield, "' in 'treetops' object") 83 | treetops[[IDfield]] <- as.integer(treetops[[IDfield]]) 84 | if(any(treetops[[IDfield]] == 0)) stop("'ID field cannot be equal to 0") 85 | if(any(is.na(treetops[[IDfield]]))) stop("ID field cannot contain NA values") 86 | if(any(duplicated(treetops[[IDfield]]))) warning("ID field cannot have duplicated values") 87 | 88 | 89 | ### APPLY WATERSHED SEGMENTATION ---- 90 | 91 | # Create NA mask 92 | CHM_mask <- CHM < minHeight 93 | CHM_mask[is.na(CHM)] <- TRUE 94 | 95 | # Replace NAs temporarily with 0s (the 'imager' functions cannot handle NA values) 96 | CHM[CHM_mask] <- 0 97 | 98 | # Convert treetops to a raster 99 | treetops_ras <- terra::rasterize(treetops, CHM, field = IDfield, background = 0) 100 | 101 | # Convert data to 'img' files 102 | CHM_img <- imager::as.cimg(terra::as.matrix(CHM, wide = TRUE)) 103 | ttops_img <- imager::as.cimg(terra::as.matrix(treetops_ras, wide = TRUE)) 104 | 105 | # Apply watershed function 106 | ws_img <- imager::watershed(ttops_img, CHM_img) 107 | 108 | # Convert watershed back to raster 109 | ws_ras <- terra::rast(as.matrix(ws_img), extent = terra::rast(CHM), crs = terra::crs(CHM)) 110 | ws_ras[CHM_mask] <- NA 111 | 112 | 113 | ### RETURN POLYGONS ---- 114 | 115 | if(toupper(format) %in% c("POLYGONS", "POLYGON", "POLY")){ 116 | 117 | # Convert raster to polygons 118 | polys <- sf::st_as_sf(terra::as.polygons(ws_ras, dissolve = TRUE)) 119 | 120 | # Cast to MULTIPOLYGONS (this avoids introducing weird stuff like GEOMETRY COLLECTION) 121 | polys <- sf::st_cast(polys, "MULTIPOLYGON") 122 | 123 | # Split apart multi polygons 124 | polys <- sf::st_cast(polys, "POLYGON", warn = FALSE) 125 | 126 | if(nrow(polys) == 0) stop("No segments created") 127 | 128 | names(polys)[1] <- IDfield 129 | row.names(polys) <- 1:nrow(polys) 130 | 131 | # Perform spatial overlay, transfer data from treetops to polygons 132 | polys_out <- polys[lengths(sf::st_intersects(polys, treetops)) > 0,] 133 | 134 | # Remove polygons with no associated treetops 135 | polys_out <- polys_out[!is.na(polys_out[[IDfield]]),] 136 | 137 | if(any(duplicated(polys_out[[IDfield]]))) stop("Multiple segments with same ID field. Check for duplicated treetops") 138 | 139 | return(polys_out) 140 | 141 | 142 | ### RETURN RASTER ---- 143 | 144 | }else{ 145 | 146 | # Remove "orphaned" segments. NOTE: The 'watershed' algorithm needs to be rewritten to avoid this whole thing 147 | # 148 | # NOTE: Currently deactivated cause it's too slow 149 | # 150 | # ws_patches <- terra::patches(ws_ras) 151 | # ws_patches_valid <- unique(terra::extract(ws_patches, treetops)[,2]) 152 | # ws_ras[!ws_patches %in% ws_patches_valid] <- NA 153 | 154 | return(ws_ras) 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /R/vwf.R: -------------------------------------------------------------------------------- 1 | #' Variable Window Filter 2 | #' 3 | #' Implements the variable window filter algorithm (Popescu & Wynne, 2004) for detecting treetops from a canopy height model. 4 | #' 5 | #' This function uses the resolution of the raster to figure out how many cells the window needs to cover. 6 | #' This means that the raster value (representing height above ground) and the map unit (represented by the raster's resolution), 7 | #' need to be in the _same unit_. This can cause issues if the raster is in lat/lon, whereby its resolution is in decimal degrees. 8 | #' 9 | #' @param CHM SpatRaster. Canopy height model in SpatRaster format. 10 | #' @param winFun function. The function that determines the size of the window at any given location on the 11 | #' canopy. It should take the value of a given \code{CHM} pixel as its only argument, and return the desired *radius* of 12 | #' the circular search window when centered on that pixel. Size of the window is in map units. 13 | #' @param minHeight numeric. The minimum height value for a \code{CHM} pixel to be considered as a potential treetop. All \code{CHM} pixels beneath 14 | #' this value will be masked out. 15 | #' @param warnings logical. If set to FALSE, this function will not emit warnings related to inputs. 16 | #' @param minWinNeib character. Define whether the smallest possible search window (3x3) should use a \code{queen} or 17 | #' a \code{rook} neighborhood. 18 | #' @param IDfield character. Name of field for unique tree identifier 19 | #' @param resolution_round integer. The raster resolution is used to compute the dimensions of the search windows. By default, this resolution is rounded 20 | #' to 5 decimal places. The number of decimal places can be changed using this parameter. Increasing this value is also a work-around for warnings 21 | #' relating to non-square cell sizes. 22 | #' 23 | #' @references Popescu, S. C., & Wynne, R. H. (2004). Seeing the trees in the forest. \emph{Photogrammetric Engineering & Remote Sensing, 70}(5), 589-604. 24 | #' 25 | #' @return Simple feature collection of POINT type. The point locations of detected treetops. The object contains two fields in its 26 | #' data table: \emph{height} is the height of the tree, as extracted from the \code{CHM}, and \emph{winRadius} is the radius 27 | #' of the search window when the treetop was detected. Note that \emph{winRadius} does not necessarily correspond to the radius 28 | #' of the tree's crown. 29 | #' 30 | #' @seealso \code{\link{mcws}} 31 | #' 32 | #' @examples 33 | #' \dontrun{ 34 | #' library(terra) 35 | #' library(ForestTools) 36 | #' 37 | #' chm <- rast(kootenayCHM) 38 | #' 39 | #' # Set function for determining variable window radius 40 | #' winFunction <- function(x){x * 0.06 + 0.5} 41 | #' 42 | #' # Set minimum tree height (treetops below this height will not be detected) 43 | #' minHgt <- 2 44 | #' 45 | #' # Detect treetops in demo canopy height model 46 | #' ttops <- vwf(chm, winFunction, minHgt) 47 | #' } 48 | #' 49 | #' @export 50 | 51 | vwf <- function(CHM, winFun, minHeight = NULL, warnings = TRUE, minWinNeib = "queen", IDfield = "treeID", resolution_round = 5){ 52 | 53 | ### CHECK INPUTS ---- 54 | 55 | if("RasterLayer" %in% class(CHM)) CHM <- terra::rast(CHM) 56 | 57 | # Check for valid inputs for 'minWinNeib' 58 | if(!minWinNeib %in% c("queen", "rook")) stop("Invalid input for 'minWinNeib'. Set to 'queen' or 'rook'") 59 | 60 | # Check for unprojected rasters 61 | if(warnings && (terra::crs(CHM) != "") && terra::is.lonlat(CHM)){ 62 | warning("The input CHM has a lat/lon coordinate system. Projected coordinate systems are recommended.") 63 | } 64 | 65 | # Round out CHM resolution to fifth decimal and check that CHM has square cells. 66 | # Rounding is necessary since a lack of precision in CHM cell size call cause the 67 | # 'focalWeight' function to misbehave 68 | res_round <- round(terra::res(CHM), resolution_round) 69 | if(warnings && (res_round[1] != res_round[2])) warning("Input 'CHM' does not have square cells") 70 | if(res_round[1] == 0) stop("The map units of the 'CHM' are too small") 71 | 72 | # Ensure that 'minHeight' argument is given a positive value 73 | if(!is.null(minHeight) && minHeight <= 0) stop("Minimum canopy height must be set to a positive value.") 74 | 75 | # Get range of CHM values 76 | CHM_rng <- terra::minmax(CHM, compute = TRUE)[,1, drop = TRUE] 77 | 78 | # Check if CHM has usable values 79 | if(any(!is.finite(CHM_rng))) stop("Could not compute min/max range of CHM. The CHM may contain unusable values.") 80 | 81 | 82 | ### APPLY MINIMUM CANOPY HEIGHT ---- 83 | 84 | if(!is.null(minHeight)){ 85 | 86 | if(minHeight >= CHM_rng["max"]) stop("'minHeight' is set to a value higher than the highest cell value in 'CHM'") 87 | 88 | # Mask sections of CHM that are lower than 'minHeight' 89 | if(minHeight > CHM_rng["min"]){ 90 | 91 | CHM[CHM < minHeight] <- NA 92 | CHM_rng["min"] <- minHeight 93 | } 94 | } 95 | 96 | 97 | ### CREATE WINDOWS ---- 98 | 99 | # Here, the variably sized windows used for detecting trees are "pre-generated". First, a series of 'win_radii' 100 | # is generated, representing all the sizes the windows can take based on the range of potential values returned 101 | # by 'winFun'. These radii are then converted to binary matrices, where values of 1 represent the circular shape 102 | # of each window. These matrices are then converted to vectors and 103 | 104 | # Generate a list of radii 105 | seq_floor <- .rounder(winFun(CHM_rng["min"]), interval = res_round[1], direction = "down") 106 | seq_ceiling <- .rounder(winFun(CHM_rng["max"]), interval = res_round[1], direction = "up") 107 | if(is.infinite(seq_floor)) seq_floor <- 0 # Watch out for parabola! 108 | win_radii <- seq(seq_floor, seq_ceiling, by = res_round[1]) 109 | 110 | # Remove radii that are smaller than the CHM's resolution 111 | win_radii <- win_radii[win_radii >= res_round[1]] 112 | if(warnings && length(win_radii) == 0){ 113 | warning( 114 | "The maximum window radius computed with 'winFun' is smaller than the CHM's resolution\n", 115 | "A 3x3 cell search window will be uniformly applied\n", 116 | "Use a higher resolution 'CHM' or adjust 'winFun' to produce wider dynamic windows" 117 | ) 118 | win_radii <- res_round[1] 119 | } 120 | 121 | # Calculate the dimensions of the largest matrix to be created from the generated list of radii. 122 | # Note that it needs to be an uneven integer 123 | win_diam <- ceiling((max(win_radii) / res_round[1]) * 2) 124 | if (win_diam %% 2 == 0) win_diam <- win_diam + 1 125 | 126 | # Check if input formula will yield a particularly wide window diameter 127 | if(warnings && win_diam > 100) warning( 128 | "Input function for 'winFun' yields a window diameter of ", win_diam, "which is particularly large.\n", 129 | "Adjusting the 'winFun' function is recommended." 130 | ) 131 | 132 | # Convert radii into windows 133 | windows <- lapply(win_radii, function(radius){ 134 | 135 | # Based on the unit size of the input CHM and a given radius, this function will create a matrix whose non-zero 136 | # values will form the shape of a circular window 137 | win_mat <- terra::focalMat(terra::rast(resolution = res_round), radius, type="circle") 138 | 139 | # Apply Queen's neighborhood if circle is 3x3 140 | if(nrow(win_mat) == 3 && minWinNeib == "queen") win_mat[] <- 1 141 | 142 | # Pad the window to the size of the biggest matrix created from the list of radii 143 | win_pad <- terra::extend(terra::rast(win_mat), (win_diam - ncol(win_mat)) /2, fill = 0) 144 | 145 | # The matrix values are then transformed into a vector 146 | win_vec <- as.vector(win_pad != 0) 147 | 148 | return(win_vec) 149 | 150 | }) 151 | names(windows) <- win_radii 152 | 153 | 154 | ### APPLY VWF FUNCTION ---- 155 | 156 | # Apply local maxima-finding function to raster 157 | local_max_ras <- terra::focal( 158 | CHM, 159 | matrix(1, win_diam, win_diam), 160 | fun = .variable_window, 161 | windows = windows, 162 | winFun = winFun) 163 | 164 | # Convert to points 165 | local_max_pts <- sf::st_as_sf(terra::as.points(local_max_ras, na.rm = TRUE, values = TRUE)) 166 | names(local_max_pts)[1] <- 'height' 167 | 168 | # Add 'winRadius' and ID field 169 | local_max_pts[["winRadius"]] <- winFun(local_max_pts[["height"]]) 170 | local_max_pts[[IDfield]] <- 1:nrow(local_max_pts) 171 | local_max_pts <- local_max_pts[,c(IDfield, "height", "winRadius", "geometry")] 172 | 173 | ### RETURN OUTPUT ---- 174 | 175 | return(local_max_pts) 176 | 177 | } 178 | 179 | 180 | .variable_window <- function(x, windows, winFun, ...){ 181 | 182 | # Locate central value in the moving window. 183 | centralValue <- x[length(x) / 2 + 0.5] 184 | 185 | # If central value is NA, then return NA. 186 | if(is.na(centralValue)){ 187 | 188 | return(NA) 189 | 190 | }else{ 191 | 192 | # Calculate the expected crown radius. 193 | radius <- winFun(centralValue) 194 | 195 | # Retrieve windows size closest to radius 196 | window <- windows[[which.min(abs(as.numeric(names(windows)) - radius))]] 197 | 198 | # If the central value is the highest value within the variably-sized window (i.e.: local maxima), return 1. If not, return 0. 199 | return(if(max(x[window], na.rm = TRUE) == centralValue) centralValue else NA) 200 | } 201 | } 202 | 203 | .rounder <- function(value, interval, direction){ 204 | 205 | if(direction == "up") return(interval * ceiling(value / interval)) 206 | if(direction == "down") return(interval * floor( value / interval)) 207 | } 208 | 209 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ForestTools 2 | ====================================================================================================== 3 | ![license](https://img.shields.io/badge/Licence-GPL--3-blue.svg) 4 | [![](https://www.r-pkg.org/badges/version/ForestTools)](https://www.r-pkg.org/pkg/ForestTools) 5 | [![R-CMD-check](https://github.com/andrew-plowright/ForestTools/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/andrew-plowright/ForestTools/actions/workflows/R-CMD-check.yaml) 6 | [![](https://cranlogs.r-pkg.org/badges/ForestTools)](https://CRAN.R-project.org/package=ForestTools) 7 | 8 | The ForestTools R package offers functions to analyze remote sensing forest data. Please consult the [NEWS.md](NEWS.md) file for updates. 9 | 10 | To get started, consult the [canopy analysis tutorial](inst/guides/treetop_analysis.md). For a quick guide on generating spatial statistics from ForestTools outputs, consult the [spatial statistics tutorial](inst/guides/spatial_statistics.md) 11 | 12 | To cite the package use `citation("ForestTools")` from within R. 13 | 14 | ``` 15 | Plowright A. (2023). ForestTools: Tools for Analyzing Remote Sensing Forest Data. R package version 1.0.2, 16 | https://github.com/andrew-plowright/ForestTools. 17 | ``` 18 | 19 | ## Features 20 | 21 | ### Detect and segment trees 22 | 23 | Individual trees can be detected and delineated using a combination of the 24 | **variable window filter** (`vwf`) and **marker-controlled watershed segmentation** 25 | (`mcws`) algorithms, both of which are applied to a rasterized **canopy height model (CHM)**. 26 | CHMs are typically derived from aerial LiDAR or photogrammetric point clouds. 27 | 28 | ![image info](./man/figures/treetops_segments.png) 29 | 30 | ### Compute textural metrics 31 | 32 | **Grey-level co-occurrence matrices** (GLCMs) and their associated statistics can be computed for individual trees using a single-band 33 | image and a segment raster (which can be produced using `mcws`). These metrics can be used as predictors for tree classification. 34 | 35 | 36 | ## References 37 | 38 | This library implements techniques developed in the following studies: 39 | 40 | * **Variable window filter**: [Seeing the trees in the forest](https://www.ingentaconnect.com/content/asprs/pers/2004/00000070/00000005/art00003) by Popescu, S. C., & Wynne, R. H. (2004) 41 | * **Marker-controlled watershed segmentation**: [Morphological segmentation](https://www.sciencedirect.com/science/article/pii/104732039090014M) by Meyer, F., & Beucher, S. (1990) 42 | * **Grey-level co-occurrence matrices**: [Robust radiomics feature quantification using semiautomatic volumetric segmentation](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0102107) by Parmar, C., Velazquez, E.R., Leijenaar, R., Jermoumi, M., Carvalho, S., Mak, R.H., Mitra, S., Shankar, B.U., Kikinis, R., Haibe-Kains, B. and Lambin, P. (2014) 43 | 44 | 45 | ## Research 46 | 47 | The following is a non-exhaustive list of studies that use the ForestTools library. Several of these papers discuss topics such as algorithm parameterization, and may be informative for users of this library. 48 | 49 | ### 2025 50 | 51 | * [Photogrammetry to Assess the Recovery of a Forest: Case Study of Guadalupe Island](https://www.investigacionesgeograficas.unam.mx/index.php/rig/article/view/60914) by Vera-Ortega, L. A., Hinojosa, A., & Luna, L. (2025) 52 | 53 | * [Responses of spectral indices to heat and drought differ by tree size in Douglas-fir](https://www.sciencedirect.com/science/article/pii/S2666017224000774) by Waite, O.J., Coops, N.C., Grubinger, S., Isaac-Renton, M., Degner, J., King, J. and Liu, A. (2025) 54 | 55 | ### 2024 56 | 57 | * [Monitoring climate change impacts on vegetation canopies in Central Europe with passive remote sensing techniques: new insights and perspectives](https://mediatum.ub.tum.de/1743662) by Kloos, S. (2024) 58 | 59 | * [A comparison and development of methods for estimating shrub volume using drone-imagery-derived point clouds](https://esajournals.onlinelibrary.wiley.com/doi/full/10.1002/ecs2.4877) by Harrison, G.R., Shrestha, A., Strand, E.K. and Karl, J.W. (2024) 60 | 61 | * [From LiDAR data to vegetation biophysical variables](https://ddd.uab.cat/record/299201) by Ventura Rodríguez, P. (2024) 62 | 63 | * [A Viewscape-based Approach for Assessing Perceived Walkability in Cities](https://www.researchgate.net/publication/381488507_A_Viewscape-based_Approach_for_Assessing_Perceived_Walkability_in_Cities) by Yang, X., Lindquist, M., Van Berkel, D. and Grace, D. (2024) 64 | 65 | * [Use of a Consumer-Grade UAV Laser Scanner to Identify Trees and Estimate Key Tree Attributes across a Point Density Range](https://www.mdpi.com/1999-4907/15/6/899) by Watt, M.S., Jayathunga, S., Hartley, R.J., Pearse, G.D., Massam, P.D., Cajes, D., Steer, B.S. and Estarija, H.J.C. (2024) 66 | 67 | * [Mapping tree canopy thermal refugia for birds using biophysical models and LiDAR](https://link.springer.com/article/10.1007/s00484-024-02833-z) by Strydom, L.H., Conradie, S.R., Smit, I.P., Greve, M., Boucher, P.B., Davies, A.B. and McKechnie, A.E. (2024) 68 | 69 | * [Early Detection of Southern Pine Beetle Attack by UAV-Collected Multispectral Imagery](https://www.mdpi.com/2072-4292/16/14/2608) by Kanaskie, C.R., Routhier, M.R., Fraser, B.T., Congalton, R.G., Ayres, M.P. and Garnas, J.R. (2024) 70 | 71 | * [Characterizing heterogeneous forest structure in ponderosa pine forests via UAS-derived structure from motion](https://link.springer.com/article/10.1007/s10661-024-12703-1) by Hanna, L., Tinkham, W.T., Battaglia, M.A., Vogeler, J.C., Ritter, S.M. and Hoffman, C.M. (2024) 72 | 73 | * [Ground-based calibration for remote sensing of biomass in the tallest forests](https://www.sciencedirect.com/science/article/pii/S0378112724001919) by Sillett, S.C., Graham, M.E., Montague, J.P., Antoine, M.E. and Koch, G.W. (2024) 74 | 75 | * [Integrating Drone-Based LiDAR and Multispectral Data for Tree Monitoring](https://www.mdpi.com/2504-446X/8/12/744) by Savinelli, B., Tagliabue, G., Vignali, L., Garzonio, R., Gentili, R., Panigada, C. and Rossini, M. (2024) 76 | 77 | * [Accounting for the impact of tree size and soil spatial variability on leaching from orchards](https://www.sciencedirect.com/science/article/abs/pii/S0168169924003879) by Turkeltaub, T., Peltin, B., Dagan, A., Paz-Kagan, T., Rave, E. and Baram, S. (2024) 78 | 79 | * [Canopy Structural Changes in Black Pine Trees Affected by Pine Processionary Moth Using Drone-Derived Data](https://www.mdpi.com/2504-446X/8/3/75#B38-drones-08-00075) by Domingo, D., Gómez, C., Mauro, F., Houdas, H., Sangüesa-Barreda, G. and Rodríguez-Puerta, F. (2024) 80 | 81 | * [Active Remote Sensing Assessment of Biomass Productivity and Canopy Structure of Short-Rotation Coppice American Sycamore (Platanus occidentalis L.)](https://www.proquest.com/docview/3085007539) by Ukachukwu, O.J., Smart, L., Jeziorska, J., Mitasova, H. and King, J.S. (2024) 82 | 83 | * [Automated detection of an insect-induced keystone vegetation phenotype using airborne LiDAR](https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/2041-210X.14298) by Wang, Z., Huben, R., Boucher, P.B., Van Amburg, C., Zeng, J., Chung, N., Wang, J., King, J., Knecht, R.J., Ng'iru, I. and Baraza, A. (2024) 84 | 85 | * [Individual urban trees detection based on point clouds derived from UAV-RGB imagery and local maxima algorithm, a case study of Fateh Garden, Iran](https://link.springer.com/article/10.1007/s10668-022-02820-7) by Azizi, Z., & Miraki, M. (2024) 86 | 87 | * [Cutting the Greenness Index into 12 Monthly Slices: How Intra-Annual NDVI Dynamics Help Decipher Drought Responses in Mixed Forest Tree Species](https://www.mdpi.com/2072-4292/16/2/389) by Acosta-Hernández, A. C., Pompa-García, M., Martínez-Rivas, J. A., & Vivar-Vivar, E. D. (2024) 88 | 89 | * [Coupling UAV and satellite data for tree species identification to map the distribution of Caspian poplar](https://link.springer.com/article/10.1007/s10980-024-01846-8) by Miraki, M., Sohrabi, H., Fatehi, P., & Kneubuehler, M. (2024) 90 | 91 | * [Diameter estimation based on LiDAR point clouds at stand level of loblolly pine plantations](https://research.fs.usda.gov/treesearch/679920) by Talmage, C., Weng, Y., Zhang, Y., & Grogan, J. (2024) 92 | 93 | * [A Lidar-based Method for 3D Urban Forest Evaluation and Microclimate Assessment, a Case Study in Portland, Oregon, USA](https://essopenarchive.org/doi/full/10.22541/essoar.170914530.09781933) by Yao, X., and Minho, K. (2024) 94 | 95 | * [Remote Estimation of Above Ground Forest Biomass Using LiDAR and Drone Imagery](https://ieeexplore.ieee.org/abstract/document/10754716) by Parlato, C., Loftus, N., McGrath, S., Narman, H.S. and Gage, R. (2024) 96 | 97 | * [UAV-based LiDAR and Multispectral images for forest trait retrieval](https://meetingorganizer.copernicus.org/EGU24/EGU24-19456.html) by Vignali, L., Panigada, C., Tagliabue, G., Savinelli, B., Garzonio, R., Colombo, & Rossini, M. (2024) 98 | 99 | * [Use of unmanned aerial vehicles for estimating carbon storage in subtropical shrubland aboveground biomass](https://www.scielo.org.mx/scielo.php?pid=S2007-40182024000200005&script=sci_arttext) by Vega-Puga, M. G., Romo-León, J. R., Castellanos, A. E., Castillo-Gámez, R. A., & Garatuza-Payán, J. (2024) 100 | 101 | ### 2023 102 | 103 | * [A novel post-fire method to estimate individual tree crown scorch height and volume using simple RPAS-derived data](https://fireecology.springeropen.com/articles/10.1186/s42408-023-00174-7) by Arkin, J., Coops, N. C., Daniels, L. D., & Plowright, A. (2023) 104 | 105 | * [Prediction of Open Woodland Transpiration Incorporating Sun-Induced Chlorophyll Fluorescence and Vegetation Structure ](https://www.mdpi.com/2072-4292/16/1/143) by Gao, S., Woodgate, W., Ma, X., & Doody, T. M. (2023) 106 | 107 | * [From Local to Micro: Exploratory Data Analysis on Urban Forests and Microclimates in Portland, Oregon, USA](https://ieeexplore.ieee.org/abstract/document/10282088) by Yao, X., & Kim, M. (2023) 108 | 109 | * [Mapping and monitoring of vegetation regeneration and fuel under major transmission power lines through image and photogrammetric analysis of drone-derived data](https://www.tandfonline.com/doi/full/10.1080/10106049.2023.2280597) by Sos, J., Penglase, K., Lewis, T., Srivastava, P. K., Singh, H., & Srivastava, S. K. (2023) 110 | 111 | * [Patterns of Florida Bonneted Bat Occupancy at the Northern Extent of Its Range](https://meridian.allenpress.com/jfwm/article/doi/10.3996/JFWM-22-055/494603) by Schorr, R. A., Pitcher, K. A., Aldredge, R. A., & Lukacs, P. M. (2023) 112 | 113 | * [Remotely sensed and ground measurements reveal intraspecific differences in early season needle unfolding and senescence, but lack of variability in litter flammability of Pinus halepensis](https://www.sciencedirect.com/science/article/pii/S0378112723007090) by Lombardi, E., Kefauver, S.C., Serrano, L., Sin, E., Piñas-Bonilla, P., Pérez, B., Luna, B., Zavala, G., de Dios, V.R. and Voltas, J. (2023) 114 | 115 | * [A New Approach to Estimate Fuel Budget and Wildfire Hazard Assessment in Commercial Plantations Using Drone-Based Photogrammetry and Image Analysis](https://www.mdpi.com/2072-4292/15/10/2621) by Penglase, K., Lewis, T., & Srivastava, S. K. (2023) 116 | 117 | * [Biomass Estimation of Urban Forests Using LiDAR and High-Resolution Aerial Imagery in Athens–Clarke County, GA](https://www.mdpi.com/1999-4907/14/5/1064) by Henn, K. A., & Peduzzi, A. (2023) 118 | 119 | * [Monitoring Individual Tree Phenology in a Multi-Species Forest Using High Resolution UAV Images](https://www.mdpi.com/2072-4292/15/14/3599) by Kleinsmann, J., Verbesselt, J., & Kooistra, L. (2023) 120 | 121 | * [Urban Treetop Detection and Tree-Height Estimation from Unmanned-Aerial-Vehicle Images](https://www.mdpi.com/2072-4292/15/15/3779) by Wu, H., Zhuang, M., Chen, Y., Meng, C., Wu, C., Ouyang, L., Liu, Y., Shu, Y., Tao, Y., Qiu, T. and Li, J. (2023) 122 | 123 | * [Modeling Biometrie Attributes from Tree Height Using Unmanned Aerial Vehicles (UAV) in Natural Forest Stands](http://www.scielo.org.co/scielo.php?pid=S0120-56092023000200002&script=sci_arttext) by Quiñonez-Barrazal, G., Pompa-García, M., Vivar-Vivar, E.D., Gallardo-Salazar, J.L., Hernández, F.J., Rodríguez-Flores, F.D.J., Solís-Moreno, R., Bretado-Velázquez, J.L., Valdez-Cepeda, R.D. and Hernández-Díaz, J.C. (2023) 124 | 125 | * [Detection of standing retention trees in boreal forests with airborne laser scanning point clouds and multispectral imagery](https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/2041-210X.13995) by Hardenbol, A. A., Korhonen, L., Kukkonen, M., & Maltamo, M. (2023) 126 | 127 | * [Multi-temporal NDVI analysis using UAV images of tree crowns in a northern Mexican pine-oak forest](https://link.springer.com/article/10.1007/s11676-023-01639-w) by Gallardo-Salazar, J. L., Rosas-Chavoya, M., Pompa-García, M., López-Serrano, P. M., García-Montiel, E., Meléndez-Soto, A., & Jiménez-Jiménez, S. I. (2023) 128 | 129 | * [A Lidar-based Method for 3D Urban Forest Evaluation and Microclimate Assessment, a Case Study in Portland, Oregon, USA](https://essopenarchive.org/doi/full/10.22541/essoar.170914530.09781933) by Yao, X., & Kim, M. (2023) 130 | 131 | * [Effects of long‐term fixed fire regimes on African savanna vegetation biomass, vertical structure and tree stem density](https://besjournals.onlinelibrary.wiley.com/doi/abs/10.1111/1365-2664.14435/) by Singh, J., Boucher, P. B., Hockridge, E. G., & Davies, A. B. (2023) 132 | 133 | * [The role of in-channel vegetation in driving and controlling the geomorphic changes along a gravel-bed river](https://www.sciencedirect.com/science/article/pii/S0169555X23002234) by Picco, L., Pellegrini, G., Iroumé, A., Lenzi, M. A., & Rainato, R. (2023) 134 | 135 | * [Using photogrammetry to assess the recovery of a cypress forest and its impact on water-borne erosion. Case study: Guadalupe Island](https://www.researchsquare.com/article/rs-3717140/v1) by Vera-Ortega, L. A., Hinojosa-Corona, A., Luna, L., & Gudiño-Elizondo, N. (2023) 136 | 137 | * [UAV data collection parameters impact on accuracy of Scots pine stand mensuration](https://www.researchgate.net/profile/Roman-Zadorozhniuk/publication/371550369_UAV_data_collection_parameters_impact_on_accuracy_of_Scots_pine_stand_mensuration/links/64917bf1c41fb852dd19c381/UAV-data-collection-parameters-impact-on-accuracy-of-Scots-pine-stand-mensuration.pdf) by Zadorozhniuk, R. (2023) 138 | 139 | * [Risk Analysis for Asset Protection in Hoyt Arboretum, Portland, OR](https://pdxscholar.library.pdx.edu/geog_master_GIS_reports/6/) by Kossnar, N. (2023). 140 | 141 | * [Modelling internal tree attributes for breeding applications in Douglas-fir progeny trials using RPAS-ALS](https://www.sciencedirect.com/science/article/pii/S2666017222000347) by du Toit, F., Coops, N. C., Ratcliffe, B., El-Kassaby, Y. A., & Lucieer, A. (2023) 142 | 143 | * [Mountain Tree Species Mapping Using Sentinel-2, PlanetScope, and Airborne HySpex Hyperspectral Imagery](https://www.mdpi.com/2072-4292/15/3/844) by Kluczek, M., Zagajewski, B., & Zwijacz-Kozica, T. (2023) 144 | 145 | * [Use of Drone RGB Imagery to Quantify Indicator Variables of Tropical-Forest-Ecosystem Degradation and Restoration](https://www.mdpi.com/1999-4907/14/3/586) by Lee, K., Elliott, S., & Tiansawat, P. (2023) 146 | 147 | ### 2022 148 | 149 | * [Individual Tree Identification in ULS Point Clouds Using a Crown Width Mixed-Effects Model Based on NFI Data](https://www.mdpi.com/2072-4292/14/4/926) by Kubišta, J., & Surový, P. (2022) 150 | 151 | * [Utilizing Single Photon Laser Scanning Data for Estimating Individual Tree Attributes](https://helda.helsinki.fi/bitstream/handle/10138/344212/isprs_annals_V_2_2022_431_2022.pdf?sequence=1) by Simula, J., Holopainen, M., & Imangholiloo, M. (2022) 152 | 153 | * [UAV-LiDAR and RGB Imagery Reveal Large Intraspecific Variation in Tree-Level Morphometric Traits across Different Pine Species Evaluated in Common Gardens](https://www.mdpi.com/2072-4292/14/22/5904) by Lombardi, E., Rodríguez-Puerta, F., Santini, F., Chambel, M. R., Climent, J., Resco de Dios, V., & Voltas, J. (2022) 154 | 155 | * [Cross-Comparison of Individual Tree Detection Methods Using Low and High Pulse Density Airborne Laser Scanning Data](https://www.mdpi.com/2072-4292/14/14/3480) by Sparks, A. M., Corrao, M. V., & Smith, A. M. (2022) 156 | 157 | * [Slow development of woodland vegetation and bird communities during 33 years of passive rewilding in open farmland](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0277545) by Broughton, R. K., Bullock, J. M., George, C., Gerard, F., Maziarz, M., Payne, W. E., Scholefield, P. A., Wade, D., & Pywell, R. F. (2022) 158 | 159 | * [Application of unmanned aerial system structure from motion point cloud detected tree heights and stem diameters to model missing stem diameters](https://www.sciencedirect.com/science/article/pii/S2215016122001108) by Swayze, N. C., & Tinkham, W. T. (2022) 160 | 161 | * [Limited increases in savanna carbon stocks over decades of fire suppression](https://www.nature.com/articles/s41586-022-04438-1) by Zhou, Y., Singh, J., Butnor, J. R., Coetsee, C., Boucher, P. B., Case, M. F., Hockridge, E. G., Davies, A. B., & Staver, A. C. (2022) 162 | 163 | * [Automated Inventory of Broadleaf Tree Plantations with UAS Imagery](https://www.mdpi.com/2072-4292/14/8/1931) by Chandrasekaran, A., Shao, G., Fei, S., Miller, Z., & Hupy, J. (2022) 164 | 165 | * [Use of Unoccupied Aerial Systems to Characterize Woody Vegetation across Silvopastoral Systems in Ecuador](https://www.mdpi.com/2072-4292/14/14/3386) by Iñamagua-Uyaguari, J. P., Green, D. R., Fitton, N., Sangoluisa, P., Torres, J., & Smith, P. (2022) 166 | 167 | * [Democratizing macroecology: Integrating unoccupied aerial systems with the National Ecological Observatory Network](https://esajournals.onlinelibrary.wiley.com/doi/full/10.1002/ecs2.4206) by Koontz, M. J., Scholl, V. M., Spiers, A. I., Cattau, M. E., Adler, J., McGlinchy, J., Goulden, T., Melbourne, B. A., & Balch, J. K. (2022). 168 | 169 | * [An Integrated Method for Estimating Forest-Canopy Closure Based on UAV LiDAR Data](https://www.mdpi.com/2072-4292/14/17/4317) by Gao, T., Gao, Z., Sun, B., Qin, P., Li, Y., & Yan, Z. (2022) 170 | 171 | * [Detection of standing retention trees in boreal forests with airborne laser scanning point clouds and multispectral imagery](https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/2041-210X.13995) by Hardenbol, A. A., Korhonen, L., Kukkonen, M., & Maltamo, M. (2022) 172 | 173 | * [Optimizing aerial imagery collection and processing parameters for drone-based individual tree mapping in structurally complex conifer forests](https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/2041-210X.13860/) by Young, D. J., Koontz, M. J., & Weeks, J. (2022) 174 | 175 | * [Assessing Structural Complexity of Individual Scots Pine Trees by Comparing Terrestrial Laser Scanning and Photogrammetric Point Clouds](https://www.mdpi.com/1999-4907/13/8/1305) by Tienaho, N., Yrttimaa, T., Kankare, V., Vastaranta, M., Luoma, V., Honkavaara, E., ... & Saarinen, N. (2022) 176 | 177 | * [SiDroForest: a comprehensive forest inventory of Siberian boreal forest investigations including drone-based point clouds, individually labeled trees, synthetically generated tree crowns, and Sentinel-2 labeled image patches](https://essd.copernicus.org/articles/14/4967/2022/) by van Geffen, F., Heim, B., Brieger, F., Geng, R., Shevtsova, I. A., Schulte, L., ... & Kruse, S. (2022) 178 | 179 | * [Individual urban trees detection based on point clouds derived from UAV-RGB imagery and local maxima algorithm, a case study of Fateh Garden, Iran](https://link.springer.com/article/10.1007/s10668-022-02820-7) by Azizi, Z., & Miraki, M. (2022) 180 | 181 | * [Effect of varied unmanned aerial vehicle laser scanning pulse density on accurately quantifying forest structure](https://www.tandfonline.com/doi/abs/10.1080/01431161.2021.2023229) by Sumnall, M. J., Albaugh, T. J., Carter, D. R., Cook, R. L., Hession, W. C., Campoe, O. C., ... & Thomas, V. A. (2022) 182 | 183 | * [Correcting the Results of CHM-Based Individual Tree Detection Algorithms to Improve Their Accuracy and Reliability](https://www.mdpi.com/2072-4292/14/8/1822) by Lisiewicz, M., Kamińska, A., Kraszewski, B., & Stereńczak, K. (2022) 184 | 185 | * [Combining aerial photos and LiDAR data to detect canopy cover change in urban forests](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0273487) by Coupland, K., Hamilton, D., & Griess, V. C. (2022) 186 | 187 | * [Effects of Flight and Smoothing Parameters on the Detection of Taxus and Olive Trees with UAV-Borne Imagery](https://www.mdpi.com/2504-446X/6/8/197) by Ottoy, S., Tziolas, N., Van Meerbeek, K., Aravidis, I., Tilkin, S., Sismanis, M., Stavrakoudis, D., Gitas, I. Z., Zalidis, G. & De Vocht, A. (2022) 188 | 189 | * [Modeling the Missing DBHs: Influence of Model Form on UAV DBH Characterization](https://www.mdpi.com/1999-4907/13/12/2077) by Tinkham, W. T., Swayze, N. C., Hoffman, C. M., Lad, L. E., & Battaglia, M. A. (2022) 190 | 191 | * [Mapping Tree Canopy in Urban Environments Using Point Clouds from Airborne Laser Scanning and Street Level Imagery](https://www.mdpi.com/1424-8220/22/9/3269) by Rodríguez-Puerta, F., Barrera, C., García, B., Pérez-Rodríguez, F., & García-Pedrero, A. M. (2022) 192 | 193 | * [Extraction of individual trees based on Canopy Height Model to monitor the state of the forest](https://www.sciencedirect.com/science/article/pii/S2666719322000644) by Douss, R., & Farah, I. R. (2022) 194 | 195 | * [Aprisco Field Station: the spatial structure of a new experimental site focused on agroecology](https://academic.oup.com/jpe/article/15/6/1118/6576147) by O’Brien, M. J., Carbonell, E. P., & Schöb, C. (2022) 196 | 197 | * [UAV-Based Characterization of Tree-Attributes and Multispectral Indices in an Uneven-Aged Mixed Conifer-Broadleaf Forest](https://www.mdpi.com/2072-4292/14/12/2775) by Vivar-Vivar, E. D., Pompa-García, M., Martínez-Rivas, J. A., & Mora-Tembre, L. A. (2022) 198 | 199 | ### 2021 200 | 201 | * [Detectability of the Critically Endangered Araucaria angustifolia Tree Using Worldview-2 Images, Google Earth Engine and UAV-LiDAR](https://www.mdpi.com/2073-445X/10/12/1316) by Saad, F., Biswas, S., Huang, Q., Corte, A. P. D., Coraiola, M., Macey, S., Marcos Bergmann, M., & Leimgruber, P. (2021) 202 | 203 | * [Fine scale mapping of fractional tree canopy cover to support river basin management](https://onlinelibrary.wiley.com/doi/abs/10.1002/hyp.14156) by Gao, S., Castellazzi, P., Vervoort, R. W., & Doody, T. M. (2021) 204 | 205 | * [Above Ground Biomass Estimation of Syzygium aromaticum using structure from motion (SfM) derived from Unmanned Aerial Vehicle in Paninggahan Agroforest Area, West Sumatra](http://jbioua.fmipa.unand.ac.id/index.php/jbioua/article/view/338) by Harapan, T. S., Husna, A., Febriamansyah, T. A., Mutashim, M., Saputra, A., Taufiq, A., & Mukhtar, E. (2021) 206 | 207 | * [Influence of flight parameters on UAS-based monitoring of tree height, diameter, and density](https://www.sciencedirect.com/science/article/abs/pii/S0034425721002601) by Swayze, N. C., Tinkham, W. T., Vogeler, J. C., & Hudak, A. T. (2021) 208 | 209 | * [Detection of aspen in conifer-dominated boreal forests with seasonal multispectral drone image point clouds](https://www.silvafennica.fi/article/10515/author/20257) by Hardenbol, A. A., Kuzmin, A., Korhonen, L., Korpelainen, P., Kumpula, T., Maltamo, M., & Kouki, J. (2021) 210 | 211 | * [Correcting tree count bias for objects segmented from lidar point clouds](https://www.proquest.com/openview/4c03d80d21aa8d71509deaae79259b9f/1?pq-origsite=gscholar&cbl=2030384) by Strub, M. R., & Osborne, N. (2021) 212 | 213 | * [Comparison of Accuracy between Analysis Tree Detection in UAV Aerial Image Analysis and Quadrat Method for Estimating the Number of Trees to be Removed in the Environmental Impact Assessment](https://koreascience.kr/article/JAKO202118752917743.page) by Park, M. (2021) 214 | 215 | * [Arboricoltura di precisione: un nuovo approccio alla gestione del rischio caduta alberi basato sulla Geomatica](https://mediageo.it/ojs/index.php/GEOmedia/article/view/1810) by De Petris, S., Sarvia, F., & Borgogno-Mondino, E. (2021) 216 | 217 | * [Canopy Extraction and Height Estimation of Trees in a Shelter Forest Based on Fusion of an Airborne Multispectral Image and Photogrammetric Point Cloud](https://www.hindawi.com/journals/js/2021/5519629/) by Wang, X., Zhao, Q., Han, F., Zhang, J., & Jiang, P. (2021) 218 | 219 | * [Uav-based lidar scanning for individual tree detection and height measurement in young forest permanent trials](https://www.mdpi.com/2072-4292/14/1/170) by Rodríguez-Puerta, F., Gómez-García, E., Martín-García, S., Pérez-Rodríguez, F., & Prada, E. (2021) 220 | 221 | * [UAV-derived forest degradation assessments for planning and monitoring forest ecosystem restoration: towards a forest degradation index](https://www.cifor-icraf.org/knowledge/publication/8199/) by Lee, K. (2021) 222 | 223 | * [Potential for Individual Tree Monitoring in Ponderosa Pine-Dominated Forests Using Unmanned Aerial System Structure from Motion Point Clouds](https://cdnsciencepub.com/doi/10.1139/cjfr-2020-0433/) by Creasy, M. B., Tinkham, W. T., Hoffman, C. M., & Vogeler, J. C. (2021) 224 | 225 | * [Assessment of Above-Ground Carbon Storage by Urban Trees Using LiDAR Data: The Case of a University Campus](https://www.mdpi.com/1999-4907/12/1/62) by Gülçin, D., & van den Bosch, C. C. K. (2021) 226 | 227 | * [Influence of Agisoft Metashape Parameters on UAS Structure from Motion Individual Tree Detection from Canopy Height Models](https://www.mdpi.com/1999-4907/12/2/250) by Tinkham, W. T., & Swayze, N. C. (2021) 228 | 229 | * [Ground-Penetrating Radar as phenotyping tool for characterizing intraspecific variability in root traits of a widespread conifer](https://link.springer.com/article/10.1007/s11104-021-05135-0) by Lombardi, E., Ferrio, J. P., Rodríguez-Robles, U., de Dios, V. R., & Voltas, J. (2021) 230 | 231 | * [Bridging the genotype–phenotype gap for a Mediterranean pine by semi‐automatic crown identification and multispectral imagery](https://nph.onlinelibrary.wiley.com/doi/abs/10.1111/nph.16862) by Santini, F., Kefauver, S. C., Araus, J. L., Resco de Dios, V., Martín García, S., Grivet, D., & Voltas, J. (2021) 232 | 233 | * [Tracking the rates and mechanisms of canopy damage and recovery following Hurricane Maria using multitemporal lidar data](https://www.biorxiv.org/content/10.1101/2021.03.26.436869v1.abstract) by Leitold, V., Morton, D. C., Martinuzzi, S., Paynter, I., Uriarte, M., Keller, M., Keller, M., Ferraz, A., Cook, B. D., Corp, L. A., & González, G. (2021) 234 | 235 | * [Cross-scale interaction of host tree size and climatic water deficit governs bark beetle-induced tree mortality](https://www.nature.com/articles/s41467-020-20455-y) by Koontz, M. J., Latimer, A. M., Mortenson, L. A., Fettig, C. J., & North, M. P. (2021) 236 | 237 | ### 2020 238 | 239 | * [The wildlife‐livestock interface on extensive free‐ranging pig farms in central Spain during the “montanera” period](https://onlinelibrary.wiley.com/doi/abs/10.1111/tbed.13854) by Triguero‐Ocaña, R., Laguna, E., Jiménez‐Ruiz, S., Fernández‐López, J., García‐Bocanegra, I., Barasona, J. Á., ... & Acevedo, P. (2020) 240 | 241 | * [Supporting Assessment of Forest Burned Areas by Aerial Photogrammetry: The Susa Valley (NW Italy) Fires of Autumn 2017](https://link.springer.com/chapter/10.1007/978-3-030-58811-3_59) by De Petris, S., Momo, E. J., & Borgogno-Mondino, E. (2020) 242 | 243 | * [Applying unmanned aerial vehicles (UAVs) to map shrubland structural attributes in northern Patagonia, Argentina](https://doi.org/10.1139/cjfr-2019-0440) by Gonzalez Musso, R. F., Oddi, F. J., Goldenberg, M. G., & Garibaldi, L. A. (2020) 244 | 245 | * [Automated Canopy Delineation and Size Metrics Extraction for Strawberry Dry Weight Modeling Using Raster Analysis of High-Resolution Imagery](https://www.mdpi.com/2072-4292/12/21/3632) by Abd-Elrahman, A., Guan, Z., Dalid, C., Whitaker, V., Britt, K., Wilkinson, B., & Gonzalez, A. (2020) 246 | 247 | * [Northern Bobwhite Non‐Breeding Habitat Selection in a Longleaf Pine Woodland](https://wildlife.onlinelibrary.wiley.com/doi/abs/10.1002/jwmg.21925) by Kroeger, A. J., DePerno, C. S., Harper, C. A., Rosche, S. B., & Moorman, C. E. (2020) 248 | 249 | * [Evaluation of Features Derived from High-Resolution Multispectral Imagery and LiDAR Data for Object-Based Support Vector Machine Classification of Tree Species](https://www.tandfonline.com/doi/abs/10.1080/07038992.2020.1809363) by Roffey, M., & Wang, J. (2020) 250 | 251 | * [Mapping Species at an Individual-Tree Scale in a Temperate Forest, Using Sentinel-2 Images, Airborne Laser Scanning Data, and Random Forest Classification](https://www.mdpi.com/2072-4292/12/22/3710) by Plakman, V., Janssen, T., Brouwer, N., & Veraverbeke, S. (2020) 252 | 253 | ### 2019 254 | 255 | * [High-resolution multisensor remote sensing to support date palm farm management](https://www.mdpi.com/2077-0472/9/2/26) by Mulley, M., Kooistra, L., & Bierens, L. (2019) 256 | 257 | * [Quantifying canopy tree loss and gap recovery in tropical forests under low-intensity logging using VHR satellite imagery and airborne LiDAR](https://www.mdpi.com/2072-4292/11/7/817) by Dalagnol, R., Phillips, O. L., Gloor, E., Galvão, L. S., Wagner, F. H., Locks, C. J., & Aragão, L. E. (2019) 258 | 259 | * [Forest inventory sensitivity to UAS-based image processing algorithms](https://afrjournal.org/index.php/afr/article/download/1282/818) by Maturbongs, B., Wing, M. G., Strimbu, B., & Burnett, J. (2019) 260 | 261 | * [Remote sensing pipeline for tree segmentation and classification in a mixed softwood and hardwood system](https://peerj.com/articles/5837/) by McMahon, C. A. (2019) 262 | 263 | * [Tree height in tropical forest as measured by different ground, proximal, and remote sensing instruments, and impacts on above ground biomass estimates](https://www.sciencedirect.com/science/article/abs/pii/S0303243419300844) by Laurin, G. V., Ding, J., Disney, M., Bartholomeus, H., Herold, M., Papale, D., & Valentini, R. (2019) 264 | 265 | * [Advances in the Derivation of Northeast Siberian Forest Metrics Using High-Resolution UAV-Based Photogrammetric Point Clouds](https://www.mdpi.com/2072-4292/11/12/1447) by Brieger, F., Herzschuh, U., Pestryakova, L. A., Bookhagen, B., Zakharov, E. S., & Kruse, S. (2019) 266 | 267 | * [Multi-scale Assessment of Northern Bobwhite and White-tailed Deer Habitat Selection in Longleaf Pine Woodlands](https://repository.lib.ncsu.edu/bitstream/handle/1840.20/37046/etd.pdf?sequence=1) by Kroeger, A. J. (2019) 268 | 269 | ### 2018 270 | 271 | * [Bayesian and classical machine learning methods: a comparison for tree species classification with LiDAR waveform signatures](https://www.mdpi.com/2072-4292/10/1/39) by Zhou, T., Popescu, S. C., Lawing, A. M., Eriksson, M., Strimbu, B. M., & Bürkner, P. C. (2018) 272 | 273 | ### 2017 274 | 275 | * [Underproductive agriculture aids connectivity in tropical forests](https://www.sciencedirect.com/science/article/abs/pii/S0378112717308101) by Evans, L. J., Goossens, B., & Asner, G. P. (2017) 276 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | ## Test environments 2 | 3 | ### Local development environment 4 | - OS: Linux Mint version 22 5 | - R version: 4.3.3 6 | - Locale: en_CA.UTF-8 7 | - Compiler: gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0 8 | 9 | ### Remote environments 10 | * Windows Server 2022 via r-hub 11 | * Windows Server 2022 via check_win_devel 12 | * Ubuntu Linux 24.04 via r-hub 13 | * macOS 13.7.2 via r-hub 14 | * macOS 14.7.2 via r-hub 15 | 16 | ## R CMD check results 17 | 18 | 0 errors | 0 warnings | 0 notes 19 | 20 | ## Reverse dependencies 21 | 22 | There are no reverse dependencies. 23 | -------------------------------------------------------------------------------- /data-raw/CHMdemo.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data-raw/CHMdemo.tif -------------------------------------------------------------------------------- /data-raw/kootenayBlocks.CPG: -------------------------------------------------------------------------------- 1 | UTF-8 -------------------------------------------------------------------------------- /data-raw/kootenayBlocks.dbf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data-raw/kootenayBlocks.dbf -------------------------------------------------------------------------------- /data-raw/kootenayBlocks.prj: -------------------------------------------------------------------------------- 1 | PROJCS["WGS_1984_UTM_Zone_11N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["false_easting",500000.0],PARAMETER["false_northing",0.0],PARAMETER["central_meridian",-117.0],PARAMETER["scale_factor",0.9996],PARAMETER["latitude_of_origin",0.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /data-raw/kootenayBlocks.sbn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data-raw/kootenayBlocks.sbn -------------------------------------------------------------------------------- /data-raw/kootenayBlocks.sbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data-raw/kootenayBlocks.sbx -------------------------------------------------------------------------------- /data-raw/kootenayBlocks.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data-raw/kootenayBlocks.shp -------------------------------------------------------------------------------- /data-raw/kootenayBlocks.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data-raw/kootenayBlocks.shx -------------------------------------------------------------------------------- /data-raw/kootenayCHM.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data-raw/kootenayCHM.tif -------------------------------------------------------------------------------- /data/kootenayBlocks.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data/kootenayBlocks.rda -------------------------------------------------------------------------------- /data/kootenayCHM.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data/kootenayCHM.rda -------------------------------------------------------------------------------- /data/kootenayCrowns.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data/kootenayCrowns.rda -------------------------------------------------------------------------------- /data/kootenayOrtho.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data/kootenayOrtho.rda -------------------------------------------------------------------------------- /data/kootenayTrees.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data/kootenayTrees.rda -------------------------------------------------------------------------------- /data/quesnelBlocks.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data/quesnelBlocks.rda -------------------------------------------------------------------------------- /data/quesnelCHM.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data/quesnelCHM.rda -------------------------------------------------------------------------------- /data/quesnelTrees.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/data/quesnelTrees.rda -------------------------------------------------------------------------------- /inst/guides/spatial_statistics.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Spatial Statistics with ForestTools" 3 | author: "Andrew Plowright" 4 | date: "2024-01-19" 5 | output: github_document 6 | --- 7 | 8 | ```{r setup, include=FALSE} 9 | knitr::opts_chunk$set(echo = TRUE) 10 | ``` 11 | 12 | This vignette will take you through the process of generating tree statistics over polygonal areas using the outputs from `ForestTools`. 13 | 14 | Start by loading in some test data. These are sample outputs from the `ForestTools` functions. `kootenayTrees` are individual tree points produced using `vwf`. `kootenayCrowns` are polygonal crowns generated by `mcws`. `kootenayBlocks` are some polygonal areas of interest that we'll use for generating statistics. 15 | 16 | ```{r message=FALSE, warning=FALSE} 17 | # Load libraries 18 | library(terra) 19 | library(sf) 20 | library(ForestTools) 21 | library(dplyr) 22 | library(magrittr) 23 | 24 | # Load sample data 25 | data("kootenayTrees", "kootenayBlocks", "kootenayCrowns", "kootenayCHM") 26 | 27 | # Plot areas of interest and add trees 28 | plot(unwrap(kootenayCHM)) 29 | plot(kootenayBlocks$geometry, add=T) 30 | plot(kootenayTrees$geometry, pch=19, col="blue", add=T) 31 | ``` 32 | 33 | # Global Statistics 34 | 35 | Calculating global statistics for the trees is fairly straightforward. 36 | 37 | ```{r, collapse=TRUE} 38 | # Height 39 | mean(kootenayTrees$height) 40 | median(kootenayTrees$height) 41 | max(kootenayTrees$height) 42 | 43 | # Crown area 44 | mean(kootenayCrowns$crownArea) 45 | median(kootenayCrowns$crownArea) 46 | max(kootenayCrowns$crownArea) 47 | ``` 48 | 49 | # Statistics by Polygon 50 | 51 | To calculate statistics by polygonal areas of interest, we'll first use the `st_intersects` function to create subsets of trees for each polygon. We'll then calculate statistics for each of those subsets, and return the result to polygons. Note: this can duplicate trees that are contained in overlapping polygons. 52 | 53 | ```{r} 54 | # Create subsets of the trees for each polygonal area of interest 55 | trees_by_poly <- kootenayBlocks %>% 56 | st_intersects(kootenayTrees) %>% 57 | lapply(function(x) kootenayTrees[x,]) 58 | 59 | # Calculate statistics for each polygonal area of interest 60 | kootenayBlocks[["mean_height"]] <- sapply(trees_by_poly, function(trees) mean(trees$height)) 61 | kootenayBlocks[["max_height"]] <- sapply(trees_by_poly, function(trees) max(trees$height)) 62 | 63 | ``` 64 | 65 | The same operation can be repeated for tree crowns. However, given that the crowns are polygonal, we don't want a single crown to be counted twice between two adjoining areas of interest. The only variation required here is that we use `st_centroid` to compute centroids for each crown before intersecting them with the areas of interest. 66 | 67 | ```{r, warning=FALSE} 68 | # Create subsets of the crowns for each polygonal area of interest 69 | crowns_by_poly <- kootenayBlocks %>% 70 | st_intersects(st_centroid(kootenayCrowns)) %>% 71 | lapply(function(x) kootenayCrowns[x,]) 72 | 73 | # Calculate statistics for each polygonal area of interest 74 | kootenayBlocks[["mean_crownArea"]] <- sapply(crowns_by_poly, function(crowns) mean(crowns$crownArea)) 75 | kootenayBlocks[["max_crownArea"]] <- sapply(crowns_by_poly, function(crowns) max(crowns$crownArea)) 76 | 77 | # View results 78 | kootenayBlocks[,c("BlockID", "mean_height", "max_height", "mean_crownArea", "max_crownArea")] 79 | ``` 80 | 81 | -------------------------------------------------------------------------------- /inst/guides/spatial_statistics.md: -------------------------------------------------------------------------------- 1 | Spatial Statistics with ForestTools 2 | ================ 3 | Andrew Plowright 4 | 2024-01-19 5 | 6 | This vignette will take you through the process of generating tree 7 | statistics over polygonal areas using the outputs from `ForestTools`. 8 | 9 | Start by loading in some test data. These are sample outputs from the 10 | `ForestTools` functions. `kootenayTrees` are individual tree points 11 | produced using `vwf`. `kootenayCrowns` are polygonal crowns generated by 12 | `mcws`. `kootenayBlocks` are some polygonal areas of interest that we’ll 13 | use for generating statistics. 14 | 15 | ``` r 16 | # Load libraries 17 | library(terra) 18 | library(sf) 19 | library(ForestTools) 20 | library(dplyr) 21 | library(magrittr) 22 | 23 | # Load sample data 24 | data("kootenayTrees", "kootenayBlocks", "kootenayCrowns", "kootenayCHM") 25 | 26 | # Plot areas of interest and add trees 27 | plot(unwrap(kootenayCHM)) 28 | plot(kootenayBlocks$geometry, add=T) 29 | plot(kootenayTrees$geometry, pch=19, col="blue", add=T) 30 | ``` 31 | 32 | ![](spatial_statistics_files/figure-gfm/unnamed-chunk-1-1.png) 33 | 34 | # Global Statistics 35 | 36 | Calculating global statistics for the trees is fairly straightforward. 37 | 38 | ``` r 39 | # Height 40 | mean(kootenayTrees$height) 41 | ## [1] 5.251959 42 | median(kootenayTrees$height) 43 | ## [1] 4.256785 44 | max(kootenayTrees$height) 45 | ## [1] 13.49121 46 | 47 | # Crown area 48 | mean(kootenayCrowns$crownArea) 49 | ## [1] 9.006453 50 | median(kootenayCrowns$crownArea) 51 | ## [1] 7 52 | max(kootenayCrowns$crownArea) 53 | ## [1] 54.25 54 | ``` 55 | 56 | # Statistics by Polygon 57 | 58 | To calculate statistics by polygonal areas of interest, we’ll first use 59 | the `st_intersects` function to create subsets of trees for each 60 | polygon. We’ll then calculate statistics for each of those subsets, and 61 | return the result to polygons. Note: this can duplicate trees that are 62 | contained in overlapping polygons. 63 | 64 | ``` r 65 | # Create subsets of the trees for each polygonal area of interest 66 | trees_by_poly <- kootenayBlocks %>% 67 | st_intersects(kootenayTrees) %>% 68 | lapply(function(x) kootenayTrees[x,]) 69 | 70 | # Calculate statistics for each polygonal area of interest 71 | kootenayBlocks[["mean_height"]] <- sapply(trees_by_poly, function(trees) mean(trees$height)) 72 | kootenayBlocks[["max_height"]] <- sapply(trees_by_poly, function(trees) max(trees$height)) 73 | ``` 74 | 75 | The same operation can be repeated for tree crowns. However, given that 76 | the crowns are polygonal, we don’t want a single crown to be counted 77 | twice between two adjoining areas of interest. The only variation 78 | required here is that we use `st_centroid` to compute centroids for each 79 | crown before intersecting them with the areas of interest. 80 | 81 | ``` r 82 | # Create subsets of the crowns for each polygonal area of interest 83 | crowns_by_poly <- kootenayBlocks %>% 84 | st_intersects(st_centroid(kootenayCrowns)) %>% 85 | lapply(function(x) kootenayCrowns[x,]) 86 | 87 | # Calculate statistics for each polygonal area of interest 88 | kootenayBlocks[["mean_crownArea"]] <- sapply(crowns_by_poly, function(crowns) mean(crowns$crownArea)) 89 | kootenayBlocks[["max_crownArea"]] <- sapply(crowns_by_poly, function(crowns) max(crowns$crownArea)) 90 | 91 | # View results 92 | kootenayBlocks[,c("BlockID", "mean_height", "max_height", "mean_crownArea", "max_crownArea")] 93 | ``` 94 | 95 | ## Simple feature collection with 3 features and 5 fields 96 | ## Geometry type: MULTIPOLYGON 97 | ## Dimension: XY 98 | ## Bounding box: xmin: 439689.1 ymin: 5526454 xmax: 439832.5 ymax: 5526563 99 | ## Projected CRS: WGS 84 / UTM zone 11N 100 | ## BlockID mean_height max_height mean_crownArea max_crownArea 101 | ## 0 101 7.338588 13.491207 13.683476 51.25 102 | ## 1 3308 3.208017 7.125149 4.847403 23.50 103 | ## 2 113 7.685308 12.583441 13.430990 54.25 104 | ## geometry 105 | ## 0 MULTIPOLYGON (((439707.9 55... 106 | ## 1 MULTIPOLYGON (((439832.5 55... 107 | ## 2 MULTIPOLYGON (((439832.4 55... 108 | -------------------------------------------------------------------------------- /inst/guides/spatial_statistics_files/figure-gfm/unnamed-chunk-1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/inst/guides/spatial_statistics_files/figure-gfm/unnamed-chunk-1-1.png -------------------------------------------------------------------------------- /inst/guides/treetop_analysis.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Canopy Analysis in R Using ForestTools" 3 | author: "Andrew Plowright" 4 | output: github_document 5 | --- 6 | ```{r global_options, include=FALSE, dpi = 300} 7 | knitr::opts_knit$set(global.par = TRUE) 8 | options(rmarkdown.html_vignette.check_title = FALSE) 9 | ``` 10 | ```{r setup, include=FALSE} 11 | library(ForestTools) 12 | ``` 13 | 14 | This short guide will demonstrate how to use the ForestTools package to detect and outline trees from a canopy height model (CHM) derived from a photogrammetric point cloud. 15 | 16 | Begin by installing ForestTools. 17 | 18 | ```{r, eval = FALSE} 19 | install.packages("ForestTools") 20 | ``` 21 | 22 | 23 | # Loading sample data 24 | 25 | A sample CHM is included in the ForestTools package. It represents a small 1.5 hectare swath of forest in the Kootenay Mountains, British Columbia. 26 | 27 | ```{r, message = FALSE, warning = FALSE} 28 | # Attach the 'ForestTools' and 'terra' libraries 29 | library(ForestTools) 30 | library(terra) 31 | library(sf) 32 | 33 | # Load sample canopy height model 34 | chm <- terra::rast(kootenayCHM) 35 | ``` 36 | 37 | View the CHM using the `plot` function. The cell values are equal to the canopy's height above ground. 38 | 39 | ```{r, fig.width = 6, fig.height = 4} 40 | # Remove plot margins (optional) 41 | par(mar = rep(0.5, 4)) 42 | 43 | # Plot CHM (extra optional arguments remove labels and tick marks from the plot) 44 | plot(chm, xlab = "", ylab = "", xaxt='n', yaxt = 'n') 45 | ``` 46 | 47 | # Detecting treetops 48 | 49 | Dominant treetops can be detected using `vwf`. This function implements the _variable window filter_ algorithm developed by Popescu and Wynne (2004). In short, a moving window scans the CHM and tags a given cell as treetop if it is found to be the highest within the window. The size of the window itself changes dynamically depending on the height of the cell on which it is centered. This is to account for varying crown sizes, with tall trees assumed to have wide crowns and vice versa. 50 | 51 | Therefore, the first step is to define the **function that will define the dynamic window size**. Essentially, this function should take a **CHM cell value** (i.e.: the height of the canopy above ground at that location) and return the **radius of the search window**. Here, we will define a simple linear equation, but any function with a single input and output will work. We do not wish for the `vwf` to tag low-lying underbrush or other spurious treetops, and so we also set a minimum height of 2 m using the `minHeight` argument. Any cell with a lower value will not be tagged as a treetop. 52 | 53 | ```{r} 54 | # Function for defining dynamic window size 55 | lin <- function(x){x * 0.05 + 0.6} 56 | 57 | # Detect treetops 58 | ttops <- vwf(chm, winFun = lin, minHeight = 2) 59 | ``` 60 | 61 | We can now plot these treetops on top of the CHM. 62 | 63 | ```{r, fig.width = 6, fig.height = 4} 64 | # Plot CHM 65 | plot(chm, xlab = "", ylab = "", xaxt='n', yaxt = 'n') 66 | 67 | # Add dominant treetops to the plot 68 | plot(ttops$geometry, col = "blue", pch = 20, cex = 0.5, add = TRUE) 69 | 70 | ``` 71 | 72 | The `ttops` object created by `vwf` in this example contains the spatial coordinates of each detected treetop, as well as two default attributes: _height_ and _winRadius_. These correspond to the tree's height above ground and the radius of the moving window where the tree was located. Note that _winRadius_ **is not necessarily equivalent to the tree's crown radius**. 73 | 74 | ```{r} 75 | # Get the mean treetop height 76 | mean(ttops$height) 77 | ``` 78 | 79 | # Outlining tree crowns 80 | 81 | Canopy height models often represent continuous, dense forests, where tree crowns abut against each other. Outlining discrete crown shapes from this type of forest is often referred to as _canopy segmentation_, where each crown outline is represented by a _segment_. Once a set of treetops have been detected from a canopy height model, the `mcws` function can be used for this purpose. 82 | 83 | The `mcws` function implements the `watershed` algorithm from the [imager](https://cran.r-project.org/package=imager/imager.pdf) library. Watershed algorithms are frequently used in topographical analysis to outline drainage basins. Given the morphological similarity between an inverted canopy and a terrain model, this same process can be used to outline tree crowns. However, a potential problem is the issue of _oversegmentation_, whereby branches, bumps and other spurious treetops are given their own segments. This source of error can be mitigated by using a variant of the algorithm known as _marker-controlled watershed segmentation_ (Beucher & Meyer, 1993), whereby the watershed algorithm is constrained by a set of markers -- in this case, treetops. 84 | 85 | The `mcws` function also takes a `minHeight` argument, although this value should be lower than that which was assigned to `vwf`. For the latter, `minHeight` defines the lowest expected treetop, whereas for the former it should correspond to the height above ground of the fringes of the lowest trees. 86 | 87 | ```{r, fig.width = 6, fig.height = 4} 88 | # Create crown map 89 | crowns_ras <- mcws(treetops = ttops, CHM = chm, minHeight = 1.5) 90 | 91 | # Plot crowns 92 | plot(crowns_ras, col = sample(rainbow(50), nrow(unique(chm)), replace = TRUE), legend = FALSE, xlab = "", ylab = "", xaxt='n', yaxt = 'n') 93 | ``` 94 | 95 | By default, `mcws` returns a raster, where each crown is given a unique cell value. Depending on the intended purpose of the crown map, it may be preferable to store these outlines as polygons. This can be accomplished by setting the `format` argument to "polygons". As an added benefit, these polygons will inherit the attributes of the treetops from which they were generated, such as _height_. 96 | 97 | ```{r, fig.width = 6, fig.height = 4} 98 | # Create polygon crown map 99 | crowns_poly <- mcws(treetops = ttops, CHM = chm, format = "polygons", minHeight = 1.5) 100 | 101 | # Plot CHM 102 | plot(chm, xlab = "", ylab = "", xaxt='n', yaxt = 'n') 103 | 104 | # Add crown outlines to the plot 105 | plot(crowns_poly$geometry, border = "blue", lwd = 0.5, add = TRUE) 106 | ``` 107 | 108 | Assuming that each crown has a roughly circular shape, we can use the crown's area to compute its average circular diameter. 109 | 110 | ```{r} 111 | # Compute area and diameter 112 | crowns_poly[["area"]] <- st_area(crowns_poly) 113 | crowns_poly[["diameter"]] <- sqrt(crowns_poly[["area"]]/ pi) * 2 114 | 115 | # Mean crown diameter 116 | mean(crowns_poly$diameter) 117 | ``` 118 | 119 | # References 120 | 121 | Popescu, S. C., & Wynne, R. H. (2004). [Seeing the trees in the forest](https://www.ingentaconnect.com/content/asprs/pers/2004/00000070/00000005/art00003). _Photogrammetric Engineering & Remote Sensing, 70_(5), 589-604. 122 | 123 | Beucher, S., and Meyer, F. (1993). [The morphological approach to segmentation: the watershed transformation](https://www.researchgate.net/profile/Serge-Beucher/publication/233950923_Segmentation_The_Watershed_Transformation_Mathematical_Morphology_in_Image_Processing/links/55f7c6ce08aeba1d9efe4072/Segmentation-The-Watershed-Transformation-Mathematical-Morphology-in-Image-Processing.pdf). _Mathematical morphology in image processing_, 433-481. 124 | -------------------------------------------------------------------------------- /inst/guides/treetop_analysis.md: -------------------------------------------------------------------------------- 1 | Canopy Analysis in R Using ForestTools 2 | ================ 3 | Andrew Plowright 4 | 5 | This short guide will demonstrate how to use the ForestTools package to 6 | detect and outline trees from a canopy height model (CHM) derived from a 7 | photogrammetric point cloud. 8 | 9 | Begin by installing ForestTools. 10 | 11 | ``` r 12 | install.packages("ForestTools") 13 | ``` 14 | 15 | # Loading sample data 16 | 17 | A sample CHM is included in the ForestTools package. It represents a 18 | small 1.5 hectare swath of forest in the Kootenay Mountains, British 19 | Columbia. 20 | 21 | ``` r 22 | # Attach the 'ForestTools' and 'terra' libraries 23 | library(ForestTools) 24 | library(terra) 25 | library(sf) 26 | 27 | # Load sample canopy height model 28 | chm <- terra::rast(kootenayCHM) 29 | ``` 30 | 31 | View the CHM using the `plot` function. The cell values are equal to the 32 | canopy’s height above ground. 33 | 34 | ``` r 35 | # Remove plot margins (optional) 36 | par(mar = rep(0.5, 4)) 37 | 38 | # Plot CHM (extra optional arguments remove labels and tick marks from the plot) 39 | plot(chm, xlab = "", ylab = "", xaxt='n', yaxt = 'n') 40 | ``` 41 | 42 | ![](treetop_analysis_files/figure-gfm/unnamed-chunk-3-1.png) 43 | 44 | # Detecting treetops 45 | 46 | Dominant treetops can be detected using `vwf`. This function implements 47 | the *variable window filter* algorithm developed by Popescu and Wynne 48 | (2004). In short, a moving window scans the CHM and tags a given cell as 49 | treetop if it is found to be the highest within the window. The size of 50 | the window itself changes dynamically depending on the height of the 51 | cell on which it is centered. This is to account for varying crown 52 | sizes, with tall trees assumed to have wide crowns and vice versa. 53 | 54 | Therefore, the first step is to define the **function that will define 55 | the dynamic window size**. Essentially, this function should take a 56 | **CHM cell value** (i.e.: the height of the canopy above ground at that 57 | location) and return the **radius of the search window**. Here, we will 58 | define a simple linear equation, but any function with a single input 59 | and output will work. We do not wish for the `vwf` to tag low-lying 60 | underbrush or other spurious treetops, and so we also set a minimum 61 | height of 2 m using the `minHeight` argument. Any cell with a lower 62 | value will not be tagged as a treetop. 63 | 64 | ``` r 65 | # Function for defining dynamic window size 66 | lin <- function(x){x * 0.05 + 0.6} 67 | 68 | # Detect treetops 69 | ttops <- vwf(chm, winFun = lin, minHeight = 2) 70 | ``` 71 | 72 | We can now plot these treetops on top of the CHM. 73 | 74 | ``` r 75 | # Plot CHM 76 | plot(chm, xlab = "", ylab = "", xaxt='n', yaxt = 'n') 77 | 78 | # Add dominant treetops to the plot 79 | plot(ttops$geometry, col = "blue", pch = 20, cex = 0.5, add = TRUE) 80 | ``` 81 | 82 | ![](treetop_analysis_files/figure-gfm/unnamed-chunk-5-1.png) 83 | 84 | The `ttops` object created by `vwf` in this example contains the spatial 85 | coordinates of each detected treetop, as well as two default attributes: 86 | *height* and *winRadius*. These correspond to the tree’s height above 87 | ground and the radius of the moving window where the tree was located. 88 | Note that *winRadius* **is not necessarily equivalent to the tree’s 89 | crown radius**. 90 | 91 | ``` r 92 | # Get the mean treetop height 93 | mean(ttops$height) 94 | ``` 95 | 96 | ## [1] 5.404217 97 | 98 | # Outlining tree crowns 99 | 100 | Canopy height models often represent continuous, dense forests, where 101 | tree crowns abut against each other. Outlining discrete crown shapes 102 | from this type of forest is often referred to as *canopy segmentation*, 103 | where each crown outline is represented by a *segment*. Once a set of 104 | treetops have been detected from a canopy height model, the `mcws` 105 | function can be used for this purpose. 106 | 107 | The `mcws` function implements the `watershed` algorithm from the 108 | [imager](https://cran.r-project.org/package=imager/imager.pdf) library. 109 | Watershed algorithms are frequently used in topographical analysis to 110 | outline drainage basins. Given the morphological similarity between an 111 | inverted canopy and a terrain model, this same process can be used to 112 | outline tree crowns. However, a potential problem is the issue of 113 | *oversegmentation*, whereby branches, bumps and other spurious treetops 114 | are given their own segments. This source of error can be mitigated by 115 | using a variant of the algorithm known as *marker-controlled watershed 116 | segmentation* (Beucher & Meyer, 1993), whereby the watershed algorithm 117 | is constrained by a set of markers – in this case, treetops. 118 | 119 | The `mcws` function also takes a `minHeight` argument, although this 120 | value should be lower than that which was assigned to `vwf`. For the 121 | latter, `minHeight` defines the lowest expected treetop, whereas for the 122 | former it should correspond to the height above ground of the fringes of 123 | the lowest trees. 124 | 125 | ``` r 126 | # Create crown map 127 | crowns_ras <- mcws(treetops = ttops, CHM = chm, minHeight = 1.5) 128 | 129 | # Plot crowns 130 | plot(crowns_ras, col = sample(rainbow(50), nrow(unique(chm)), replace = TRUE), legend = FALSE, xlab = "", ylab = "", xaxt='n', yaxt = 'n') 131 | ``` 132 | 133 | ![](treetop_analysis_files/figure-gfm/unnamed-chunk-7-1.png) 134 | 135 | By default, `mcws` returns a raster, where each crown is given a unique 136 | cell value. Depending on the intended purpose of the crown map, it may 137 | be preferable to store these outlines as polygons. This can be 138 | accomplished by setting the `format` argument to “polygons”. As an added 139 | benefit, these polygons will inherit the attributes of the treetops from 140 | which they were generated, such as *height*. 141 | 142 | ``` r 143 | # Create polygon crown map 144 | crowns_poly <- mcws(treetops = ttops, CHM = chm, format = "polygons", minHeight = 1.5) 145 | 146 | # Plot CHM 147 | plot(chm, xlab = "", ylab = "", xaxt='n', yaxt = 'n') 148 | 149 | # Add crown outlines to the plot 150 | plot(crowns_poly$geometry, border = "blue", lwd = 0.5, add = TRUE) 151 | ``` 152 | 153 | ![](treetop_analysis_files/figure-gfm/unnamed-chunk-8-1.png) 154 | 155 | Assuming that each crown has a roughly circular shape, we can use the 156 | crown’s area to compute its average circular diameter. 157 | 158 | ``` r 159 | # Compute area and diameter 160 | crowns_poly[["area"]] <- st_area(crowns_poly) 161 | crowns_poly[["diameter"]] <- sqrt(crowns_poly[["area"]]/ pi) * 2 162 | 163 | # Mean crown diameter 164 | mean(crowns_poly$diameter) 165 | ``` 166 | 167 | ## 2.882985 [m] 168 | 169 | # References 170 | 171 | Popescu, S. C., & Wynne, R. H. (2004). [Seeing the trees in the 172 | forest](https://www.ingentaconnect.com/content/asprs/pers/2004/00000070/00000005/art00003). 173 | *Photogrammetric Engineering & Remote Sensing, 70*(5), 589-604. 174 | 175 | Beucher, S., and Meyer, F. (1993). [The morphological approach to 176 | segmentation: the watershed 177 | transformation](https://www.researchgate.net/profile/Serge-Beucher/publication/233950923_Segmentation_The_Watershed_Transformation_Mathematical_Morphology_in_Image_Processing/links/55f7c6ce08aeba1d9efe4072/Segmentation-The-Watershed-Transformation-Mathematical-Morphology-in-Image-Processing.pdf). 178 | *Mathematical morphology in image processing*, 433-481. 179 | -------------------------------------------------------------------------------- /inst/guides/treetop_analysis_files/figure-gfm/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/inst/guides/treetop_analysis_files/figure-gfm/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /inst/guides/treetop_analysis_files/figure-gfm/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/inst/guides/treetop_analysis_files/figure-gfm/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /inst/guides/treetop_analysis_files/figure-gfm/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/inst/guides/treetop_analysis_files/figure-gfm/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /inst/guides/treetop_analysis_files/figure-gfm/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/inst/guides/treetop_analysis_files/figure-gfm/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /man/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/man/figures/logo.png -------------------------------------------------------------------------------- /man/figures/treetops_segments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/man/figures/treetops_segments.png -------------------------------------------------------------------------------- /man/glcm.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/glcm.R 3 | \name{glcm} 4 | \alias{glcm} 5 | \title{Grey-Level Co-Occurrence Matrix} 6 | \usage{ 7 | glcm(image, segs = NULL, n_grey = 32, angle = c(0, 1), discretize_range = NULL) 8 | } 9 | \arguments{ 10 | \item{image}{SpatRaster. A single-band raster layer from which texture is measured} 11 | 12 | \item{segs}{SpatRaster. A segmented raster. Cell values should be equal to segment numbers. If \code{segs} are not provided, 13 | GLCM will be calculated for the entire image.} 14 | 15 | \item{n_grey}{integer. Number of grey levels into which the image will be discretized} 16 | 17 | \item{angle}{integer. Angle at which GLCM will be calculated. Ex.: `c(0,1)`} 18 | 19 | \item{discretize_range}{numeric. Vector of two values indicating the minimum and maximum input values for discretizing the image. 20 | This can be useful when processing tiles of a larger image, for which you may want to impose a consistent value range.} 21 | } 22 | \value{ 23 | data.frame 24 | } 25 | \description{ 26 | Generate textural metrics using Grey-Level Co-Occurrence Matrices (GLCM). Can be applied to an entire or image or, if a coterminous 27 | raster of segments is provided, GLCM can be calculated for each segment. 28 | } 29 | \examples{ 30 | \dontrun{ 31 | library(terra) 32 | library(ForestTools) 33 | 34 | chm <- rast(kootenayCHM) 35 | image <- rast(kootenayOrtho)[[1]] 36 | 37 | # Generate raster segments 38 | segs <- mcws(kootenayTrees, chm, minHeight = 0.2, format = "raster") 39 | 40 | # Get textural metrics for ortho's red band 41 | tex <- glcm(image, segs) 42 | } 43 | 44 | } 45 | \references{ 46 | Parmar, C., Velazquez, E.R., Leijenaar, R., Jermoumi, M., Carvalho, S., Mak, R.H., Mitra, S., Shankar, B.U., Kikinis, R., Haibe-Kains, B. and Lambin, P. (2014). 47 | \emph{Robust radiomics feature quantification using semiautomatic volumetric segmentation. PloS one, 9}(7) 48 | } 49 | \seealso{ 50 | \code{\link{mcws}} 51 | } 52 | -------------------------------------------------------------------------------- /man/kootenayBlocks.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/Kootenay.R 3 | \docType{data} 4 | \name{kootenayBlocks} 5 | \alias{kootenayBlocks} 6 | \title{Kootenay forest - Cut blocks} 7 | \format{ 8 | Simple polygon feature collection with the following attributes: 9 | \describe{ 10 | \item{BlockID}{numerical identifier for each block} 11 | \item{Shape_Leng}{length of polygon on meters} 12 | \item{Shape_Area}{area of polygon in square meters} 13 | } 14 | } 15 | \usage{ 16 | kootenayBlocks 17 | } 18 | \description{ 19 | Boundaries of cut blocks within a 1.5 hectare section of forest in 20 | the Kootenay mountains, in British Columbia, Canada. Each block contains trees of different 21 | levels of maturity. Overlaps with \link{kootenayTrees}, \link{kootenayCrowns}, \link{kootenayOrtho} and \link{kootenayCHM}. 22 | } 23 | \seealso{ 24 | \link{kootenayTrees} \link{kootenayCHM} \link{kootenayCrowns} \link{kootenayOrtho} 25 | } 26 | \keyword{datasets} 27 | -------------------------------------------------------------------------------- /man/kootenayCHM.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/Kootenay.R 3 | \docType{data} 4 | \name{kootenayCHM} 5 | \alias{kootenayCHM} 6 | \title{Kootenay forest - Canopy height model} 7 | \format{ 8 | PackedSpatRaster object 9 | \describe{Cell values are equal to canopy height above ground (in meters)} 10 | } 11 | \source{ 12 | Data acquired from a photogrammetric drone survey performed by Spire Aerobotics 13 | on June 16th, 2016. 14 | } 15 | \usage{ 16 | kootenayCHM 17 | } 18 | \description{ 19 | A canopy height model of a 1.5 hectare section of forest in the Kootenay mountains, in 20 | British Columbia, Canada. 21 | } 22 | \seealso{ 23 | \link{kootenayTrees} \link{kootenayBlocks} \link{kootenayCrowns} \link{kootenayOrtho} 24 | } 25 | \keyword{datasets} 26 | -------------------------------------------------------------------------------- /man/kootenayCrowns.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/Kootenay.R 3 | \docType{data} 4 | \name{kootenayCrowns} 5 | \alias{kootenayCrowns} 6 | \title{Kootenay forest - Tree crowns} 7 | \format{ 8 | Simple polygon feature collection with the following attributes: 9 | \describe{ 10 | \item{height}{height of the tree's apex, in meters above ground. Inherited from \link{kootenayTrees}.} 11 | \item{winRadius}{radius of the moving window at the treetop's location. Inherited from \link{kootenayTrees}.} 12 | \item{crownArea}{area of crown outline in square meters} 13 | } 14 | } 15 | \usage{ 16 | kootenayCrowns 17 | } 18 | \description{ 19 | Outlines of tree crowns corresponding to the \link{kootenayTrees} treetops. Generated using \link{mcws}. 20 | } 21 | \seealso{ 22 | \link{kootenayTrees} \link{kootenayCHM} \link{kootenayBlocks} \link{kootenayOrtho} 23 | } 24 | \keyword{datasets} 25 | -------------------------------------------------------------------------------- /man/kootenayOrtho.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/Kootenay.R 3 | \docType{data} 4 | \name{kootenayOrtho} 5 | \alias{kootenayOrtho} 6 | \title{Kootenay forest - Orthomosaic} 7 | \format{ 8 | PackedSpatRaster object 9 | \describe{Cell values are equal to canopy height above ground (in meters)} 10 | } 11 | \source{ 12 | Data acquired from a photogrammetric drone survey performed by Spire Aerobotics 13 | on June 16th, 2016. 14 | } 15 | \usage{ 16 | kootenayOrtho 17 | } 18 | \description{ 19 | An orthomosaic of a 1.5 hectare section of forest in the Kootenay mountains, in 20 | British Columbia, Canada. 21 | } 22 | \seealso{ 23 | \link{kootenayTrees} \link{kootenayBlocks} \link{kootenayCrowns} \link{kootenayCHM} 24 | } 25 | \keyword{datasets} 26 | -------------------------------------------------------------------------------- /man/kootenayTrees.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/Kootenay.R 3 | \docType{data} 4 | \name{kootenayTrees} 5 | \alias{kootenayTrees} 6 | \title{Kootenay forest - Dominant trees over 2 m} 7 | \format{ 8 | Simple point feature collection with the following attributes: 9 | \describe{ 10 | \item{height}{height of the tree's apex, in meters above ground} 11 | \item{winRadius}{radius of the moving window (see \code{\link{vwf}}) at 12 | the treetop's location} 13 | } 14 | } 15 | \usage{ 16 | kootenayTrees 17 | } 18 | \description{ 19 | Dominant trees from a 1.5 hectare section of forest in the Kootenay mountains, in 20 | British Columbia, Canada. Trees were detected by applying the \code{\link{vwf}} 21 | function to the \link{kootenayCHM} raster dataset. Only trees over 2 m above ground 22 | were detected. 23 | } 24 | \seealso{ 25 | \link{kootenayCHM} \link{kootenayBlocks} \link{kootenayCrowns} \link{kootenayOrtho} 26 | } 27 | \keyword{datasets} 28 | -------------------------------------------------------------------------------- /man/mcws.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mwcs.R 3 | \name{mcws} 4 | \alias{mcws} 5 | \title{Marker-Controlled Watershed Segmentation} 6 | \usage{ 7 | mcws( 8 | treetops, 9 | CHM, 10 | minHeight = 0, 11 | format = "raster", 12 | OSGeoPath = NULL, 13 | IDfield = "treeID" 14 | ) 15 | } 16 | \arguments{ 17 | \item{treetops}{sf. The point locations of treetops in \code{sf} format.} 18 | 19 | \item{CHM}{SpatRaster. Canopy height model in \code{SpatRaster} format. This should be the same CHM that was used to the detect the \code{treetops}.} 20 | 21 | \item{minHeight}{numeric. The minimum height value for a \code{CHM} pixel to be considered as part of a crown segment. 22 | All \code{CHM} pixels beneath this value will be masked out. Note that this value should be lower than the minimum 23 | height of \code{treetops}.} 24 | 25 | \item{format}{string. Format of the function's output. Can be set to either 'raster' or 'polygons'.} 26 | 27 | \item{OSGeoPath}{character. Obsolete. Will be removed next version} 28 | 29 | \item{IDfield}{character. Name of the field for storing the unique tree identifier} 30 | } 31 | \value{ 32 | Depending on the setting for \code{format}, this function will return a map of outlined 33 | crowns as either a \code{SpatRaster} class object, in which distinct crowns are given a unique cell value, or a \code{sf} class object, in which each crown 34 | is represented by a polygon. 35 | } 36 | \description{ 37 | This function implements the \link[imager]{watershed} function to segment (i.e.: outline) crowns from a CHM (canopy height model). 38 | Segmentation is guided by the point locations of treetops, typically detected using the \link{vwf} function. 39 | See Meyer & Beucher (1990) for details on watershed segmentation. 40 | } 41 | \details{ 42 | Crown segments are returned as either a \code{SpatRaster} or a \code{sf} (Simple Feature) class object, 43 | as defined using the \code{format} argument. For many analytic purposes, it is preferable to have 44 | crown outlines as polygons. However, polygonal crown maps take up significantly more disk space, and take 45 | longer to process. It is advisable to run this function using a raster output first to review 46 | results and adjust parameters. 47 | 48 | NOTE: when setting \code{format} to 'polygons', orphaned segments (i.e.: outlines without an associated treetop) will be removed. 49 | This will NOT occur using 'raster' format. This issue will be resolved eventually but requires the watershed function to 50 | be rewritten. 51 | } 52 | \examples{ 53 | \dontrun{ 54 | library(terra) 55 | library(ForestTools) 56 | 57 | chm <- rast(kootenayCHM) 58 | 59 | # Use variable window filter to detect treetops 60 | ttops <- vwf(chm, winFun = function(x){x * 0.06 + 0.5}, minHeight = 2) 61 | 62 | # Segment tree crowns 63 | segs <- mcws(ttops, chm, minHeight = 1) 64 | } 65 | 66 | } 67 | \references{ 68 | Meyer, F., & Beucher, S. (1990). Morphological segmentation. \emph{Journal of visual communication and 69 | image representation, 1}(1), 21-46. 70 | } 71 | \seealso{ 72 | \code{\link{vwf}} 73 | } 74 | -------------------------------------------------------------------------------- /man/quesnelBlocks.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/Quesnel.R 3 | \docType{data} 4 | \name{quesnelBlocks} 5 | \alias{quesnelBlocks} 6 | \title{Quesnel forest - Cut blocks} 7 | \format{ 8 | Simple polygon feature collection with the following attributes: 9 | \describe{ 10 | \item{BlockID}{numerical identifier for each block} 11 | \item{Shape_Leng}{length of polygon on meters} 12 | \item{Shape_Area}{area of polygon in square meters} 13 | } 14 | } 15 | \usage{ 16 | quesnelBlocks 17 | } 18 | \description{ 19 | Boundaries of cut blocks within a 125 hectare section of forest in the Quesnel Timber Supply Area, 20 | in British Columbia, Canada. Each block contains trees of different 21 | levels of maturity. Overlaps with \link{quesnelTrees} and \link{quesnelCHM}. 22 | } 23 | \seealso{ 24 | \link{quesnelTrees} \link{quesnelCHM} 25 | } 26 | \keyword{datasets} 27 | -------------------------------------------------------------------------------- /man/quesnelCHM.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/Quesnel.R 3 | \docType{data} 4 | \name{quesnelCHM} 5 | \alias{quesnelCHM} 6 | \title{Quesnel forest - Canopy height model} 7 | \format{ 8 | PackedSpatRaster object 9 | \describe{Cell values are equal to canopy height above ground (in meters)} 10 | } 11 | \source{ 12 | Data acquired from a photogrammetric drone survey performed by Spire Aerobotics 13 | on September 15th, 2016. 14 | } 15 | \usage{ 16 | quesnelCHM 17 | } 18 | \description{ 19 | A canopy height model of a 125 hectare section of forest in the Quesnel Timber Supply Area, in 20 | British Columbia, Canada. 21 | } 22 | \seealso{ 23 | \link{quesnelTrees} \link{quesnelBlocks} 24 | } 25 | \keyword{datasets} 26 | -------------------------------------------------------------------------------- /man/quesnelTrees.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/Quesnel.R 3 | \docType{data} 4 | \name{quesnelTrees} 5 | \alias{quesnelTrees} 6 | \title{Quesnel forest - Dominant trees over 2 m} 7 | \format{ 8 | Simple point feature collection with the following attributes: 9 | \describe{ 10 | \item{height}{height of the tree's apex, in meters above ground} 11 | \item{winRadius}{radius of the moving window (see \code{\link{vwf}}) at 12 | the treetop's location} 13 | } 14 | } 15 | \usage{ 16 | quesnelTrees 17 | } 18 | \description{ 19 | Dominant trees from a 125 hectare section of forest in the Quesnel Timber Supply Area, in 20 | British Columbia, Canada. Trees were detected by applying the \code{\link{vwf}} 21 | function to the \link{quesnelCHM} raster dataset. Only trees over 2 m above ground 22 | were detected. 23 | } 24 | \seealso{ 25 | \link{quesnelCHM} \link{quesnelBlocks} 26 | } 27 | \keyword{datasets} 28 | -------------------------------------------------------------------------------- /man/vwf.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/vwf.R 3 | \name{vwf} 4 | \alias{vwf} 5 | \title{Variable Window Filter} 6 | \usage{ 7 | vwf( 8 | CHM, 9 | winFun, 10 | minHeight = NULL, 11 | warnings = TRUE, 12 | minWinNeib = "queen", 13 | IDfield = "treeID", 14 | resolution_round = 5 15 | ) 16 | } 17 | \arguments{ 18 | \item{CHM}{SpatRaster. Canopy height model in SpatRaster format.} 19 | 20 | \item{winFun}{function. The function that determines the size of the window at any given location on the 21 | canopy. It should take the value of a given \code{CHM} pixel as its only argument, and return the desired *radius* of 22 | the circular search window when centered on that pixel. Size of the window is in map units.} 23 | 24 | \item{minHeight}{numeric. The minimum height value for a \code{CHM} pixel to be considered as a potential treetop. All \code{CHM} pixels beneath 25 | this value will be masked out.} 26 | 27 | \item{warnings}{logical. If set to FALSE, this function will not emit warnings related to inputs.} 28 | 29 | \item{minWinNeib}{character. Define whether the smallest possible search window (3x3) should use a \code{queen} or 30 | a \code{rook} neighborhood.} 31 | 32 | \item{IDfield}{character. Name of field for unique tree identifier} 33 | 34 | \item{resolution_round}{integer. The raster resolution is used to compute the dimensions of the search windows. By default, this resolution is rounded 35 | to 5 decimal places. The number of decimal places can be changed using this parameter. Increasing this value is also a work-around for errors 36 | relating to non-square cell sizes.} 37 | } 38 | \value{ 39 | Simple feature collection of POINT type. The point locations of detected treetops. The object contains two fields in its 40 | data table: \emph{height} is the height of the tree, as extracted from the \code{CHM}, and \emph{winRadius} is the radius 41 | of the search window when the treetop was detected. Note that \emph{winRadius} does not necessarily correspond to the radius 42 | of the tree's crown. 43 | } 44 | \description{ 45 | Implements the variable window filter algorithm (Popescu & Wynne, 2004) for detecting treetops from a canopy height model. 46 | } 47 | \details{ 48 | This function uses the resolution of the raster to figure out how many cells the window needs to cover. 49 | This means that the raster value (representing height above ground) and the map unit (represented by the raster's resolution), 50 | need to be in the _same unit_. This can cause issues if the raster is in lat/lon, whereby its resolution is in decimal degrees. 51 | } 52 | \examples{ 53 | \dontrun{ 54 | library(terra) 55 | library(ForestTools) 56 | 57 | chm <- rast(kootenayCHM) 58 | 59 | # Set function for determining variable window radius 60 | winFunction <- function(x){x * 0.06 + 0.5} 61 | 62 | # Set minimum tree height (treetops below this height will not be detected) 63 | minHgt <- 2 64 | 65 | # Detect treetops in demo canopy height model 66 | ttops <- vwf(chm, winFunction, minHgt) 67 | } 68 | 69 | } 70 | \references{ 71 | Popescu, S. C., & Wynne, R. H. (2004). Seeing the trees in the forest. \emph{Photogrammetric Engineering & Remote Sensing, 70}(5), 589-604. 72 | } 73 | \seealso{ 74 | \code{\link{mcws}} 75 | } 76 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | # This file is part of the standard setup for testthat. 2 | # It is recommended that you do not modify it. 3 | # 4 | # Where should you do additional test configuration? 5 | # Learn more about the roles of various files in: 6 | # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview 7 | # * https://testthat.r-lib.org/articles/special-files.html 8 | 9 | library(testthat) 10 | library(ForestTools) 11 | 12 | test_check("ForestTools") 13 | -------------------------------------------------------------------------------- /tests/testthat/test_data/CHM_3amigos.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/CHM_3amigos.tif -------------------------------------------------------------------------------- /tests/testthat/test_data/CHM_empty.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/CHM_empty.tif -------------------------------------------------------------------------------- /tests/testthat/test_data/CHM_latlon.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/CHM_latlon.tif -------------------------------------------------------------------------------- /tests/testthat/test_data/CHM_lowres.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/CHM_lowres.tif -------------------------------------------------------------------------------- /tests/testthat/test_data/CHM_orphans.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/CHM_orphans.tif -------------------------------------------------------------------------------- /tests/testthat/test_data/CHM_test.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/CHM_test.tif -------------------------------------------------------------------------------- /tests/testthat/test_data/areas_outside.Rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/areas_outside.Rda -------------------------------------------------------------------------------- /tests/testthat/test_data/areas_overlap.Rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/areas_overlap.Rda -------------------------------------------------------------------------------- /tests/testthat/test_data/areas_partial.Rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/areas_partial.Rda -------------------------------------------------------------------------------- /tests/testthat/test_data/glcm-bars.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/glcm-bars.rda -------------------------------------------------------------------------------- /tests/testthat/test_data/glcm-hallbey.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/glcm-hallbey.rda -------------------------------------------------------------------------------- /tests/testthat/test_data/glcm-noise.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/glcm-noise.rda -------------------------------------------------------------------------------- /tests/testthat/test_data/glcm-psf.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/glcm-psf.rda -------------------------------------------------------------------------------- /tests/testthat/test_data/glcm-tumor.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/glcm-tumor.rda -------------------------------------------------------------------------------- /tests/testthat/test_data/ttops_3amigos.Rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/ttops_3amigos.Rda -------------------------------------------------------------------------------- /tests/testthat/test_data/ttops_orphans.Rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/ttops_orphans.Rda -------------------------------------------------------------------------------- /tests/testthat/test_data/ttops_orphans.gpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/ttops_orphans.gpkg -------------------------------------------------------------------------------- /tests/testthat/test_data/ttops_test.Rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/ttops_test.Rda -------------------------------------------------------------------------------- /tests/testthat/test_data/ttops_test.gpkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew-plowright/ForestTools/2b53b23c08f3bc2a7c1e109b761392148c397fa4/tests/testthat/test_data/ttops_test.gpkg -------------------------------------------------------------------------------- /tests/testthat/test_glcm.R: -------------------------------------------------------------------------------- 1 | # Read in test data 2 | test_ext <- terra::ext(439740.0, 439781.7, 5526491.8, 5526523.5) 3 | test_chm <- terra::crop(terra::rast(kootenayCHM), test_ext) 4 | test_img <- terra::crop(terra::rast(kootenayOrtho)[[1]], test_ext) 5 | 6 | sf::st_agr(kootenayTrees) <- "constant" 7 | test_trees <- sf::st_crop(kootenayTrees, sf::st_bbox(test_ext)) 8 | 9 | # Create segments 10 | segs <- mcws(test_trees, test_chm, minHeight = 0.2, format = "raster") 11 | 12 | # Create blank segments 13 | segs_empty <- terra::setValues(segs, NA) 14 | 15 | # Create an image with some blank values 16 | test_img_empty <- terra::setValues(test_img, NA) 17 | 18 | 19 | test_that("glcm_img: successful", { 20 | 21 | tex <- glcm(test_chm) 22 | 23 | expect_equal(unname(tex["glcm_mean"]), 6.06713953, tolerance = 0.001) 24 | expect_equal(unname(tex["glcm_entropy"]), 4.254495, tolerance = 0.001) 25 | expect_equal(unname(tex["glcm_contrast"]), 3.05149631, tolerance = 0.001) 26 | }) 27 | 28 | test_that("glcm: with segments", { 29 | 30 | # Compute texture with standard segments 31 | tex1 <- glcm(test_img, segs) 32 | 33 | # All segments are included 34 | expect_true(all(na.omit(unique(terra::values(segs, mat=FALSE))) %in% row.names(tex1))) 35 | 36 | # No missing values 37 | expect_false(any(is.na(tex1$glcm_mean))) 38 | 39 | expect_equal(tex1[1, "glcm_mean"], 12.66667, tolerance = 0.001) 40 | expect_equal(tex1[1, "glcm_entropy"], 0.6365142 , tolerance = 0.001) 41 | expect_equal(tex1[1, "glcm_contrast"], 0, tolerance = 0.001) 42 | }) 43 | 44 | test_that("glcm: errors with empty inputs", { 45 | 46 | # Compute text with blank segments 47 | expect_error(glcm(test_img, segs_empty), "'segs' must contain usable values") 48 | expect_error(glcm(test_img_empty, segs), "'image' must contain usable values") 49 | 50 | }) 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /tests/testthat/test_glcm_internal.R: -------------------------------------------------------------------------------- 1 | # NOTE 2 | # These tests are a holdover from when this package had its own function for making GLCMs 3 | # Since 2024-04-27, ForestTools now delegates this to the external GLCMTextures library, which is tested here. 4 | # It's debatable whether or not testing GLCMTextures is appropriate within the ForestTools package, but 5 | # I've included these anyways just to ensure consistency of results 6 | 7 | # Load test data 8 | load('test_data/glcm-hallbey.rda') 9 | load('test_data/glcm-tumor.rda') 10 | load('test_data/glcm-noise.rda') 11 | load('test_data/glcm-bars.rda') 12 | 13 | metrics<- c("glcm_contrast", "glcm_dissimilarity", "glcm_homogeneity", "glcm_ASM", "glcm_entropy", "glcm_mean", "glcm_variance", "glcm_correlation") 14 | 15 | # Discretize images 16 | hallbey_disc <- terra::as.matrix(.discretize_rast(terra::rast(hallbey), n_grey = 4), wide = TRUE) 17 | tumor_disc <- terra::as.matrix(.discretize_rast(terra::rast(tumor), n_grey = 32), wide = TRUE) 18 | noise_disc <- terra::as.matrix(.discretize_rast(terra::rast(noise), n_grey = 32), wide = TRUE) 19 | bars_disc <- terra::as.matrix(.discretize_rast(terra::rast(bars), n_grey = 20), wide = TRUE) 20 | 21 | # Read function 22 | read_validation_matrix <- function(name){ 23 | unname(as.matrix(read.table(file.path("validation_data/glcm", paste0(name, ".csv")), header=TRUE, sep=",", check.names=FALSE, row.names = 1) ) ) 24 | } 25 | read_validation_metrics <- function(name){ 26 | unlist(read.csv(file.path("validation_data/glcm_metrics", paste0(name, ".csv")), stringsAsFactors = FALSE)) 27 | } 28 | 29 | 30 | # Tests 31 | test_that("0 degree GLCM", { 32 | 33 | expect_equal(GLCMTextures::make_glcm(hallbey_disc - 1, shift=c(1,0), n_levels= 4), read_validation_matrix("hallbey0"), tolerance = 0.001) 34 | expect_equal(GLCMTextures::make_glcm(tumor_disc - 1, shift=c(1,0), n_levels=32), read_validation_matrix("tumor0"), tolerance = 0.001) 35 | expect_equal(GLCMTextures::make_glcm(noise_disc - 1, shift=c(1,0), n_levels=32), read_validation_matrix("noise0"), tolerance = 0.001) 36 | expect_equal(GLCMTextures::make_glcm(bars_disc - 1, shift=c(1,0), n_levels=20), read_validation_matrix("bars0"), tolerance = 0.001) 37 | 38 | }) 39 | 40 | test_that("45 degree GLCM", { 41 | 42 | expect_equal(GLCMTextures::make_glcm(hallbey_disc - 1, shift=c(1,1), n_levels= 4), read_validation_matrix("hallbey45"), tolerance = 0.001) 43 | expect_equal(GLCMTextures::make_glcm(tumor_disc - 1, shift=c(1,1), n_levels=32), read_validation_matrix("tumor45"), tolerance = 0.001) 44 | expect_equal(GLCMTextures::make_glcm(noise_disc - 1, shift=c(1,1), n_levels=32), read_validation_matrix("noise45"), tolerance = 0.001) 45 | expect_equal(GLCMTextures::make_glcm(bars_disc - 1, shift=c(1,1), n_levels=20), read_validation_matrix("bars45"), tolerance = 0.001) 46 | 47 | }) 48 | 49 | test_that("90 degree GLCM", { 50 | 51 | expect_equal(GLCMTextures::make_glcm(hallbey_disc - 1, shift=c(0,1), n_levels= 4), read_validation_matrix("hallbey90"), tolerance = 0.001) 52 | expect_equal(GLCMTextures::make_glcm(tumor_disc - 1, shift=c(0,1), n_levels=32), read_validation_matrix("tumor90"), tolerance = 0.001) 53 | expect_equal(GLCMTextures::make_glcm(noise_disc - 1, shift=c(0,1), n_levels=32), read_validation_matrix("noise90"), tolerance = 0.001) 54 | expect_equal(GLCMTextures::make_glcm(bars_disc - 1, shift=c(0,1), n_levels=20), read_validation_matrix("bars90"), tolerance = 0.001) 55 | 56 | }) 57 | 58 | test_that("135 degree GLCM", { 59 | 60 | expect_equal(GLCMTextures::make_glcm(hallbey_disc - 1, shift=c(-1,1), n_levels= 4), read_validation_matrix("hallbey135"), tolerance = 0.001) 61 | expect_equal(GLCMTextures::make_glcm(tumor_disc - 1, shift=c(-1,1), n_levels=32), read_validation_matrix("tumor135"), tolerance = 0.001) 62 | expect_equal(GLCMTextures::make_glcm(noise_disc - 1, shift=c(-1,1), n_levels=32), read_validation_matrix("noise135"), tolerance = 0.001) 63 | expect_equal(GLCMTextures::make_glcm(bars_disc - 1, shift=c(-1,1), n_levels=20), read_validation_matrix("bars135"), tolerance = 0.001) 64 | 65 | }) 66 | 67 | test_that("0 degree GLCM metrics", { 68 | 69 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(hallbey_disc - 1, shift=c(1,0), n_levels= 4), metrics=metrics), read_validation_metrics("hallbey0")[metrics], tolerance = 0.001) 70 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(tumor_disc - 1, shift=c(1,0), n_levels=32), metrics=metrics), read_validation_metrics("tumor0")[metrics], tolerance = 0.001) 71 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(noise_disc - 1, shift=c(1,0), n_levels=32), metrics=metrics), read_validation_metrics("noise0")[metrics], tolerance = 0.001) 72 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(bars_disc - 1, shift=c(1,0), n_levels=20), metrics=metrics), read_validation_metrics("bars0")[metrics], tolerance = 0.001) 73 | 74 | }) 75 | 76 | test_that("45 degree GLCM metrics", { 77 | 78 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(hallbey_disc - 1, shift=c(1,1), n_levels= 4), metrics=metrics), read_validation_metrics("hallbey45")[metrics], tolerance = 0.001) 79 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(tumor_disc - 1, shift=c(1,1), n_levels=32), metrics=metrics), read_validation_metrics("tumor45")[metrics], tolerance = 0.001) 80 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(noise_disc - 1, shift=c(1,1), n_levels=32), metrics=metrics), read_validation_metrics("noise45")[metrics], tolerance = 0.001) 81 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(bars_disc - 1, shift=c(1,1), n_levels=20), metrics=metrics), read_validation_metrics("bars45")[metrics], tolerance = 0.001) 82 | 83 | }) 84 | 85 | test_that("90 degree GLCM metrics", { 86 | 87 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(hallbey_disc - 1, shift=c(0,1), n_levels= 4), metrics=metrics), read_validation_metrics("hallbey90")[metrics], tolerance = 0.001) 88 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(tumor_disc - 1, shift=c(0,1), n_levels=32), metrics=metrics), read_validation_metrics("tumor90")[metrics], tolerance = 0.001) 89 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(noise_disc - 1, shift=c(0,1), n_levels=32), metrics=metrics), read_validation_metrics("noise90")[metrics], tolerance = 0.001) 90 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(bars_disc - 1, shift=c(0,1), n_levels=20), metrics=metrics), read_validation_metrics("bars90")[metrics], tolerance = 0.001) 91 | 92 | }) 93 | 94 | test_that("135 degree GLCM metrics", { 95 | 96 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(hallbey_disc - 1, shift=c(-1,1), n_levels= 4), metrics=metrics), read_validation_metrics("hallbey135")[metrics], tolerance = 0.001) 97 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(tumor_disc - 1, shift=c(-1,1), n_levels=32), metrics=metrics), read_validation_metrics("tumor135")[metrics], tolerance = 0.001) 98 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(noise_disc - 1, shift=c(-1,1), n_levels=32), metrics=metrics), read_validation_metrics("noise135")[metrics], tolerance = 0.001) 99 | expect_equal(GLCMTextures::glcm_metrics(GLCMTextures::make_glcm(bars_disc - 1, shift=c(-1,1), n_levels=20), metrics=metrics), read_validation_metrics("bars135")[metrics], tolerance = 0.001) 100 | 101 | }) 102 | 103 | 104 | test_that("Edge cases: all zeroes", { 105 | 106 | # Note that the significance of this test has changed since it was originally written. 107 | # GLCMTextures treats '0' as an ordinary value, instead of a missing value 108 | 109 | zero <- matrix(0, nrow=3, ncol=3) 110 | 111 | zero_glcm <- GLCMTextures::make_glcm(zero, shift=c(0,1), n_levels = 1) 112 | 113 | expect_equal(zero_glcm, matrix(1)) 114 | 115 | expect_true(all(GLCMTextures::glcm_metrics(zero_glcm) %in% list(NaN, 1, 0))) 116 | 117 | }) 118 | 119 | 120 | -------------------------------------------------------------------------------- /tests/testthat/test_mcws.R: -------------------------------------------------------------------------------- 1 | # Load test data 2 | ttops_test <- sf::st_read("test_data/ttops_test.gpkg", quiet=TRUE) 3 | ttops_orphans <- sf::st_read("test_data/ttops_orphans.gpkg", quiet=TRUE) 4 | CHM_test <- terra::rast("test_data/CHM_test.tif") 5 | CHM_empty <- terra::rast("test_data/CHM_empty.tif") 6 | CHM_orphans <- terra::rast("test_data/CHM_orphans.tif") 7 | 8 | 9 | test_that("mcws: expected results using standard parameters", { 10 | 11 | segs_standard <- mcws(ttops_test, CHM_test, minHeight = 1) 12 | 13 | expect_equal(length(unique(segs_standard[])), 1116) 14 | }) 15 | 16 | test_that("mcws: returns an error if 'minHeight' is too high",{ 17 | 18 | expect_error(mcws(ttops_test, CHM_test, minHeight = 30), 19 | "\'minHeight\' is set higher than the highest cell value in \'CHM\'") 20 | }) 21 | 22 | test_that("mcws: returns an error if 'CHM' is empty",{ 23 | 24 | expect_error(mcws(ttops_test, CHM_empty), 25 | "'CHM' does not contain any usable values.") 26 | }) 27 | 28 | test_that("mcws: removes trees outside of CHM area and those that over NA values",{ 29 | 30 | # Perform segmentation on 'orphan trees' test dataset 31 | segs_poly <- mcws(ttops_orphans, CHM_orphans, format = "polygons") 32 | segs_ras <- mcws(ttops_orphans, CHM_orphans, format = "raster") 33 | segs_poly_min_2m <- mcws(ttops_orphans, CHM_orphans, minHeight = 2, format = "polygons") 34 | segs_ras_min_2m <- mcws(ttops_orphans, CHM_orphans, minHeight = 2, format = "raster") 35 | 36 | # Expected behaviour: ttops_vals will equal NaN for any trees outside the range, and NA for NA values inside the range 37 | # using is.finite filters out both 38 | 39 | ttops_vals <- terra::extract(CHM_orphans, ttops_orphans)[,2] 40 | ttops_valid <- ttops_orphans[is.finite(ttops_vals),] 41 | ttops_min_2m <- ttops_orphans[is.finite(ttops_vals) & ttops_vals >= 2,] 42 | 43 | # Count unique segments for raster segments 44 | segs_ras_unique <- terra::unique(segs_ras)[,1] 45 | segs_ras_unique_min_2m <- terra::unique(segs_ras_min_2m)[,1] 46 | 47 | expect_equal(nrow(ttops_valid), nrow(segs_poly)) 48 | expect_equal(nrow(ttops_valid), length(segs_ras_unique)) 49 | expect_equal(nrow(ttops_min_2m), nrow(segs_poly_min_2m)) 50 | expect_equal(nrow(ttops_min_2m), length(segs_ras_unique_min_2m)) 51 | }) 52 | 53 | # Remove reused data 54 | rm(ttops_test, ttops_orphans, CHM_test, CHM_orphans, CHM_empty) 55 | 56 | -------------------------------------------------------------------------------- /tests/testthat/test_vwf.R: -------------------------------------------------------------------------------- 1 | ### LOAD TEST DATA ---- 2 | 3 | chm_test <- terra::rast("test_data/CHM_test.tif") 4 | chm_empty <- terra::rast("test_data/CHM_empty.tif") 5 | chm_lowres <- terra::rast("test_data/CHM_lowres.tif") 6 | chm_latlon <- terra::rast("test_data/CHM_latlon.tif") 7 | 8 | ### PERFORM TESTS ---- 9 | 10 | test_that("vwf: expected results using standard parameters", { 11 | 12 | trees_std <- vwf(chm_test, function(x){x * 0.05 + 0.8}, minHeight = 1.5) 13 | 14 | expect_equal(nrow(trees_std), 1115) 15 | expect_equal(mean(trees_std[["height"]]), 5.857549, tolerance = 0.0000001) 16 | expect_equal( min(trees_std[["height"]]), 1.503213, tolerance = 0.0000001) 17 | expect_equal( max(trees_std[["height"]]), 26.89251, tolerance = 0.0000001) 18 | }) 19 | 20 | 21 | test_that("vwf: returns an error if 'minHeight' is too high",{ 22 | 23 | expect_error(vwf(chm_test, function(x){x * 0.05 + 0.8}, minHeight = 40), 24 | "\'minHeight\' is set to a value higher than the highest cell value in 'CHM'") 25 | 26 | }) 27 | 28 | test_that("vwf: returns an error if 'CHM' is empty",{ 29 | 30 | expect_error(vwf(chm_empty, function(x){x * 0.05 + 0.8}), 31 | "Could not compute min/max range of CHM.") 32 | }) 33 | 34 | test_that("vwf: error if window size is too low for a given CHM",{ 35 | 36 | err <- "The map units of the 'CHM' are too small" 37 | warn <- "The input CHM has a lat/lon coordinate system. Projected coordinate systems are recommended." 38 | 39 | expect_warning(expect_error(vwf(chm_latlon, function(x){x * 0.03 + 0.2}), err), warn) 40 | }) 41 | 42 | test_that("vwf: produces warnings for lat/lon CRS", { 43 | 44 | win_fun <- function(x){x * 0.05 + 0.8} 45 | min_hgt <- 1 46 | 47 | # WGS 84 (produces warning) 48 | chm_4326 <- terra::rast(matrix(3, nrow=10, ncol=10), crs='EPSG:4326') 49 | expect_warning(vwf(chm_4326, win_fun, min_hgt), "The input CHM has a lat/lon coordinate system.") 50 | 51 | # NAD 83 (produces warning) 52 | chm_4269 <- terra::rast(matrix(3, nrow=10, ncol=10), crs='EPSG:4269') 53 | expect_warning(vwf(chm_4269, win_fun, min_hgt), "The input CHM has a lat/lon coordinate system.") 54 | 55 | # WGS 84 with ellipsoidal height (produces warning) 56 | chm_4979 <- terra::rast(matrix(3, nrow=10, ncol=10), crs='EPSG:4979') 57 | expect_warning(vwf(chm_4979, win_fun, min_hgt), "The input CHM has a lat/lon coordinate system.") 58 | 59 | # Web Mercator (no warning) 60 | chm_3857 <- terra::rast(matrix(3, nrow=10, ncol=10), crs='EPSG:3857') 61 | expect_silent(vwf(chm_3857, win_fun, min_hgt)) 62 | 63 | # UTM Zone 33N (no warning) 64 | chm_32633 <- terra::rast(matrix(3, nrow=10, ncol=10), crs='EPSG:32633') 65 | expect_silent(vwf(chm_32633, win_fun, min_hgt)) 66 | 67 | # NAD83 / UTM Zone 18N (no warning) 68 | chm_26918 <- terra::rast(matrix(3, nrow=10, ncol=10), crs='EPSG:26918') 69 | expect_silent(vwf(chm_26918, win_fun, min_hgt)) 70 | 71 | # No CRS (no warning) 72 | chm_nocrs <- terra::rast(matrix(3, nrow=10, ncol=10)) 73 | expect_silent(vwf(chm_nocrs, win_fun, min_hgt)) 74 | 75 | }) 76 | 77 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/bars0.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 2 | 1,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 2,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 3,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 4,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 5,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 6,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0 8 | 7,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0 9 | 8,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0 10 | 9,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0 11 | 10,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0 12 | 11,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0 13 | 12,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0 14 | 13,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0 15 | 14,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0 16 | 15,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0 17 | 16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0 18 | 17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0 19 | 18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0 20 | 19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789 21 | 20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0 22 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/bars135.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 2 | 1,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 2,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 3,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 4,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 5,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 6,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0 8 | 7,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0 9 | 8,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0 10 | 9,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0 11 | 10,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0 12 | 11,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0 13 | 12,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0 14 | 13,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0 15 | 14,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0 16 | 15,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0 17 | 16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0 18 | 17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0 19 | 18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0 20 | 19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789 21 | 20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0 22 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/bars45.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 2 | 1,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 2,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 3,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 4,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 5,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 6,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0,0 8 | 7,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0,0 9 | 8,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0,0 10 | 9,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0,0 11 | 10,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0,0 12 | 11,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0,0 13 | 12,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0,0 14 | 13,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0,0 15 | 14,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0,0 16 | 15,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0,0 17 | 16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0,0 18 | 17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0,0 19 | 18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789,0 20 | 19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0,0.026315789 21 | 20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.026315789,0 22 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/bars90.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 2 | 1,0.05,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 2,0,0.05,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 3,0,0,0.05,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 4,0,0,0,0.05,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 5,0,0,0,0,0.05,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 6,0,0,0,0,0,0.05,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8 | 7,0,0,0,0,0,0,0.05,0,0,0,0,0,0,0,0,0,0,0,0,0 9 | 8,0,0,0,0,0,0,0,0.05,0,0,0,0,0,0,0,0,0,0,0,0 10 | 9,0,0,0,0,0,0,0,0,0.05,0,0,0,0,0,0,0,0,0,0,0 11 | 10,0,0,0,0,0,0,0,0,0,0.05,0,0,0,0,0,0,0,0,0,0 12 | 11,0,0,0,0,0,0,0,0,0,0,0.05,0,0,0,0,0,0,0,0,0 13 | 12,0,0,0,0,0,0,0,0,0,0,0,0.05,0,0,0,0,0,0,0,0 14 | 13,0,0,0,0,0,0,0,0,0,0,0,0,0.05,0,0,0,0,0,0,0 15 | 14,0,0,0,0,0,0,0,0,0,0,0,0,0,0.05,0,0,0,0,0,0 16 | 15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.05,0,0,0,0,0 17 | 16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.05,0,0,0,0 18 | 17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.05,0,0,0 19 | 18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.05,0,0 20 | 19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.05,0 21 | 20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.05 22 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/hallbey0.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4 2 | 1,0.166666667,0.083333333,0.041666667,0 3 | 2,0.083333333,0.166666667,0,0 4 | 3,0.041666667,0,0.25,0.041666667 5 | 4,0,0,0.041666667,0.083333333 6 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/hallbey135.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4 2 | 1,0.111111111,0.055555556,0.166666667,0 3 | 2,0.055555556,0.111111111,0.055555556,0 4 | 3,0.166666667,0.055555556,0,0.111111111 5 | 4,0,0,0.111111111,0 6 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/hallbey45.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4 2 | 1,0.222222222,0.055555556,0,0 3 | 2,0.055555556,0.111111111,0.111111111,0 4 | 3,0,0.111111111,0.222222222,0.055555556 5 | 4,0,0,0.055555556,0 6 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/hallbey90.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4 2 | 1,0.25,0,0.083333333,0 3 | 2,0,0.166666667,0.083333333,0 4 | 3,0.083333333,0.083333333,0.083333333,0.083333333 5 | 4,0,0,0.083333333,0 6 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/noise0.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32 2 | 1,0.001632653,0.00122449,0.001020408,0.00122449,0.000612245,0.001632653,0.001836735,0.001632653,0.001020408,0.000408163,0.002040816,0.00122449,0.001020408,0.001632653,0.001836735,0.001632653,0.000612245,0.001020408,0.002244898,0.000816327,0.00122449,0.000816327,0.000408163,0.001428571,0.000816327,0.001428571,0.001836735,0.002040816,0.001428571,0.000816327,0.00122449,0.00122449 3 | 2,0.00122449,0,0.001428571,0.000612245,0.000816327,0.000816327,0.000612245,0.000612245,0.000816327,0.001428571,0.001632653,0.001020408,0.000408163,0.000816327,0.001020408,0.000816327,0.000816327,0.000816327,0,0.001020408,0.001428571,0.000408163,0.00122449,0.001020408,0.000204082,0.000816327,0.000612245,0.000612245,0.000408163,0.00122449,0.00122449,0.001836735 4 | 3,0.001020408,0.001428571,0.002040816,0.00122449,0.00122449,0.000408163,0.000612245,0.001428571,0.000612245,0.001428571,0.001428571,0.000408163,0.00122449,0.000816327,0.001632653,0.00122449,0.000816327,0.000204082,0,0.000408163,0.00122449,0.00122449,0,0.000816327,0.000816327,0.001020408,0.001020408,0.000816327,0,0.000816327,0.001020408,0.000612245 5 | 4,0.00122449,0.000612245,0.00122449,0.00122449,0.000612245,0.000816327,0.00122449,0.000816327,0.000816327,0.000612245,0.001428571,0.001632653,0.000816327,0.000612245,0.000816327,0.001632653,0.000816327,0.000612245,0.002040816,0.001020408,0.001632653,0.001632653,0.000612245,0.001020408,0.00122449,0.000204082,0.001020408,0.000612245,0.000612245,0.001020408,0.000408163,0.001020408 6 | 5,0.000612245,0.000816327,0.00122449,0.000612245,0.000408163,0.00122449,0,0.000816327,0.001020408,0.000816327,0.001428571,0.00122449,0.00122449,0.000816327,0.000204082,0.000204082,0.001428571,0.001020408,0.000408163,0.00122449,0.001020408,0.001632653,0.00122449,0.000816327,0.001428571,0.000816327,0.000816327,0.000204082,0.000612245,0.001020408,0.000612245,0.001020408 7 | 6,0.001632653,0.000816327,0.000408163,0.000816327,0.00122449,0.000408163,0.001020408,0.000408163,0.00122449,0.00122449,0.000612245,0,0.00122449,0.00122449,0.001020408,0.000816327,0.000408163,0.001020408,0.001632653,0.001428571,0.000816327,0.001632653,0.000204082,0.001428571,0.001632653,0.001428571,0.000816327,0.001632653,0.001428571,0.000816327,0.000408163,0.001020408 8 | 7,0.001836735,0.000612245,0.000612245,0.00122449,0,0.001020408,0.000816327,0.001836735,0.001020408,0.001020408,0.001428571,0.000816327,0.000816327,0.000612245,0.00122449,0.001428571,0,0.001020408,0.000612245,0.000612245,0.000612245,0.001836735,0.001020408,0.000816327,0.000816327,0.000612245,0.000816327,0.001020408,0.000408163,0.000816327,0.001020408,0.00122449 9 | 8,0.001632653,0.000612245,0.001428571,0.000816327,0.000816327,0.000408163,0.001836735,0,0.001428571,0.001836735,0.001632653,0.00122449,0.001020408,0.001020408,0.00122449,0.000816327,0.00122449,0.000816327,0.000408163,0.000612245,0.000204082,0.001836735,0.00122449,0.000408163,0.000612245,0.000816327,0.00122449,0.001632653,0.000816327,0.000816327,0.000204082,0.000408163 10 | 9,0.001020408,0.000816327,0.000612245,0.000816327,0.001020408,0.00122449,0.001020408,0.001428571,0.000816327,0.000408163,0.000816327,0.000612245,0.000816327,0.000204082,0.001020408,0.00122449,0.000612245,0.000408163,0.000612245,0.000816327,0.001020408,0.001632653,0.000408163,0.000408163,0.000816327,0.001632653,0.000816327,0.00122449,0.000612245,0.000816327,0.000816327,0.001632653 11 | 10,0.000408163,0.001428571,0.001428571,0.000612245,0.000816327,0.00122449,0.001020408,0.001836735,0.000408163,0.000816327,0.000816327,0.000816327,0.000408163,0.000816327,0.001428571,0.000816327,0.00122449,0.001020408,0.000612245,0.000612245,0.001020408,0.000408163,0.000816327,0.001428571,0.001428571,0.001428571,0.000408163,0.00122449,0.000816327,0.000408163,0.000612245,0.000612245 12 | 11,0.002040816,0.001632653,0.001428571,0.001428571,0.001428571,0.000612245,0.001428571,0.001632653,0.000816327,0.000816327,0.003265306,0.001836735,0.000816327,0.00244898,0.002244898,0.000816327,0.001632653,0.000816327,0.000408163,0.001020408,0.000612245,0.001020408,0.001632653,0.000612245,0.001428571,0.000816327,0.00122449,0.001836735,0.00122449,0.001428571,0.000816327,0.00122449 13 | 12,0.00122449,0.001020408,0.000408163,0.001632653,0.00122449,0,0.000816327,0.00122449,0.000612245,0.000816327,0.001836735,0.000408163,0.000408163,0.001632653,0.001020408,0.000816327,0.00122449,0.000816327,0.001428571,0.000816327,0.000612245,0.000408163,0.001836735,0.001428571,0.001632653,0.001020408,0.00122449,0.002040816,0.001632653,0.001020408,0.001020408,0.000612245 14 | 13,0.001020408,0.000408163,0.00122449,0.000816327,0.00122449,0.00122449,0.000816327,0.001020408,0.000816327,0.000408163,0.000816327,0.000408163,0.000408163,0.000612245,0.000816327,0.00122449,0.001836735,0.001428571,0.000204082,0.000612245,0.00122449,0.001428571,0.00122449,0.001020408,0.00122449,0.00122449,0.000612245,0.00122449,0.001020408,0.000408163,0.001020408,0.000612245 15 | 14,0.001632653,0.000816327,0.000816327,0.000612245,0.000816327,0.00122449,0.000612245,0.001020408,0.000204082,0.000816327,0.00244898,0.001632653,0.000612245,0.00122449,0.000408163,0.001836735,0.000408163,0.000408163,0.001428571,0.000612245,0.001020408,0.002040816,0.000612245,0.000816327,0.000612245,0.000816327,0.001020408,0.000408163,0.001020408,0.000612245,0.00122449,0.001632653 16 | 15,0.001836735,0.001020408,0.001632653,0.000816327,0.000204082,0.001020408,0.00122449,0.00122449,0.001020408,0.001428571,0.002244898,0.001020408,0.000816327,0.000408163,0.00122449,0.001632653,0.00122449,0.000408163,0.000204082,0.001020408,0.001428571,0.001020408,0.000816327,0.000612245,0.000816327,0.001020408,0.000816327,0.000816327,0.001020408,0.00122449,0.000408163,0.000408163 17 | 16,0.001632653,0.000816327,0.00122449,0.001632653,0.000204082,0.000816327,0.001428571,0.000816327,0.00122449,0.000816327,0.000816327,0.000816327,0.00122449,0.001836735,0.001632653,0.00122449,0.00122449,0.000612245,0.00122449,0.00122449,0.00122449,0.00122449,0.001428571,0.001428571,0.000816327,0.001632653,0.000612245,0.000204082,0.001020408,0.000816327,0.000408163,0.000816327 18 | 17,0.000612245,0.000816327,0.000816327,0.000816327,0.001428571,0.000408163,0,0.00122449,0.000612245,0.00122449,0.001632653,0.00122449,0.001836735,0.000408163,0.00122449,0.00122449,0.00244898,0.001020408,0.001428571,0.000408163,0.000408163,0.000816327,0.000204082,0.001428571,0.001428571,0.000408163,0.000408163,0.000816327,0.001428571,0.001020408,0.000408163,0.001020408 19 | 18,0.001020408,0.000816327,0.000204082,0.000612245,0.001020408,0.001020408,0.001020408,0.000816327,0.000408163,0.001020408,0.000816327,0.000816327,0.001428571,0.000408163,0.000408163,0.000612245,0.001020408,0.000816327,0.000612245,0.000408163,0.000816327,0.000408163,0.000612245,0.002040816,0.001020408,0.000612245,0.000408163,0.000612245,0.000408163,0.000408163,0.000408163,0.001020408 20 | 19,0.002244898,0,0,0.002040816,0.000408163,0.001632653,0.000612245,0.000408163,0.000612245,0.000612245,0.000408163,0.001428571,0.000204082,0.001428571,0.000204082,0.00122449,0.001428571,0.000612245,0.00122449,0.001020408,0.000204082,0.001428571,0.001020408,0.000816327,0.001428571,0.000408163,0.000612245,0.00122449,0.00122449,0.000816327,0.00122449,0.001020408 21 | 20,0.000816327,0.001020408,0.000408163,0.001020408,0.00122449,0.001428571,0.000612245,0.000612245,0.000816327,0.000612245,0.001020408,0.000816327,0.000612245,0.000612245,0.001020408,0.00122449,0.000408163,0.000408163,0.001020408,0.000408163,0.000612245,0.00122449,0.00122449,0.000408163,0.00122449,0.00122449,0.000204082,0.000816327,0.000408163,0.000612245,0.00122449,0.000612245 22 | 21,0.00122449,0.001428571,0.00122449,0.001632653,0.001020408,0.000816327,0.000612245,0.000204082,0.001020408,0.001020408,0.000612245,0.000612245,0.00122449,0.001020408,0.001428571,0.00122449,0.000408163,0.000816327,0.000204082,0.000612245,0.000408163,0.000816327,0.001428571,0.001020408,0.001020408,0.001428571,0.00122449,0.001020408,0.000612245,0.001020408,0.00122449,0.001020408 23 | 22,0.000816327,0.000408163,0.00122449,0.001632653,0.001632653,0.001632653,0.001836735,0.001836735,0.001632653,0.000408163,0.001020408,0.000408163,0.001428571,0.002040816,0.001020408,0.00122449,0.000816327,0.000408163,0.001428571,0.00122449,0.000816327,0.00122449,0.002244898,0.001020408,0.001020408,0.001020408,0.001428571,0.001836735,0.001020408,0.000612245,0.001020408,0.002244898 24 | 23,0.000408163,0.00122449,0,0.000612245,0.00122449,0.000204082,0.001020408,0.00122449,0.000408163,0.000816327,0.001632653,0.001836735,0.00122449,0.000612245,0.000816327,0.001428571,0.000204082,0.000612245,0.001020408,0.00122449,0.001428571,0.002244898,0.001632653,0.000408163,0.001428571,0.001428571,0.001020408,0.00122449,0.000612245,0.000816327,0.00122449,0.001632653 25 | 24,0.001428571,0.001020408,0.000816327,0.001020408,0.000816327,0.001428571,0.000816327,0.000408163,0.000408163,0.001428571,0.000612245,0.001428571,0.001020408,0.000816327,0.000612245,0.001428571,0.001428571,0.002040816,0.000816327,0.000408163,0.001020408,0.001020408,0.000408163,0.00122449,0.001632653,0.001020408,0.000408163,0.00122449,0.000204082,0.000816327,0.000816327,0.000612245 26 | 25,0.000816327,0.000204082,0.000816327,0.00122449,0.001428571,0.001632653,0.000816327,0.000612245,0.000816327,0.001428571,0.001428571,0.001632653,0.00122449,0.000612245,0.000816327,0.000816327,0.001428571,0.001020408,0.001428571,0.00122449,0.001020408,0.001020408,0.001428571,0.001632653,0.00122449,0.001632653,0.000612245,0.000816327,0.000816327,0.000816327,0.000612245,0.000816327 27 | 26,0.001428571,0.000816327,0.001020408,0.000204082,0.000816327,0.001428571,0.000612245,0.000816327,0.001632653,0.001428571,0.000816327,0.001020408,0.00122449,0.000816327,0.001020408,0.001632653,0.000408163,0.000612245,0.000408163,0.00122449,0.001428571,0.001020408,0.001428571,0.001020408,0.001632653,0.000816327,0.001836735,0.000204082,0.000204082,0.001428571,0.001428571,0.001428571 28 | 27,0.001836735,0.000612245,0.001020408,0.001020408,0.000816327,0.000816327,0.000816327,0.00122449,0.000816327,0.000408163,0.00122449,0.00122449,0.000612245,0.001020408,0.000816327,0.000612245,0.000408163,0.000408163,0.000612245,0.000204082,0.00122449,0.001428571,0.001020408,0.000408163,0.000612245,0.001836735,0.000816327,0.000612245,0.00122449,0.001020408,0.001428571,0.00122449 29 | 28,0.002040816,0.000612245,0.000816327,0.000612245,0.000204082,0.001632653,0.001020408,0.001632653,0.00122449,0.00122449,0.001836735,0.002040816,0.00122449,0.000408163,0.000816327,0.000204082,0.000816327,0.000612245,0.00122449,0.000816327,0.001020408,0.001836735,0.00122449,0.00122449,0.000816327,0.000204082,0.000612245,0.000816327,0.000408163,0.001020408,0.001020408,0.001428571 30 | 29,0.001428571,0.000408163,0,0.000612245,0.000612245,0.001428571,0.000408163,0.000816327,0.000612245,0.000816327,0.00122449,0.001632653,0.001020408,0.001020408,0.001020408,0.001020408,0.001428571,0.000408163,0.00122449,0.000408163,0.000612245,0.001020408,0.000612245,0.000204082,0.000816327,0.000204082,0.00122449,0.000408163,0.000816327,0.000612245,0.001428571,0.000408163 31 | 30,0.000816327,0.00122449,0.000816327,0.001020408,0.001020408,0.000816327,0.000816327,0.000816327,0.000816327,0.000408163,0.001428571,0.001020408,0.000408163,0.000612245,0.00122449,0.000816327,0.001020408,0.000408163,0.000816327,0.000612245,0.001020408,0.000612245,0.000816327,0.000816327,0.000816327,0.001428571,0.001020408,0.001020408,0.000612245,0.001632653,0.00122449,0.000204082 32 | 31,0.00122449,0.00122449,0.001020408,0.000408163,0.000612245,0.000408163,0.001020408,0.000204082,0.000816327,0.000612245,0.000816327,0.001020408,0.001020408,0.00122449,0.000408163,0.000408163,0.000408163,0.000408163,0.00122449,0.00122449,0.00122449,0.001020408,0.00122449,0.000816327,0.000612245,0.001428571,0.001428571,0.001020408,0.001428571,0.00122449,0.00122449,0.001632653 33 | 32,0.00122449,0.001836735,0.000612245,0.001020408,0.001020408,0.001020408,0.00122449,0.000408163,0.001632653,0.000612245,0.00122449,0.000612245,0.000612245,0.001632653,0.000408163,0.000816327,0.001020408,0.001020408,0.001020408,0.000612245,0.001020408,0.002244898,0.001632653,0.000612245,0.000816327,0.001428571,0.00122449,0.001428571,0.000408163,0.000204082,0.001632653,0.000408163 34 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/noise135.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32 2 | 1,0.000832986,0.00062474,0.001457726,0.001041233,0.000832986,0.000832986,0.000832986,0.001041233,0.001457726,0.001041233,0.003540192,0.001874219,0.001457726,0.001041233,0.001457726,0.000208247,0.001041233,0.001457726,0.001457726,0.001457726,0.001457726,0.001041233,0.001249479,0.001665973,0.001665973,0.001874219,0.001249479,0.001249479,0.001665973,0.001041233,0.001457726,0.00062474 3 | 2,0.00062474,0,0.00062474,0.000832986,0.000416493,0.000832986,0.000832986,0.001249479,0.000832986,0,0.000208247,0.001041233,0.000208247,0.000416493,0.000832986,0.001665973,0.001665973,0.000832986,0.001041233,0.001457726,0.000832986,0.001665973,0.001041233,0,0.001457726,0.002498959,0.000416493,0.001249479,0.00062474,0.001249479,0.000832986,0.000208247 4 | 3,0.001457726,0.00062474,0.000416493,0.001249479,0.001041233,0.001457726,0.000416493,0.001249479,0.001457726,0.000416493,0.002082466,0.00062474,0.000832986,0.000832986,0.001665973,0.000832986,0.001249479,0.00062474,0.000416493,0.001041233,0.000208247,0.001041233,0.000832986,0,0.001457726,0.00062474,0.000416493,0.00062474,0.001665973,0.00062474,0.001041233,0.000832986 5 | 4,0.001041233,0.000832986,0.001249479,0.001665973,0.001665973,0.000208247,0.001041233,0.000416493,0.001874219,0.001041233,0.000416493,0.001249479,0.00062474,0.001457726,0.001249479,0.000416493,0.001041233,0.00062474,0.001665973,0.001041233,0.00062474,0.001457726,0.00062474,0.001041233,0.00062474,0.001249479,0.001249479,0.001249479,0.000832986,0.001041233,0.00062474,0.00062474 6 | 5,0.000832986,0.000416493,0.001041233,0.001665973,0.000416493,0.00062474,0.000208247,0.000832986,0.000832986,0.000416493,0.001457726,0.001249479,0.001249479,0.001041233,0.001249479,0.00062474,0.001041233,0.000832986,0.000832986,0.001249479,0.00062474,0.001249479,0.001041233,0.000832986,0.001457726,0.000832986,0.000416493,0.000832986,0.00062474,0.00062474,0.00062474,0.000832986 7 | 6,0.000832986,0.000832986,0.001457726,0.000208247,0.00062474,0.000832986,0.001249479,0.000832986,0.002290712,0.000416493,0.001457726,0.000832986,0.001457726,0.000832986,0.000832986,0.001249479,0.00062474,0.001665973,0.000832986,0.000832986,0.001041233,0.002290712,0.000832986,0.00062474,0.00062474,0.000832986,0.00062474,0.000416493,0.000208247,0.000832986,0.001665973,0.001665973 8 | 7,0.000832986,0.000832986,0.000416493,0.001041233,0.000208247,0.001249479,0.000416493,0.000832986,0.000208247,0.00062474,0.001457726,0.000416493,0.001249479,0.001457726,0.001041233,0.001457726,0.000416493,0.001249479,0.00062474,0.000832986,0.001041233,0.001041233,0.001041233,0.001665973,0.001249479,0.001249479,0.001041233,0.001249479,0.000832986,0.001457726,0.001041233,0.000208247 9 | 8,0.001041233,0.001249479,0.001249479,0.000416493,0.000832986,0.000832986,0.000832986,0.001249479,0.001041233,0.000416493,0.001249479,0.001041233,0.00062474,0.000832986,0.00062474,0.001457726,0.000832986,0.000416493,0.001041233,0.001041233,0.001249479,0.001041233,0.000832986,0.001249479,0.000832986,0.001249479,0.000416493,0.001041233,0.00062474,0.000832986,0.001041233,0.001665973 10 | 9,0.001457726,0.000832986,0.001457726,0.001874219,0.000832986,0.002290712,0.000208247,0.001041233,0.001665973,0.00062474,0.001041233,0.001457726,0.000208247,0.000416493,0.001041233,0.001041233,0.000208247,0,0.00062474,0.000832986,0.000208247,0.000208247,0.001249479,0.000416493,0.000208247,0.001457726,0.000832986,0.000832986,0.001041233,0.000832986,0.000832986,0.00062474 11 | 10,0.001041233,0,0.000416493,0.001041233,0.000416493,0.000416493,0.00062474,0.000416493,0.00062474,0,0.000832986,0.001874219,0.00062474,0.001041233,0.000416493,0.001665973,0.001249479,0.000208247,0.000832986,0.000832986,0.001249479,0.002082466,0.000416493,0.001249479,0.002082466,0.000832986,0.001041233,0.001249479,0.001249479,0.000832986,0.001249479,0.001041233 12 | 11,0.003540192,0.000208247,0.002082466,0.000416493,0.001457726,0.001457726,0.001457726,0.001249479,0.001041233,0.000832986,0.001249479,0.002707205,0.001041233,0.001249479,0.001041233,0.001457726,0.00062474,0.001665973,0.001249479,0.002082466,0.00062474,0.001249479,0.000832986,0.002082466,0.001041233,0.001249479,0.001041233,0.001665973,0.001249479,0.000832986,0.002082466,0.000832986 13 | 12,0.001874219,0.001041233,0.00062474,0.001249479,0.001249479,0.000832986,0.000416493,0.001041233,0.001457726,0.001874219,0.002707205,0.002082466,0.000832986,0.00062474,0.001249479,0.001041233,0.00062474,0.00062474,0.000832986,0.000832986,0.001041233,0.001249479,0.001665973,0.000832986,0.000416493,0.000416493,0.000416493,0.001249479,0.000832986,0.000416493,0.000416493,0.002082466 14 | 13,0.001457726,0.000208247,0.000832986,0.00062474,0.001249479,0.001457726,0.001249479,0.00062474,0.000208247,0.00062474,0.001041233,0.000832986,0.001665973,0.000416493,0.00062474,0.000832986,0.001041233,0.001041233,0.000416493,0.000416493,0.001041233,0.000832986,0.00062474,0.001457726,0.001874219,0.001665973,0.001041233,0.001041233,0.000208247,0.000416493,0.001249479,0.001041233 15 | 14,0.001041233,0.000416493,0.000832986,0.001457726,0.001041233,0.000832986,0.001457726,0.000832986,0.000416493,0.001041233,0.001249479,0.00062474,0.000416493,0.000416493,0.001665973,0.001665973,0.00062474,0.000832986,0.001457726,0.000416493,0.001041233,0.00062474,0.001665973,0.001665973,0.000416493,0.001041233,0.000416493,0.001457726,0.001457726,0.001041233,0.000416493,0.001457726 16 | 15,0.001457726,0.000832986,0.001665973,0.001249479,0.001249479,0.000832986,0.001041233,0.00062474,0.001041233,0.000416493,0.001041233,0.001249479,0.00062474,0.001665973,0.000832986,0.000416493,0.001249479,0.00062474,0.00062474,0.000832986,0.001249479,0.001249479,0.000416493,0.000416493,0.001457726,0.001665973,0.001041233,0.001041233,0.000832986,0.001457726,0.001041233,0.001249479 17 | 16,0.000208247,0.001665973,0.000832986,0.000416493,0.00062474,0.001249479,0.001457726,0.001457726,0.001041233,0.001665973,0.001457726,0.001041233,0.000832986,0.001665973,0.000416493,0.000832986,0.001457726,0.001041233,0.001249479,0.000208247,0.000832986,0.001249479,0.001457726,0.000832986,0.001249479,0.00062474,0.000416493,0.001457726,0.001457726,0.000832986,0.001041233,0.001874219 18 | 17,0.001041233,0.001665973,0.001249479,0.001041233,0.001041233,0.00062474,0.000416493,0.000832986,0.000208247,0.001249479,0.00062474,0.00062474,0.001041233,0.00062474,0.001249479,0.001457726,0.001665973,0.000208247,0.00062474,0,0.000832986,0.000832986,0.001249479,0.001041233,0.001457726,0.00062474,0.001457726,0.001041233,0.00062474,0.00062474,0.001249479,0.001665973 19 | 18,0.001457726,0.000832986,0.00062474,0.00062474,0.000832986,0.001665973,0.001249479,0.000416493,0,0.000208247,0.001665973,0.00062474,0.001041233,0.000832986,0.00062474,0.001041233,0.000208247,0,0.000208247,0.00062474,0.000832986,0.001041233,0.001041233,0.00062474,0.001249479,0.000208247,0.001041233,0.00062474,0.00062474,0.000832986,0.000208247,0.000416493 20 | 19,0.001457726,0.001041233,0.000416493,0.001665973,0.000832986,0.000832986,0.00062474,0.001041233,0.00062474,0.000832986,0.001249479,0.000832986,0.000416493,0.001457726,0.00062474,0.001249479,0.00062474,0.000208247,0.002082466,0.000416493,0.001665973,0.001041233,0.00062474,0.001665973,0.000416493,0.000416493,0.001665973,0.00062474,0.000208247,0.001041233,0.000416493,0.001041233 21 | 20,0.001457726,0.001457726,0.001041233,0.001041233,0.001249479,0.000832986,0.000832986,0.001041233,0.000832986,0.000832986,0.002082466,0.000832986,0.000416493,0.000416493,0.000832986,0.000208247,0,0.00062474,0.000416493,0.000832986,0.001249479,0.001457726,0.000416493,0.000416493,0.000208247,0.001249479,0.001041233,0.000832986,0.000416493,0,0.001041233,0.00062474 22 | 21,0.001457726,0.000832986,0.000208247,0.00062474,0.00062474,0.001041233,0.001041233,0.001249479,0.000208247,0.001249479,0.00062474,0.001041233,0.001041233,0.001041233,0.001249479,0.000832986,0.000832986,0.000832986,0.001665973,0.001249479,0.000832986,0.001249479,0.000416493,0.000416493,0.001041233,0.001874219,0.00062474,0.001249479,0.001249479,0.000416493,0.001249479,0.001249479 23 | 22,0.001041233,0.001665973,0.001041233,0.001457726,0.001249479,0.002290712,0.001041233,0.001041233,0.000208247,0.002082466,0.001249479,0.001249479,0.000832986,0.00062474,0.001249479,0.001249479,0.000832986,0.001041233,0.001041233,0.001457726,0.001249479,0.002082466,0.001041233,0.001249479,0.001457726,0.001457726,0.000832986,0.001665973,0.000832986,0.000832986,0.001874219,0.001041233 24 | 23,0.001249479,0.001041233,0.000832986,0.00062474,0.001041233,0.000832986,0.001041233,0.000832986,0.001249479,0.000416493,0.000832986,0.001665973,0.00062474,0.001665973,0.000416493,0.001457726,0.001249479,0.001041233,0.00062474,0.000416493,0.000416493,0.001041233,0.000832986,0.001457726,0.001665973,0.001041233,0.002082466,0.001249479,0.001041233,0.001041233,0.000832986,0.001457726 25 | 24,0.001665973,0,0,0.001041233,0.000832986,0.00062474,0.001665973,0.001249479,0.000416493,0.001249479,0.002082466,0.000832986,0.001457726,0.001665973,0.000416493,0.000832986,0.001041233,0.00062474,0.001665973,0.000416493,0.000416493,0.001249479,0.001457726,0.000832986,0.001249479,0.001041233,0.000416493,0.001041233,0.00062474,0.001041233,0.000416493,0.001041233 26 | 25,0.001665973,0.001457726,0.001457726,0.00062474,0.001457726,0.00062474,0.001249479,0.000832986,0.000208247,0.002082466,0.001041233,0.000416493,0.001874219,0.000416493,0.001457726,0.001249479,0.001457726,0.001249479,0.000416493,0.000208247,0.001041233,0.001457726,0.001665973,0.001249479,0.001249479,0.000832986,0.00062474,0.001041233,0.000832986,0.000416493,0.001041233,0.00062474 27 | 26,0.001874219,0.002498959,0.00062474,0.001249479,0.000832986,0.000832986,0.001249479,0.001249479,0.001457726,0.000832986,0.001249479,0.000416493,0.001665973,0.001041233,0.001665973,0.00062474,0.00062474,0.000208247,0.000416493,0.001249479,0.001874219,0.001457726,0.001041233,0.001041233,0.000832986,0.000832986,0.00062474,0.000416493,0.000208247,0.00062474,0.001249479,0.001041233 28 | 27,0.001249479,0.000416493,0.000416493,0.001249479,0.000416493,0.00062474,0.001041233,0.000416493,0.000832986,0.001041233,0.001041233,0.000416493,0.001041233,0.000416493,0.001041233,0.000416493,0.001457726,0.001041233,0.001665973,0.001041233,0.00062474,0.000832986,0.002082466,0.000416493,0.00062474,0.00062474,0.001665973,0.001457726,0.00062474,0.001041233,0.001041233,0.000416493 29 | 28,0.001249479,0.001249479,0.00062474,0.001249479,0.000832986,0.000416493,0.001249479,0.001041233,0.000832986,0.001249479,0.001665973,0.001249479,0.001041233,0.001457726,0.001041233,0.001457726,0.001041233,0.00062474,0.00062474,0.000832986,0.001249479,0.001665973,0.001249479,0.001041233,0.001041233,0.000416493,0.001457726,0.000832986,0,0.001041233,0.000832986,0.000832986 30 | 29,0.001665973,0.00062474,0.001665973,0.000832986,0.00062474,0.000208247,0.000832986,0.00062474,0.001041233,0.001249479,0.001249479,0.000832986,0.000208247,0.001457726,0.000832986,0.001457726,0.00062474,0.00062474,0.000208247,0.000416493,0.001249479,0.000832986,0.001041233,0.00062474,0.000832986,0.000208247,0.00062474,0,0.001249479,0.000416493,0.00062474,0.000832986 31 | 30,0.001041233,0.001249479,0.00062474,0.001041233,0.00062474,0.000832986,0.001457726,0.000832986,0.000832986,0.000832986,0.000832986,0.000416493,0.000416493,0.001041233,0.001457726,0.000832986,0.00062474,0.000832986,0.001041233,0,0.000416493,0.000832986,0.001041233,0.001041233,0.000416493,0.00062474,0.001041233,0.001041233,0.000416493,0.002082466,0.000832986,0.001457726 32 | 31,0.001457726,0.000832986,0.001041233,0.00062474,0.00062474,0.001665973,0.001041233,0.001041233,0.000832986,0.001249479,0.002082466,0.000416493,0.001249479,0.000416493,0.001041233,0.001041233,0.001249479,0.000208247,0.000416493,0.001041233,0.001249479,0.001874219,0.000832986,0.000416493,0.001041233,0.001249479,0.001041233,0.000832986,0.00062474,0.000832986,0,0.000416493 33 | 32,0.00062474,0.000208247,0.000832986,0.00062474,0.000832986,0.001665973,0.000208247,0.001665973,0.00062474,0.001041233,0.000832986,0.002082466,0.001041233,0.001457726,0.001249479,0.001874219,0.001665973,0.000416493,0.001041233,0.00062474,0.001249479,0.001041233,0.001457726,0.001041233,0.00062474,0.001041233,0.000416493,0.000832986,0.000832986,0.001457726,0.000416493,0.000832986 34 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/noise45.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32 2 | 1,0.001249479,0.001249479,0.000416493,0.001665973,0.001665973,0.00062474,0.00062474,0.00062474,0.000416493,0.002082466,0.003123698,0.001457726,0.00062474,0.002082466,0.001874219,0.000832986,0.001249479,0.00062474,0.001665973,0.00062474,0.001457726,0.001874219,0.002082466,0.001665973,0.000208247,0.002498959,0.000832986,0.001041233,0.001665973,0.001457726,0.001041233,0.00062474 3 | 2,0.001249479,0.000416493,0.001041233,0.000832986,0.000832986,0.001041233,0.00062474,0.001041233,0.000832986,0.000208247,0.001665973,0.00062474,0.001041233,0.001249479,0.000832986,0.00062474,0.001041233,0.00062474,0.001249479,0.001665973,0.001665973,0.00062474,0.001041233,0.00062474,0.000832986,0.000208247,0.001249479,0.000208247,0.000832986,0.00062474,0.000832986,0.000208247 4 | 3,0.000416493,0.001041233,0.001249479,0.001665973,0.000416493,0.000416493,0.001874219,0.001249479,0.000832986,0.00062474,0.000832986,0.000832986,0.001457726,0.000832986,0.000416493,0.000832986,0.001457726,0.000832986,0.000832986,0.00062474,0.00062474,0.001041233,0.00062474,0.001041233,0.000416493,0.00062474,0.001041233,0.000832986,0.000832986,0.000416493,0.001041233,0.002082466 5 | 4,0.001665973,0.000832986,0.001665973,0.000832986,0.000208247,0.000416493,0.001041233,0.000416493,0.000416493,0.001249479,0.001249479,0.001665973,0.001665973,0.000832986,0.001665973,0.001874219,0.00062474,0.000208247,0.001665973,0.000416493,0.001249479,0.001874219,0.001041233,0.00062474,0.001041233,0.000416493,0.00062474,0.000832986,0.001457726,0.001249479,0.000832986,0.000208247 6 | 5,0.001665973,0.000832986,0.000416493,0.000208247,0.000416493,0.002082466,0.000832986,0.001874219,0.001041233,0.00062474,0.001041233,0.000208247,0.00062474,0.000832986,0.000832986,0.00062474,0.00062474,0.001041233,0.000416493,0.000416493,0.001249479,0.001665973,0.001249479,0.000832986,0.000832986,0.00062474,0.001249479,0.000416493,0.00062474,0.001665973,0.000832986,0.000208247 7 | 6,0.00062474,0.001041233,0.000416493,0.000416493,0.002082466,0.000832986,0.000416493,0,0.001041233,0.001041233,0.001874219,0.001457726,0.000208247,0.001041233,0.000832986,0.000832986,0.001457726,0.00062474,0.000832986,0.00062474,0.001874219,0.001249479,0.00062474,0.001041233,0.001665973,0.001249479,0.000832986,0.000832986,0.001041233,0.001249479,0.001665973,0.000832986 8 | 7,0.00062474,0.00062474,0.001874219,0.001041233,0.000832986,0.000416493,0.000832986,0.00062474,0.00062474,0.00062474,0.00062474,0.00062474,0.000832986,0.00062474,0.001457726,0.001041233,0.00062474,0.001249479,0.001249479,0.000832986,0.000832986,0.002082466,0.001665973,0.000832986,0.001041233,0.000832986,0.001041233,0.001249479,0.00062474,0.001041233,0.000832986,0.00062474 9 | 8,0.00062474,0.001041233,0.001249479,0.000416493,0.001874219,0,0.00062474,0.000832986,0.000832986,0.000832986,0.00062474,0.001457726,0.001041233,0.001665973,0.001457726,0.001041233,0.001249479,0.000832986,0.001041233,0.000832986,0.000832986,0.001041233,0.000416493,0.000416493,0.001249479,0.00062474,0.001249479,0.001041233,0.00062474,0.00062474,0.001457726,0.001249479 10 | 9,0.000416493,0.000832986,0.000832986,0.000416493,0.001041233,0.001041233,0.00062474,0.000832986,0,0.000416493,0.001457726,0.001249479,0.001041233,0.001041233,0.000832986,0.001665973,0.001041233,0.000832986,0.001249479,0.001457726,0.001041233,0.00062474,0.000832986,0.000416493,0.000416493,0.001041233,0.00062474,0.001665973,0.000416493,0.000832986,0.001041233,0.00062474 11 | 10,0.002082466,0.000208247,0.00062474,0.001249479,0.00062474,0.001041233,0.00062474,0.000832986,0.000416493,0.001249479,0.001665973,0.001249479,0.00062474,0.000832986,0.000832986,0.000832986,0.002082466,0.00062474,0.000416493,0.00062474,0.001041233,0.000416493,0.000208247,0.001457726,0.001249479,0.000832986,0.001041233,0.001457726,0.000208247,0.000832986,0.001041233,0.00062474 12 | 11,0.003123698,0.001665973,0.000832986,0.001249479,0.001041233,0.001874219,0.00062474,0.00062474,0.001457726,0.001665973,0.002082466,0.001457726,0.000832986,0.001874219,0.002915452,0.001457726,0.000832986,0.00062474,0.000832986,0.000832986,0.001249479,0.002082466,0.001249479,0.000416493,0.000832986,0.001041233,0.001041233,0.001457726,0.001457726,0.001249479,0.001457726,0.001457726 13 | 12,0.001457726,0.00062474,0.000832986,0.001665973,0.000208247,0.001457726,0.00062474,0.001457726,0.001249479,0.001249479,0.001457726,0.000832986,0.00062474,0.001041233,0.000416493,0.001249479,0.000832986,0.001249479,0.000416493,0.001249479,0.00062474,0.001249479,0.001665973,0.001249479,0.001249479,0.00062474,0.001457726,0.000832986,0.001041233,0.000832986,0.001457726,0.001665973 14 | 13,0.00062474,0.001041233,0.001457726,0.001665973,0.00062474,0.000208247,0.000832986,0.001041233,0.001041233,0.00062474,0.000832986,0.00062474,0,0.000832986,0.000832986,0.001665973,0,0.00062474,0.000208247,0.000832986,0.000416493,0.001457726,0.000832986,0.002082466,0.001665973,0.001457726,0.00062474,0.001041233,0.001665973,0.00062474,0.000416493,0.001457726 15 | 14,0.002082466,0.001249479,0.000832986,0.000832986,0.000832986,0.001041233,0.00062474,0.001665973,0.001041233,0.000832986,0.001874219,0.001041233,0.000832986,0.000832986,0.001041233,0.001249479,0.000832986,0.000416493,0.000832986,0.001665973,0.00062474,0.00062474,0.00062474,0.00062474,0.000832986,0.001041233,0.00062474,0.001457726,0.000416493,0.001665973,0.000416493,0.000832986 16 | 15,0.001874219,0.000832986,0.000416493,0.001665973,0.000832986,0.000832986,0.001457726,0.001457726,0.000832986,0.000832986,0.002915452,0.000416493,0.000832986,0.001041233,0.000416493,0.001249479,0.000416493,0.001249479,0.00062474,0,0.001249479,0.001249479,0.001457726,0.001041233,0.000416493,0.001665973,0.001249479,0.000832986,0.001249479,0,0.001041233,0.001041233 17 | 16,0.000832986,0.00062474,0.000832986,0.001874219,0.00062474,0.000832986,0.001041233,0.001041233,0.001665973,0.000832986,0.001457726,0.001249479,0.001665973,0.001249479,0.001249479,0.001249479,0.000832986,0.000416493,0.001041233,0.000416493,0.000832986,0.002082466,0.001457726,0.000832986,0.001249479,0.001249479,0.000416493,0.001874219,0.000832986,0.001041233,0.00062474,0.00062474 18 | 17,0.001249479,0.001041233,0.001457726,0.00062474,0.00062474,0.001457726,0.00062474,0.001249479,0.001041233,0.002082466,0.000832986,0.000832986,0,0.000832986,0.000416493,0.000832986,0,0.000416493,0.000832986,0.001041233,0.000832986,0.001665973,0.001457726,0.001665973,0.001041233,0.001249479,0,0.000832986,0.000832986,0.000832986,0.001041233,0.001249479 19 | 18,0.00062474,0.00062474,0.000832986,0.000208247,0.001041233,0.00062474,0.001249479,0.000832986,0.000832986,0.00062474,0.00062474,0.001249479,0.00062474,0.000416493,0.001249479,0.000416493,0.000416493,0.000416493,0.000832986,0.000416493,0.000832986,0.001041233,0.001041233,0.000416493,0.001665973,0.001041233,0.00062474,0.000832986,0.000416493,0.000208247,0.000416493,0.000832986 20 | 19,0.001665973,0.001249479,0.000832986,0.001665973,0.000416493,0.000832986,0.001249479,0.001041233,0.001249479,0.000416493,0.000832986,0.000416493,0.000208247,0.000832986,0.00062474,0.001041233,0.000832986,0.000832986,0.001249479,0.000416493,0.001041233,0.001457726,0.000832986,0.001249479,0.001249479,0.001249479,0.000832986,0.000832986,0,0.001041233,0.00062474,0.001041233 21 | 20,0.00062474,0.001665973,0.00062474,0.000416493,0.000416493,0.00062474,0.000832986,0.000832986,0.001457726,0.00062474,0.000832986,0.001249479,0.000832986,0.001665973,0,0.000416493,0.001041233,0.000416493,0.000416493,0.000416493,0.00062474,0.001665973,0.001041233,0.00062474,0.001041233,0.000832986,0.001041233,0.001041233,0.000416493,0.001041233,0.000832986,0.00062474 22 | 21,0.001457726,0.001665973,0.00062474,0.001249479,0.001249479,0.001874219,0.000832986,0.000832986,0.001041233,0.001041233,0.001249479,0.00062474,0.000416493,0.00062474,0.001249479,0.000832986,0.000832986,0.000832986,0.001041233,0.00062474,0.001249479,0.00062474,0.000416493,0.001249479,0.001457726,0.00062474,0.000832986,0.000416493,0.00062474,0.001249479,0.00062474,0.001457726 23 | 22,0.001874219,0.00062474,0.001041233,0.001874219,0.001665973,0.001249479,0.002082466,0.001041233,0.00062474,0.000416493,0.002082466,0.001249479,0.001457726,0.00062474,0.001249479,0.002082466,0.001665973,0.001041233,0.001457726,0.001665973,0.00062474,0.000416493,0.001665973,0.00062474,0.000832986,0.001041233,0.001249479,0.002082466,0.001041233,0.001041233,0.00062474,0.001041233 24 | 23,0.002082466,0.001041233,0.00062474,0.001041233,0.001249479,0.00062474,0.001665973,0.000416493,0.000832986,0.000208247,0.001249479,0.001665973,0.000832986,0.00062474,0.001457726,0.001457726,0.001457726,0.001041233,0.000832986,0.001041233,0.000416493,0.001665973,0.001665973,0.00062474,0.001041233,0.001457726,0.000208247,0.001249479,0.000208247,0.001041233,0.000832986,0.001457726 25 | 24,0.001665973,0.00062474,0.001041233,0.00062474,0.000832986,0.001041233,0.000832986,0.000416493,0.000416493,0.001457726,0.000416493,0.001249479,0.002082466,0.00062474,0.001041233,0.000832986,0.001665973,0.000416493,0.001249479,0.00062474,0.001249479,0.00062474,0.00062474,0.000832986,0.000832986,0.001457726,0.00062474,0.001457726,0.001665973,0.000416493,0.00062474,0.001041233 26 | 25,0.000208247,0.000832986,0.000416493,0.001041233,0.000832986,0.001665973,0.001041233,0.001249479,0.000416493,0.001249479,0.000832986,0.001249479,0.001665973,0.000832986,0.000416493,0.001249479,0.001041233,0.001665973,0.001249479,0.001041233,0.001457726,0.000832986,0.001041233,0.000832986,0.000416493,0.001249479,0.001249479,0.001041233,0.00062474,0.001665973,0.001249479,0.001874219 27 | 26,0.002498959,0.000208247,0.00062474,0.000416493,0.00062474,0.001249479,0.000832986,0.00062474,0.001041233,0.000832986,0.001041233,0.00062474,0.001457726,0.001041233,0.001665973,0.001249479,0.001249479,0.001041233,0.001249479,0.000832986,0.00062474,0.001041233,0.001457726,0.001457726,0.001249479,0.001665973,0.002082466,0.000416493,0.000416493,0.000832986,0.000832986,0.00062474 28 | 27,0.000832986,0.001249479,0.001041233,0.00062474,0.001249479,0.000832986,0.001041233,0.001249479,0.00062474,0.001041233,0.001041233,0.001457726,0.00062474,0.00062474,0.001249479,0.000416493,0,0.00062474,0.000832986,0.001041233,0.000832986,0.001249479,0.000208247,0.00062474,0.001249479,0.002082466,0.001249479,0.000832986,0.001041233,0,0.000416493,0.001249479 29 | 28,0.001041233,0.000208247,0.000832986,0.000832986,0.000416493,0.000832986,0.001249479,0.001041233,0.001665973,0.001457726,0.001457726,0.000832986,0.001041233,0.001457726,0.000832986,0.001874219,0.000832986,0.000832986,0.000832986,0.001041233,0.000416493,0.002082466,0.001249479,0.001457726,0.001041233,0.000416493,0.000832986,0.000832986,0.00062474,0.000832986,0.000832986,0.001457726 30 | 29,0.001665973,0.000832986,0.000832986,0.001457726,0.00062474,0.001041233,0.00062474,0.00062474,0.000416493,0.000208247,0.001457726,0.001041233,0.001665973,0.000416493,0.001249479,0.000832986,0.000832986,0.000416493,0,0.000416493,0.00062474,0.001041233,0.000208247,0.001665973,0.00062474,0.000416493,0.001041233,0.00062474,0.000832986,0.00062474,0.001041233,0.000416493 31 | 30,0.001457726,0.00062474,0.000416493,0.001249479,0.001665973,0.001249479,0.001041233,0.00062474,0.000832986,0.000832986,0.001249479,0.000832986,0.00062474,0.001665973,0,0.001041233,0.000832986,0.000208247,0.001041233,0.001041233,0.001249479,0.001041233,0.001041233,0.000416493,0.001665973,0.000832986,0,0.000832986,0.00062474,0.000416493,0.001249479,0.000208247 32 | 31,0.001041233,0.000832986,0.001041233,0.000832986,0.000832986,0.001665973,0.000832986,0.001457726,0.001041233,0.001041233,0.001457726,0.001457726,0.000416493,0.000416493,0.001041233,0.00062474,0.001041233,0.000416493,0.00062474,0.000832986,0.00062474,0.00062474,0.000832986,0.00062474,0.001249479,0.000832986,0.000416493,0.000832986,0.001041233,0.001249479,0.001665973,0.001041233 33 | 32,0.00062474,0.000208247,0.002082466,0.000208247,0.000208247,0.000832986,0.00062474,0.001249479,0.00062474,0.00062474,0.001457726,0.001665973,0.001457726,0.000832986,0.001041233,0.00062474,0.001249479,0.000832986,0.001041233,0.00062474,0.001457726,0.001041233,0.001457726,0.001041233,0.001874219,0.00062474,0.001249479,0.001457726,0.000416493,0.000208247,0.001041233,0.001665973 34 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/noise90.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32 2 | 1,0.001632653,0.001428571,0.001020408,0.001836735,0.001836735,0.000816327,0.00244898,0.000612245,0.001428571,0.001428571,0.002040816,0.001020408,0.001020408,0.00122449,0.000408163,0.000612245,0.001020408,0.000816327,0.00122449,0.000408163,0.001020408,0.00122449,0.001428571,0.002040816,0.001836735,0.00122449,0.00244898,0.001020408,0.00122449,0.001836735,0.000816327,0.001020408 3 | 2,0.001428571,0.002040816,0.000816327,0.000816327,0.001020408,0.000204082,0.001020408,0.000612245,0.000816327,0.001020408,0.00122449,0.000816327,0.00122449,0.000816327,0.001428571,0.000816327,0.000408163,0.000408163,0.001632653,0.000408163,0.000816327,0.000612245,0.000612245,0.000612245,0.000408163,0.000612245,0.000408163,0.000612245,0.002040816,0.000204082,0.000816327,0.00122449 4 | 3,0.001020408,0.000816327,0.000816327,0.000816327,0.001632653,0.001020408,0.001020408,0.001020408,0.000204082,0.001020408,0.001020408,0.000612245,0.002040816,0.001020408,0.000816327,0.001020408,0.001428571,0.000408163,0.000612245,0.00122449,0.00122449,0.000204082,0.001428571,0.000204082,0.000408163,0.00122449,0.001020408,0.001020408,0.000612245,0.000612245,0.000816327,0.000816327 5 | 4,0.001836735,0.000816327,0.000816327,0.00244898,0.001020408,0.000612245,0.000816327,0.000408163,0.000816327,0.00122449,0.00122449,0.002040816,0.000612245,0.001020408,0.00122449,0.001020408,0.00122449,0.000816327,0.001428571,0.000408163,0.001020408,0.000612245,0.000816327,0.000408163,0.00122449,0.001020408,0.000612245,0.001428571,0.000204082,0.000816327,0.001428571,0.001020408 6 | 5,0.001836735,0.001020408,0.001632653,0.001020408,0,0.00122449,0.000816327,0.000612245,0.000612245,0.001020408,0.000204082,0.001428571,0.000816327,0.001428571,0.000408163,0.001020408,0.000612245,0.000204082,0.000612245,0.000816327,0.000816327,0.001632653,0.001020408,0.000816327,0.00122449,0.000816327,0.000612245,0.00122449,0.000612245,0.000204082,0.000408163,0.001020408 7 | 6,0.000816327,0.000204082,0.001020408,0.000612245,0.00122449,0.000408163,0.000204082,0.001020408,0.000816327,0.002857143,0.00244898,0.00122449,0.001428571,0.000408163,0.000612245,0.001020408,0.001428571,0.000816327,0.000408163,0.000204082,0.000408163,0.002040816,0.001428571,0.000816327,0.001428571,0.001428571,0.001020408,0.001020408,0.00122449,0.000612245,0.000816327,0.001020408 8 | 7,0.00244898,0.001020408,0.001020408,0.000816327,0.000816327,0.000204082,0.00122449,0.001428571,0.000612245,0.000816327,0.001428571,0.00122449,0.00122449,0.000612245,0.000816327,0.00122449,0.000612245,0,0.000816327,0.00122449,0.000612245,0.000816327,0.001020408,0.001020408,0.000612245,0.000408163,0.000408163,0.000816327,0.00122449,0.001020408,0.00122449,0.00122449 9 | 8,0.000612245,0.000612245,0.001020408,0.000408163,0.000612245,0.001020408,0.001428571,0,0.00122449,0.000612245,0.002244898,0.000816327,0.000612245,0.001020408,0.001020408,0.001428571,0.001836735,0.00122449,0.000612245,0.000816327,0.000816327,0.001836735,0.001020408,0.000816327,0.000816327,0.000816327,0.000816327,0.000612245,0.001632653,0.000204082,0.000408163,0.001632653 10 | 9,0.001428571,0.000816327,0.000204082,0.000816327,0.000612245,0.000816327,0.000612245,0.00122449,0.000816327,0.000816327,0.001836735,0.001020408,0.000816327,0.000816327,0.000612245,0.00122449,0,0.001020408,0.00122449,0.000204082,0.000816327,0.00122449,0.000816327,0.00122449,0.000816327,0.000816327,0.001020408,0.001632653,0.000408163,0.000612245,0.00122449,0.000612245 11 | 10,0.001428571,0.001020408,0.001020408,0.00122449,0.001020408,0.002857143,0.000816327,0.000612245,0.000816327,0.00122449,0.001632653,0.000816327,0.000816327,0.000408163,0.000816327,0.000816327,0.001020408,0.000612245,0.000816327,0.000816327,0.000816327,0.000816327,0,0.00122449,0.000612245,0.000612245,0.000816327,0.000612245,0.000816327,0.00122449,0.001020408,0 12 | 11,0.002040816,0.00122449,0.001020408,0.00122449,0.000204082,0.00244898,0.001428571,0.002244898,0.001836735,0.001632653,0.00244898,0.000816327,0.00122449,0.000612245,0.001020408,0.001632653,0.00122449,0.000408163,0.000816327,0.001020408,0.000408163,0.001020408,0.00122449,0.001836735,0.00122449,0.00244898,0.000612245,0.002244898,0.001428571,0.00122449,0.000816327,0.001428571 13 | 12,0.001020408,0.000816327,0.000612245,0.002040816,0.001428571,0.00122449,0.00122449,0.000816327,0.001020408,0.000816327,0.000816327,0,0.000816327,0.001632653,0.00122449,0.000816327,0.001428571,0.000204082,0.001428571,0.000612245,0.001632653,0.00122449,0.000408163,0.001428571,0.001428571,0.001020408,0.000816327,0.000816327,0.001632653,0.00122449,0.001428571,0.00122449 14 | 13,0.001020408,0.00122449,0.002040816,0.000612245,0.000816327,0.001428571,0.00122449,0.000612245,0.000816327,0.000816327,0.00122449,0.000816327,0.000816327,0.000612245,0.001020408,0.001428571,0.000408163,0.000612245,0.001020408,0.00122449,0.001020408,0.001428571,0.001020408,0.000816327,0.001020408,0.000816327,0.000612245,0.000204082,0.000408163,0.000612245,0.000408163,0.00122449 15 | 14,0.00122449,0.000816327,0.001020408,0.001020408,0.001428571,0.000408163,0.000612245,0.001020408,0.000816327,0.000408163,0.000612245,0.001632653,0.000612245,0,0.001428571,0.002040816,0.001428571,0.001428571,0.000816327,0.000816327,0.000816327,0.001020408,0.000816327,0.00122449,0.001836735,0.001428571,0.000612245,0.00122449,0.000612245,0.000408163,0.000612245,0.001428571 16 | 15,0.000408163,0.001428571,0.000816327,0.00122449,0.000408163,0.000612245,0.000816327,0.001020408,0.000612245,0.000816327,0.001020408,0.00122449,0.001020408,0.001428571,0.000816327,0.000816327,0.001632653,0.001020408,0.000612245,0.001020408,0.001020408,0.001020408,0.001836735,0.000612245,0.001632653,0.001020408,0.001836735,0.001428571,0.000612245,0.000816327,0.00122449,0.000408163 17 | 16,0.000612245,0.000816327,0.001020408,0.001020408,0.001020408,0.001020408,0.00122449,0.001428571,0.00122449,0.000816327,0.001632653,0.000816327,0.001428571,0.002040816,0.000816327,0.00122449,0.000612245,0.001020408,0.00122449,0.001020408,0.001836735,0.00122449,0.002244898,0.000408163,0.000408163,0.000816327,0.001020408,0.000408163,0.001020408,0.001632653,0.000816327,0.000612245 18 | 17,0.001020408,0.000408163,0.001428571,0.00122449,0.000612245,0.001428571,0.000612245,0.001836735,0,0.001020408,0.00122449,0.001428571,0.000408163,0.001428571,0.001632653,0.000612245,0.00122449,0,0.000816327,0.000204082,0.000612245,0.001428571,0.000816327,0.001632653,0.001632653,0,0.00122449,0.001836735,0.000816327,0.000612245,0.000816327,0.000408163 19 | 18,0.000816327,0.000408163,0.000408163,0.000816327,0.000204082,0.000816327,0,0.00122449,0.001020408,0.000612245,0.000408163,0.000204082,0.000612245,0.001428571,0.001020408,0.001020408,0,0.000816327,0.00122449,0.000408163,0.000204082,0.001428571,0.00122449,0.001020408,0.001428571,0.00122449,0.000816327,0.000612245,0.000204082,0.000612245,0.000612245,0.000612245 20 | 19,0.00122449,0.001632653,0.000612245,0.001428571,0.000612245,0.000408163,0.000816327,0.000612245,0.00122449,0.000816327,0.000816327,0.001428571,0.001020408,0.000816327,0.000612245,0.00122449,0.000816327,0.00122449,0.000816327,0.000408163,0.000816327,0.00122449,0.000408163,0.001020408,0.000612245,0.000612245,0.001428571,0.001020408,0.000816327,0.000612245,0.000816327,0.001020408 21 | 20,0.000408163,0.000408163,0.00122449,0.000408163,0.000816327,0.000204082,0.00122449,0.000816327,0.000204082,0.000816327,0.001020408,0.000612245,0.00122449,0.000816327,0.001020408,0.001020408,0.000204082,0.000408163,0.000408163,0.00122449,0.001020408,0.001428571,0.00122449,0.000816327,0.000816327,0.000816327,0.000408163,0.001632653,0.000204082,0.000408163,0.00122449,0.001428571 22 | 21,0.001020408,0.000816327,0.00122449,0.001020408,0.000816327,0.000408163,0.000612245,0.000816327,0.000816327,0.000816327,0.000408163,0.001632653,0.001020408,0.000816327,0.001020408,0.001836735,0.000612245,0.000204082,0.000816327,0.001020408,0.000408163,0.001632653,0.000408163,0.000816327,0.000612245,0.002040816,0.001020408,0.00122449,0.000612245,0.001632653,0.001836735,0.000612245 23 | 22,0.00122449,0.000612245,0.000204082,0.000612245,0.001632653,0.002040816,0.000816327,0.001836735,0.00122449,0.000816327,0.001020408,0.00122449,0.001428571,0.001020408,0.001020408,0.00122449,0.001428571,0.001428571,0.00122449,0.001428571,0.001632653,0.00122449,0.00122449,0.000612245,0.001836735,0.000816327,0.001428571,0.002040816,0.00122449,0.002040816,0.00122449,0.001020408 24 | 23,0.001428571,0.000612245,0.001428571,0.000816327,0.001020408,0.001428571,0.001020408,0.001020408,0.000816327,0,0.00122449,0.000408163,0.001020408,0.000816327,0.001836735,0.002244898,0.000816327,0.00122449,0.000408163,0.00122449,0.000408163,0.00122449,0.00122449,0.001020408,0.000204082,0.001428571,0.001020408,0.001428571,0.000816327,0.001020408,0.001020408,0.00122449 25 | 24,0.002040816,0.000612245,0.000204082,0.000408163,0.000816327,0.000816327,0.001020408,0.000816327,0.00122449,0.00122449,0.001836735,0.001428571,0.000816327,0.00122449,0.000612245,0.000408163,0.001632653,0.001020408,0.001020408,0.000816327,0.000816327,0.000612245,0.001020408,0.002040816,0.001836735,0.001020408,0.000816327,0.000816327,0.000408163,0.000408163,0.000204082,0.000408163 26 | 25,0.001836735,0.000408163,0.000408163,0.00122449,0.00122449,0.001428571,0.000612245,0.000816327,0.000816327,0.000612245,0.00122449,0.001428571,0.001020408,0.001836735,0.001632653,0.000408163,0.001632653,0.001428571,0.000612245,0.000816327,0.000612245,0.001836735,0.000204082,0.001836735,0,0.001632653,0.001428571,0.000816327,0.000816327,0.000612245,0.001020408,0.001428571 27 | 26,0.00122449,0.000612245,0.00122449,0.001020408,0.000816327,0.001428571,0.000408163,0.000816327,0.000816327,0.000612245,0.00244898,0.001020408,0.000816327,0.001428571,0.001020408,0.000816327,0,0.00122449,0.000612245,0.000816327,0.002040816,0.000816327,0.001428571,0.001020408,0.001632653,0.001632653,0.000408163,0.000612245,0.000612245,0.000612245,0.00122449,0.001836735 28 | 27,0.00244898,0.000408163,0.001020408,0.000612245,0.000612245,0.001020408,0.000408163,0.000816327,0.001020408,0.000816327,0.000612245,0.000816327,0.000612245,0.000612245,0.001836735,0.001020408,0.00122449,0.000816327,0.001428571,0.000408163,0.001020408,0.001428571,0.001020408,0.000816327,0.001428571,0.000408163,0.00122449,0.000408163,0.000204082,0.001020408,0.000612245,0.000816327 29 | 28,0.001020408,0.000612245,0.001020408,0.001428571,0.00122449,0.001020408,0.000816327,0.000612245,0.001632653,0.000612245,0.002244898,0.000816327,0.000204082,0.00122449,0.001428571,0.000408163,0.001836735,0.000612245,0.001020408,0.001632653,0.00122449,0.002040816,0.001428571,0.000816327,0.000816327,0.000612245,0.000408163,0,0.000408163,0.000612245,0.001428571,0.00122449 30 | 29,0.00122449,0.002040816,0.000612245,0.000204082,0.000612245,0.00122449,0.00122449,0.001632653,0.000408163,0.000816327,0.001428571,0.001632653,0.000408163,0.000612245,0.000612245,0.001020408,0.000816327,0.000204082,0.000816327,0.000204082,0.000612245,0.00122449,0.000816327,0.000408163,0.000816327,0.000612245,0.000204082,0.000408163,0.000816327,0.000816327,0.000816327,0.000612245 31 | 30,0.001836735,0.000204082,0.000612245,0.000816327,0.000204082,0.000612245,0.001020408,0.000204082,0.000612245,0.00122449,0.00122449,0.00122449,0.000612245,0.000408163,0.000816327,0.001632653,0.000612245,0.000612245,0.000612245,0.000408163,0.001632653,0.002040816,0.001020408,0.000408163,0.000612245,0.000612245,0.001020408,0.000612245,0.000816327,0.001632653,0.000612245,0.001428571 32 | 31,0.000816327,0.000816327,0.000816327,0.001428571,0.000408163,0.000816327,0.00122449,0.000408163,0.00122449,0.001020408,0.000816327,0.001428571,0.000408163,0.000612245,0.00122449,0.000816327,0.000816327,0.000612245,0.000816327,0.00122449,0.001836735,0.00122449,0.001020408,0.000204082,0.001020408,0.00122449,0.000612245,0.001428571,0.000816327,0.000612245,0.000816327,0.001020408 33 | 32,0.001020408,0.00122449,0.000816327,0.001020408,0.001020408,0.001020408,0.00122449,0.001632653,0.000612245,0,0.001428571,0.00122449,0.00122449,0.001428571,0.000408163,0.000612245,0.000408163,0.000612245,0.001020408,0.001428571,0.000612245,0.001020408,0.00122449,0.000408163,0.001428571,0.001836735,0.000816327,0.00122449,0.000612245,0.001428571,0.001020408,0.00122449 34 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/tumor0.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32 2 | 1,0.000472813,0,0,0.000236407,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000236407,0,0,0,0,0,0,0,0,0 3 | 2,0,0.000472813,0.000236407,0.000236407,0.000472813,0,0,0,0.000236407,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000236407,0,0,0,0,0,0,0,0,0 4 | 3,0,0.000236407,0.001891253,0.001182033,0.001182033,0.000945626,0.000472813,0.00070922,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 4,0.000236407,0.000236407,0.001182033,0.002364066,0.001654846,0.00141844,0.000945626,0.000945626,0.000236407,0.00070922,0.000236407,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 5,0,0.000472813,0.001182033,0.001654846,0.011820331,0.006146572,0.001182033,0.001654846,0.001891253,0.000472813,0.000472813,0.000236407,0,0,0,0,0,0,0.000236407,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 6,0,0,0.000945626,0.00141844,0.006146572,0.022222222,0.010874704,0.004018913,0.001891253,0.000945626,0,0.000236407,0.000236407,0.000472813,0,0.000472813,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8 | 7,0,0,0.000472813,0.000945626,0.001182033,0.010874704,0.008510638,0.011111111,0.002836879,0.000472813,0.000472813,0.000236407,0.000236407,0,0.000236407,0.000236407,0,0,0,0,0,0,0,0,0,0,0,0,0.000236407,0,0,0 9 | 8,0,0,0.00070922,0.000945626,0.001654846,0.004018913,0.011111111,0.022695035,0.013711584,0.003546099,0.001182033,0.000945626,0.000236407,0.000236407,0,0.000236407,0.000236407,0,0,0,0,0,0.000472813,0.000472813,0.000236407,0,0,0,0,0,0,0 10 | 9,0,0.000236407,0,0.000236407,0.001891253,0.001891253,0.002836879,0.013711584,0.019385343,0.012293144,0.002364066,0.001182033,0.00070922,0.000945626,0,0.000236407,0.000236407,0,0,0,0.000236407,0,0,0,0,0,0,0.000236407,0,0,0,0 11 | 10,0,0,0,0.00070922,0.000472813,0.000945626,0.000472813,0.003546099,0.012293144,0.055319149,0.028841608,0.003073286,0.000472813,0.000472813,0,0.000236407,0,0,0,0,0,0.000236407,0.000472813,0.000472813,0,0,0,0,0,0,0,0 12 | 11,0,0,0,0.000236407,0.000472813,0,0.000472813,0.001182033,0.002364066,0.028841608,0.101182033,0.017730496,0.001654846,0.00070922,0,0.000472813,0,0.000472813,0,0,0.000472813,0.000472813,0.000236407,0.000236407,0,0,0,0,0,0,0,0 13 | 12,0,0,0,0,0.000236407,0.000236407,0.000236407,0.000945626,0.001182033,0.003073286,0.017730496,0.040189125,0.006146572,0.001182033,0.000472813,0.000236407,0,0,0,0,0,0.00070922,0.000472813,0.000236407,0.000236407,0,0,0,0,0,0,0 14 | 13,0,0,0,0,0,0.000236407,0.000236407,0.000236407,0.00070922,0.000472813,0.001654846,0.006146572,0.003309693,0.00141844,0,0,0,0,0,0,0.000236407,0.000472813,0,0.000236407,0.000236407,0,0,0,0,0,0,0 15 | 14,0,0,0,0,0,0.000472813,0,0.000236407,0.000945626,0.000472813,0.00070922,0.001182033,0.00141844,0.00141844,0.000472813,0,0.000236407,0,0,0.000472813,0.000472813,0.000236407,0.00070922,0.000472813,0,0,0,0,0,0,0,0 16 | 15,0,0,0,0,0,0,0.000236407,0,0,0,0,0.000472813,0,0.000472813,0,0,0.000236407,0,0,0,0.000236407,0,0,0,0.000236407,0,0,0,0,0,0,0 17 | 16,0,0,0,0,0,0.000472813,0.000236407,0.000236407,0.000236407,0.000236407,0.000472813,0.000236407,0,0,0,0,0.000236407,0.000472813,0,0,0.000472813,0.000236407,0.000236407,0,0.000472813,0,0,0,0,0,0,0 18 | 17,0,0,0,0,0,0,0,0.000236407,0.000236407,0,0,0,0,0.000236407,0.000236407,0.000236407,0.000472813,0.000236407,0.000236407,0.000236407,0.000472813,0,0,0,0,0,0,0,0,0,0,0 19 | 18,0,0,0,0,0,0,0,0,0,0,0.000472813,0,0,0,0,0.000472813,0.000236407,0.00141844,0.00212766,0.000236407,0.00070922,0,0,0.000236407,0.000236407,0,0,0,0,0,0,0 20 | 19,0,0,0,0,0.000236407,0,0,0,0,0,0,0,0,0,0,0,0.000236407,0.00212766,0.008510638,0.008037825,0.001891253,0.000472813,0,0,0,0,0,0,0,0,0,0 21 | 20,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000472813,0,0,0.000236407,0.000236407,0.008037825,0.020803783,0.013711584,0.004018913,0.000945626,0.000472813,0,0,0.000236407,0,0,0,0,0 22 | 21,0,0,0,0,0,0,0,0,0.000236407,0,0.000472813,0,0.000236407,0.000472813,0.000236407,0.000472813,0.000472813,0.00070922,0.001891253,0.013711584,0.036879433,0.020094563,0.002836879,0.00070922,0.001182033,0,0.000236407,0,0,0,0,0 23 | 22,0,0,0,0,0,0,0,0,0,0.000236407,0.000472813,0.00070922,0.000472813,0.000236407,0,0.000236407,0,0,0.000472813,0.004018913,0.020094563,0.040189125,0.015130024,0.003309693,0.000945626,0.000472813,0.000472813,0.000236407,0,0,0,0.000236407 24 | 23,0.000236407,0.000236407,0,0,0,0,0,0.000472813,0,0.000472813,0.000236407,0.000472813,0,0.00070922,0,0.000236407,0,0,0,0.000945626,0.002836879,0.015130024,0.01465721,0.008747045,0.005437352,0.001182033,0,0,0,0,0,0 25 | 24,0,0,0,0,0,0,0,0.000472813,0,0.000472813,0.000236407,0.000236407,0.000236407,0.000472813,0,0,0,0.000236407,0,0.000472813,0.00070922,0.003309693,0.008747045,0.008983452,0.005200946,0.001891253,0.000472813,0,0,0,0,0 26 | 25,0,0,0,0,0,0,0,0.000236407,0,0,0,0.000236407,0.000236407,0,0.000236407,0.000472813,0,0.000236407,0,0,0.001182033,0.000945626,0.005437352,0.005200946,0.004255319,0.001654846,0.000472813,0,0.000945626,0.000236407,0,0 27 | 26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000472813,0.001182033,0.001891253,0.001654846,0.000945626,0.00070922,0.000472813,0,0.000236407,0,0 28 | 27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000236407,0.000236407,0.000472813,0,0.000472813,0.000472813,0.00070922,0,0.00070922,0,0.000236407,0,0.000236407 29 | 28,0,0,0,0,0,0,0,0,0.000236407,0,0,0,0,0,0,0,0,0,0,0,0,0.000236407,0,0,0,0.000472813,0.00070922,0,0.000472813,0,0.000236407,0 30 | 29,0,0,0,0,0,0,0.000236407,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000945626,0,0,0.000472813,0,0,0.000236407,0.000236407 31 | 30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000236407,0.000236407,0.000236407,0,0,0,0,0.000236407 32 | 31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000236407,0.000236407,0,0,0 33 | 32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000236407,0,0,0,0,0.000236407,0,0.000236407,0.000236407,0,0.000472813 34 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/tumor135.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32 2 | 1,0,0.000241546,0.000241546,0,0,0,0.000241546,0,0.000241546,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 2,0.000241546,0,0.000241546,0.000724638,0,0,0,0,0.000483092,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000241546,0,0,0,0,0,0,0,0,0 4 | 3,0.000241546,0.000241546,0,0.000483092,0.002657005,0.000724638,0.000241546,0.000483092,0.000966184,0.000241546,0,0,0.000241546,0,0,0,0,0,0,0,0,0,0,0.000241546,0,0,0,0,0,0,0,0 5 | 4,0,0.000724638,0.000483092,0,0.002898551,0.001207729,0.000483092,0.001449275,0.000724638,0.000483092,0.000241546,0.000966184,0.000483092,0,0,0,0,0,0,0,0.000241546,0,0,0,0,0,0,0,0,0,0,0 6 | 5,0,0,0.002657005,0.002898551,0.003864734,0.00821256,0.003381643,0.001449275,0.002173913,0.000241546,0.000483092,0.000241546,0,0.000724638,0,0.000724638,0,0,0,0,0,0.000241546,0.000241546,0,0,0,0,0,0,0,0,0 7 | 6,0,0,0.000724638,0.001207729,0.00821256,0.014975845,0.006038647,0.007971014,0.00531401,0.001207729,0.000966184,0.001449275,0.000483092,0.000724638,0,0.000241546,0.000483092,0,0.000241546,0,0,0,0.000241546,0,0.000241546,0,0,0,0,0,0,0 8 | 7,0.000241546,0,0.000241546,0.000483092,0.003381643,0.006038647,0.00821256,0.006038647,0.006521739,0.002415459,0.001207729,0.001207729,0.000483092,0.000483092,0,0.000241546,0.000241546,0,0,0,0,0.000724638,0,0,0,0,0,0,0,0,0,0 9 | 8,0,0,0.000483092,0.001449275,0.001449275,0.007971014,0.006038647,0.016425121,0.009661836,0.00821256,0.002657005,0.001690821,0.000483092,0.001690821,0.000483092,0.000241546,0.000241546,0,0,0.000241546,0.000241546,0.000241546,0.000483092,0.000483092,0.000241546,0,0.000241546,0,0,0,0,0 10 | 9,0.000241546,0.000483092,0.000966184,0.000724638,0.002173913,0.00531401,0.006521739,0.009661836,0.00821256,0.011111111,0.006521739,0.002173913,0.001207729,0.000241546,0.000241546,0.000241546,0.000241546,0,0,0.000241546,0.000241546,0.000724638,0.000483092,0,0.000241546,0.000241546,0,0,0,0,0,0 11 | 10,0,0,0.000241546,0.000483092,0.000241546,0.001207729,0.002415459,0.00821256,0.011111111,0.031884058,0.042512077,0.00410628,0.000966184,0.000724638,0,0,0,0,0,0.000483092,0.000483092,0.000241546,0.000483092,0.000483092,0.000241546,0.000241546,0,0,0,0,0,0 12 | 11,0,0,0,0.000241546,0.000483092,0.000966184,0.001207729,0.002657005,0.006521739,0.042512077,0.074396135,0.016666667,0.001690821,0,0.000241546,0.000241546,0,0.000724638,0,0,0.000483092,0.000483092,0,0.001207729,0.000483092,0,0,0,0,0,0,0 13 | 12,0,0,0,0.000966184,0.000241546,0.001449275,0.001207729,0.001690821,0.002173913,0.00410628,0.016666667,0.034782609,0.005555556,0.000483092,0.000241546,0,0,0,0,0,0.000966184,0.000724638,0.000724638,0.000241546,0,0,0,0,0,0,0,0 14 | 13,0,0,0.000241546,0.000483092,0,0.000483092,0.000483092,0.000483092,0.001207729,0.000966184,0.001690821,0.005555556,0.001932367,0.000724638,0,0,0,0,0,0,0.000241546,0.000241546,0.000241546,0.000483092,0.000241546,0,0,0,0,0,0,0 15 | 14,0,0,0,0,0.000724638,0.000724638,0.000483092,0.001690821,0.000241546,0.000724638,0,0.000483092,0.000724638,0.000966184,0.000241546,0,0,0,0,0,0.000483092,0.000966184,0.000241546,0.000483092,0.000483092,0,0,0,0,0.000241546,0,0.000241546 16 | 15,0,0,0,0,0,0,0,0.000483092,0.000241546,0,0.000241546,0.000241546,0,0.000241546,0,0,0,0,0,0.000241546,0,0,0,0.000241546,0,0,0,0,0,0,0,0 17 | 16,0,0,0,0,0.000724638,0.000241546,0.000241546,0.000241546,0.000241546,0,0.000241546,0,0,0,0,0,0,0,0,0,0.000483092,0.000483092,0.000724638,0,0.000241546,0,0.000483092,0,0,0,0,0 18 | 17,0,0,0,0,0,0.000483092,0.000241546,0.000241546,0.000241546,0,0,0,0,0,0,0,0,0,0.000241546,0.000241546,0.000483092,0.000241546,0.000483092,0,0,0,0,0,0,0,0,0 19 | 18,0,0,0,0,0,0,0,0,0,0,0.000724638,0,0,0,0,0,0,0,0.003140097,0.000241546,0.000966184,0.000241546,0.000241546,0,0.000483092,0.000241546,0,0,0,0,0,0 20 | 19,0,0,0,0,0,0.000241546,0,0,0,0,0,0,0,0,0,0,0.000241546,0.003140097,0.00531401,0.007729469,0.003864734,0.000724638,0.000241546,0,0.000241546,0,0,0,0,0,0,0.000241546 21 | 20,0,0,0,0,0,0,0,0.000241546,0.000241546,0.000483092,0,0,0,0,0.000241546,0,0.000241546,0.000241546,0.007729469,0.016425121,0.014975845,0.00531401,0.003140097,0.000241546,0.000241546,0,0.000241546,0,0,0,0,0.000241546 22 | 21,0,0,0,0.000241546,0,0,0,0.000241546,0.000241546,0.000483092,0.000483092,0.000966184,0.000241546,0.000483092,0,0.000483092,0.000483092,0.000966184,0.003864734,0.014975845,0.025120773,0.020772947,0.006763285,0.002415459,0.001449275,0.000724638,0.000241546,0.000241546,0,0,0,0.000724638 23 | 22,0,0,0,0,0.000241546,0,0.000724638,0.000241546,0.000724638,0.000241546,0.000483092,0.000724638,0.000241546,0.000966184,0,0.000483092,0.000241546,0.000241546,0.000724638,0.00531401,0.020772947,0.0352657,0.013285024,0.006038647,0.000966184,0.000241546,0.000966184,0.000241546,0,0.000241546,0.000241546,0 24 | 23,0,0.000241546,0,0,0.000241546,0.000241546,0,0.000483092,0.000483092,0.000483092,0,0.000724638,0.000241546,0.000241546,0,0.000724638,0.000483092,0.000241546,0.000241546,0.003140097,0.006763285,0.013285024,0.011594203,0.007246377,0.003381643,0.001690821,0.000241546,0.000483092,0.000241546,0,0,0 25 | 24,0,0,0.000241546,0,0,0,0,0.000483092,0,0.000483092,0.001207729,0.000241546,0.000483092,0.000483092,0.000241546,0,0,0,0,0.000241546,0.002415459,0.006038647,0.007246377,0.007246377,0.004589372,0.000483092,0,0,0.000483092,0.000241546,0,0 26 | 25,0,0,0,0,0,0.000241546,0,0.000241546,0.000241546,0.000241546,0.000483092,0,0.000241546,0.000483092,0,0.000241546,0,0.000483092,0.000241546,0.000241546,0.001449275,0.000966184,0.003381643,0.004589372,0.004347826,0.002898551,0.000241546,0.000483092,0.000483092,0.000241546,0,0 27 | 26,0,0,0,0,0,0,0,0,0.000241546,0.000241546,0,0,0,0,0,0,0,0.000241546,0,0,0.000724638,0.000241546,0.001690821,0.000483092,0.002898551,0.000483092,0.000483092,0,0,0,0,0 28 | 27,0,0,0,0,0,0,0,0.000241546,0,0,0,0,0,0,0,0.000483092,0,0,0,0.000241546,0.000241546,0.000966184,0.000241546,0,0.000241546,0.000483092,0,0.000241546,0.000483092,0,0,0 29 | 28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000241546,0.000241546,0.000483092,0,0.000483092,0,0.000241546,0,0.000483092,0,0.000241546,0 30 | 29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000241546,0.000483092,0.000483092,0,0.000483092,0.000483092,0,0,0,0 31 | 30,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000241546,0,0,0,0,0,0,0,0.000241546,0,0.000241546,0.000241546,0,0,0,0,0,0,0 32 | 31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000241546,0,0,0,0,0,0.000241546,0,0,0,0 33 | 32,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000241546,0,0,0,0,0.000241546,0.000241546,0.000724638,0,0,0,0,0,0,0,0,0,0,0 34 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/tumor45.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32 2 | 1,0,0.000483092,0,0,0.000241546,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000241546,0,0,0,0,0,0,0,0,0 3 | 2,0.000483092,0,0,0.000724638,0,0,0,0.000241546,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000241546,0,0.000241546,0,0,0,0,0,0,0 4 | 3,0,0,0,0.000966184,0.001690821,0.001449275,0.000966184,0.000483092,0.000241546,0,0,0,0.000241546,0.000483092,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000241546,0,0,0,0 5 | 4,0,0.000724638,0.000966184,0,0.002657005,0.000724638,0.001207729,0.000966184,0.000241546,0.000483092,0.000966184,0.000724638,0,0,0,0.000241546,0,0,0,0,0.000241546,0,0,0.000241546,0,0,0,0,0,0,0,0 6 | 5,0.000241546,0,0.001690821,0.002657005,0.002415459,0.00821256,0.002898551,0.002898551,0.001449275,0.000724638,0.001207729,0.000724638,0.000241546,0.000966184,0,0.000241546,0,0,0,0,0.000241546,0.000241546,0.000241546,0.000241546,0,0,0,0,0,0,0,0 7 | 6,0,0,0.001449275,0.000724638,0.00821256,0.017874396,0.007729469,0.005555556,0.003140097,0.000724638,0.001690821,0.000724638,0.000724638,0.000241546,0.000241546,0,0,0.000241546,0,0,0.000483092,0.000241546,0.000483092,0,0.000241546,0,0,0,0,0,0,0 8 | 7,0,0,0.000966184,0.001207729,0.002898551,0.007729469,0.005797101,0.010628019,0.003864734,0.002173913,0.000241546,0.000483092,0,0.000724638,0.000483092,0,0.000241546,0,0,0,0.000241546,0,0.000241546,0,0.000241546,0,0,0,0.000241546,0,0,0 9 | 8,0,0.000241546,0.000483092,0.000966184,0.002898551,0.005555556,0.010628019,0.010144928,0.014975845,0.006038647,0.002898551,0.001449275,0.000483092,0.000483092,0,0.000724638,0.000483092,0.000241546,0,0,0.000483092,0.000241546,0.000241546,0.000241546,0.000724638,0.000241546,0,0,0.000241546,0,0,0 10 | 9,0,0,0.000241546,0.000241546,0.001449275,0.003140097,0.003864734,0.014975845,0.009661836,0.013043478,0.005797101,0.002173913,0.000241546,0.000724638,0,0.000241546,0,0,0,0.000241546,0.000483092,0,0.000241546,0.000966184,0.000483092,0,0.000241546,0,0,0,0,0 11 | 10,0,0,0,0.000483092,0.000724638,0.000724638,0.002173913,0.006038647,0.013043478,0.036231884,0.034057971,0.00821256,0.002657005,0.000483092,0.000241546,0.000483092,0.000241546,0,0,0,0,0,0.000241546,0.000483092,0.000241546,0,0,0,0,0,0,0 12 | 11,0,0,0,0.000966184,0.001207729,0.001690821,0.000241546,0.002898551,0.005797101,0.034057971,0.079710145,0.018599034,0.002415459,0.000966184,0.000241546,0,0,0,0.000241546,0,0.000241546,0.000241546,0.000724638,0,0.000483092,0.000241546,0,0,0.000483092,0,0,0 13 | 12,0,0,0,0.000724638,0.000724638,0.000724638,0.000483092,0.001449275,0.002173913,0.00821256,0.018599034,0.030917874,0.00410628,0.000724638,0,0,0.000241546,0.000241546,0.000241546,0,0.000483092,0.000483092,0.000241546,0.000483092,0.000483092,0,0,0.000241546,0,0,0,0 14 | 13,0,0,0.000241546,0,0.000241546,0.000724638,0,0.000483092,0.000241546,0.002657005,0.002415459,0.00410628,0.002898551,0.000483092,0,0,0,0,0,0,0,0.000483092,0,0.000241546,0.000483092,0,0,0,0,0,0,0 15 | 14,0,0,0.000483092,0,0.000966184,0.000241546,0.000724638,0.000483092,0.000724638,0.000483092,0.000966184,0.000724638,0.000483092,0.000966184,0,0.000724638,0,0,0,0,0,0.000483092,0.000241546,0.000241546,0.000966184,0.000241546,0,0,0,0,0,0 16 | 15,0,0,0,0,0,0.000241546,0.000483092,0,0,0.000241546,0.000241546,0,0,0,0,0,0,0,0,0,0.000241546,0.000241546,0,0,0,0.000241546,0,0,0,0,0,0 17 | 16,0,0,0,0.000241546,0.000241546,0,0,0.000724638,0.000241546,0.000483092,0,0,0,0.000724638,0,0,0,0,0,0.000241546,0.000241546,0.000483092,0.000241546,0.000241546,0.000241546,0,0,0,0,0,0,0 18 | 17,0,0,0,0,0,0,0.000241546,0.000483092,0,0.000241546,0,0.000241546,0,0,0,0,0,0.000241546,0.000241546,0,0.000483092,0.000483092,0.000241546,0,0,0,0,0,0,0,0,0 19 | 18,0,0,0,0,0,0.000241546,0,0.000241546,0,0,0,0.000241546,0,0,0,0,0.000241546,0.000966184,0.001690821,0.001207729,0.000724638,0.000241546,0,0,0,0,0,0.000241546,0,0.000241546,0,0 20 | 19,0,0,0,0,0,0,0,0,0,0,0.000241546,0.000241546,0,0,0,0,0.000241546,0.001690821,0.006763285,0.009178744,0.002898551,0.000724638,0,0,0,0,0,0,0,0,0,0 21 | 20,0,0,0,0,0,0,0,0,0.000241546,0,0,0,0,0,0,0.000241546,0,0.001207729,0.009178744,0.014975845,0.014251208,0.006763285,0.001690821,0.000966184,0.000241546,0.000241546,0,0,0,0,0.000241546,0 22 | 21,0,0,0,0.000241546,0.000241546,0.000483092,0.000241546,0.000483092,0.000483092,0,0.000241546,0.000483092,0,0,0.000241546,0.000241546,0.000483092,0.000724638,0.002898551,0.014251208,0.026570048,0.020531401,0.00821256,0.001207729,0.001690821,0.000724638,0.000724638,0,0.000483092,0.000241546,0.000241546,0.000241546 23 | 22,0,0,0,0,0.000241546,0.000241546,0,0.000241546,0,0,0.000241546,0.000483092,0.000483092,0.000483092,0.000241546,0.000483092,0.000483092,0.000241546,0.000724638,0.006763285,0.020531401,0.035748792,0.011594203,0.005797101,0.002657005,0.000483092,0.000483092,0.000483092,0.000241546,0,0,0.000483092 24 | 23,0.000241546,0.000241546,0,0,0.000241546,0.000483092,0.000241546,0.000241546,0.000241546,0.000241546,0.000724638,0.000241546,0,0.000241546,0,0.000241546,0.000241546,0,0,0.001690821,0.00821256,0.011594203,0.00821256,0.009903382,0.005797101,0.002173913,0.000966184,0.000483092,0,0.000241546,0,0 25 | 24,0,0,0,0.000241546,0.000241546,0,0,0.000241546,0.000966184,0.000483092,0,0.000483092,0.000241546,0.000241546,0,0.000241546,0,0,0,0.000966184,0.001207729,0.005797101,0.009903382,0.006280193,0.003140097,0.001932367,0,0,0,0,0,0.000241546 26 | 25,0,0.000241546,0,0,0,0.000241546,0.000241546,0.000724638,0.000483092,0.000241546,0.000483092,0.000483092,0.000483092,0.000966184,0,0.000241546,0,0,0,0.000241546,0.001690821,0.002657005,0.005797101,0.003140097,0.001932367,0.000724638,0.000483092,0.000241546,0.000483092,0,0,0.000241546 27 | 26,0,0,0,0,0,0,0,0.000241546,0,0,0.000241546,0,0,0.000241546,0.000241546,0,0,0,0,0.000241546,0.000724638,0.000483092,0.002173913,0.001932367,0.000724638,0,0.000241546,0,0,0,0,0.000241546 28 | 27,0,0,0,0,0,0,0,0,0.000241546,0,0,0,0,0,0,0,0,0,0,0,0.000724638,0.000483092,0.000966184,0,0.000483092,0.000241546,0,0.000483092,0,0.000241546,0,0 29 | 28,0,0,0.000241546,0,0,0,0,0,0,0,0,0.000241546,0,0,0,0,0,0.000241546,0,0,0,0.000483092,0.000483092,0,0.000241546,0,0.000483092,0,0,0,0,0 30 | 29,0,0,0,0,0,0,0.000241546,0.000241546,0,0,0.000483092,0,0,0,0,0,0,0,0,0,0.000483092,0.000241546,0,0,0.000483092,0,0,0,0,0,0,0 31 | 30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000241546,0,0,0.000241546,0,0.000241546,0,0,0,0.000241546,0,0,0,0,0 32 | 31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000241546,0.000241546,0,0,0,0,0,0,0,0,0,0,0 33 | 32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000241546,0.000483092,0,0.000241546,0.000241546,0.000241546,0,0,0,0,0,0 34 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm/tumor90.csv: -------------------------------------------------------------------------------- 1 | ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32 2 | 1,0,0.000708885,0.000236295,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 3 | 2,0.000708885,0,0.000236295,0.00047259,0,0.000236295,0,0.000236295,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 3,0.000236295,0.000236295,0.00047259,0.000708885,0.002126654,0.00094518,0.00047259,0.00047259,0.000708885,0,0,0.000236295,0,0.000236295,0,0,0,0,0,0,0.000236295,0,0,0,0,0,0,0,0,0,0,0 5 | 4,0,0.00047259,0.000708885,0.001417769,0.003780718,0.00047259,0.000708885,0.00047259,0.000708885,0,0.000236295,0.00047259,0.000236295,0.00047259,0.000236295,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 5,0,0,0.002126654,0.003780718,0.002362949,0.008979206,0.002599244,0.002362949,0.002126654,0.000236295,0.00047259,0.001654064,0.00047259,0,0,0.00047259,0.000236295,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 6,0,0.000236295,0.00094518,0.00047259,0.008979206,0.017013233,0.007325142,0.007088847,0.003071834,0.001417769,0.001654064,0.00094518,0.000236295,0.00047259,0,0,0,0,0,0,0,0,0.000236295,0.000236295,0,0,0,0,0,0,0,0 8 | 7,0,0,0.00047259,0.000708885,0.002599244,0.007325142,0.008979206,0.007325142,0.006379962,0.001181474,0.000708885,0.001181474,0.000236295,0.000708885,0.000236295,0.00047259,0,0,0,0,0.000236295,0,0,0,0,0,0,0.000236295,0,0,0,0 9 | 8,0,0.000236295,0.00047259,0.00047259,0.002362949,0.007088847,0.007325142,0.015122873,0.012523629,0.008506616,0.002362949,0.001181474,0.000236295,0.001417769,0,0,0.000708885,0,0,0,0,0.00047259,0.000236295,0.00047259,0.000236295,0,0,0,0,0,0,0 10 | 9,0,0,0.000708885,0.000708885,0.002126654,0.003071834,0.006379962,0.012523629,0.012287335,0.010160681,0.006143667,0.00047259,0.001654064,0.00047259,0.000236295,0.000236295,0,0.00047259,0,0,0.000708885,0.00047259,0.00094518,0,0.000236295,0,0,0,0,0,0,0 11 | 10,0,0,0,0,0.000236295,0.001417769,0.001181474,0.008506616,0.010160681,0.040170132,0.03520794,0.007088847,0.001181474,0.00094518,0.00047259,0,0,0.000236295,0,0,0,0,0.00047259,0,0,0.000236295,0,0,0,0,0,0 12 | 11,0,0,0,0.000236295,0.00047259,0.001654064,0.000708885,0.002362949,0.006143667,0.03520794,0.082703214,0.017249527,0.002599244,0.00047259,0,0.000236295,0,0,0.000236295,0,0.00047259,0.001181474,0,0,0.00094518,0,0,0,0,0,0,0 13 | 12,0,0,0.000236295,0.00047259,0.001654064,0.00094518,0.001181474,0.001181474,0.00047259,0.007088847,0.017249527,0.034971645,0.004962193,0.00047259,0,0.000236295,0,0,0,0.00047259,0.00047259,0.00047259,0.000236295,0.000236295,0,0,0.000236295,0,0.000236295,0,0,0 14 | 13,0,0,0,0.000236295,0.00047259,0.000236295,0.000236295,0.000236295,0.001654064,0.001181474,0.002599244,0.004962193,0.001890359,0.001417769,0,0,0,0,0,0.000236295,0.000236295,0,0.000708885,0,0,0,0,0,0,0,0,0 15 | 14,0,0,0.000236295,0.00047259,0,0.00047259,0.000708885,0.001417769,0.00047259,0.00094518,0.00047259,0.00047259,0.001417769,0.00094518,0,0,0.000236295,0,0,0.000236295,0.000236295,0.000236295,0,0.00047259,0.00094518,0.000236295,0.000236295,0,0,0,0,0 16 | 15,0,0,0,0.000236295,0,0,0.000236295,0,0.000236295,0.00047259,0,0,0,0,0,0,0,0,0,0,0.00047259,0,0.000236295,0,0,0,0,0,0,0,0,0 17 | 16,0,0,0,0,0.00047259,0,0.00047259,0,0.000236295,0,0.000236295,0.000236295,0,0,0,0,0,0,0.00047259,0.000236295,0.000236295,0.00094518,0,0,0.000708885,0,0,0,0,0,0,0 18 | 17,0,0,0,0,0.000236295,0,0,0.000708885,0,0,0,0,0,0.000236295,0,0,0,0.000236295,0,0,0.00047259,0.00047259,0,0.00047259,0,0,0,0,0,0,0,0 19 | 18,0,0,0,0,0,0,0,0,0.00047259,0.000236295,0,0,0,0,0,0,0.000236295,0.00094518,0.002126654,0.00047259,0.00047259,0.000236295,0,0,0.000236295,0.000236295,0.000236295,0,0.000236295,0,0,0 20 | 19,0,0,0,0,0,0,0,0,0,0,0.000236295,0,0,0,0,0.00047259,0,0.002126654,0.008979206,0.007088847,0.002126654,0.00047259,0,0,0,0,0,0,0.000236295,0,0,0 21 | 20,0,0,0,0,0,0,0,0,0,0,0,0.00047259,0.000236295,0.000236295,0,0.000236295,0,0.00047259,0.007088847,0.02173913,0.013232514,0.003544423,0.00094518,0.000236295,0.000236295,0,0,0.000236295,0,0.000236295,0,0 22 | 21,0,0,0.000236295,0,0,0,0.000236295,0,0.000708885,0,0.00047259,0.00047259,0.000236295,0.000236295,0.00047259,0.000236295,0.00047259,0.00047259,0.002126654,0.013232514,0.026465028,0.0231569,0.006852552,0.001890359,0.00094518,0.00047259,0,0,0.000236295,0.00047259,0.000236295,0.00047259 23 | 22,0,0,0,0,0,0,0,0.00047259,0.00047259,0,0.001181474,0.00047259,0,0.000236295,0,0.00094518,0.00047259,0.000236295,0.00047259,0.003544423,0.0231569,0.033553875,0.012523629,0.005671078,0.001654064,0.000708885,0.000708885,0.00047259,0.00047259,0,0,0.00047259 24 | 23,0,0,0,0,0,0.000236295,0,0.000236295,0.00094518,0.00047259,0,0.000236295,0.000708885,0,0.000236295,0,0,0,0,0.00094518,0.006852552,0.012523629,0.014177694,0.007797732,0.004017013,0.001417769,0.000708885,0.000236295,0,0.000236295,0,0 25 | 24,0,0,0,0,0,0.000236295,0,0.00047259,0,0,0,0.000236295,0,0.00047259,0,0,0.00047259,0,0,0.000236295,0.001890359,0.005671078,0.007797732,0.008506616,0.004017013,0.001181474,0.000236295,0.00047259,0,0,0,0.000236295 26 | 25,0,0,0,0,0,0,0,0.000236295,0.000236295,0,0.00094518,0,0,0.00094518,0,0.000708885,0,0.000236295,0,0.000236295,0.00094518,0.001654064,0.004017013,0.004017013,0.004253308,0.002599244,0.00047259,0.000236295,0.00047259,0,0,0 27 | 26,0,0,0,0,0,0,0,0,0,0.000236295,0,0,0,0.000236295,0,0,0,0.000236295,0,0,0.00047259,0.000708885,0.001417769,0.001181474,0.002599244,0.00047259,0,0,0,0,0,0 28 | 27,0,0,0,0,0,0,0,0,0,0,0,0.000236295,0,0.000236295,0,0,0,0.000236295,0,0,0,0.000708885,0.000708885,0.000236295,0.00047259,0,0.00047259,0,0,0,0.000236295,0.000236295 29 | 28,0,0,0,0,0,0,0.000236295,0,0,0,0,0,0,0,0,0,0,0,0,0.000236295,0,0.00047259,0.000236295,0.00047259,0.000236295,0,0,0.00047259,0,0,0,0 30 | 29,0,0,0,0,0,0,0,0,0,0,0,0.000236295,0,0,0,0,0,0.000236295,0.000236295,0,0.000236295,0.00047259,0,0,0.00047259,0,0,0,0.00047259,0,0,0 31 | 30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000236295,0.00047259,0,0.000236295,0,0,0,0,0,0,0,0,0 32 | 31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000236295,0,0,0,0,0,0.000236295,0,0,0,0,0 33 | 32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.00047259,0.00047259,0,0.000236295,0,0,0.000236295,0,0,0,0,0 34 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/bars0.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 1,1,0.5,0.0263157894736842,3.63758615972639,9.5,30.25,0.983471074380165,19 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/bars135.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 1,1,0.5,0.0263157894736842,3.63758615972639,9.5,30.25,0.983471074380165,19 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/bars45.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 1,1,0.5,0.0263157894736842,3.63758615972639,9.5,30.25,0.983471074380165,19 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/bars90.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 0,0,1,0.05,2.99573227355399,9.5,33.25,1,19 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/hallbey0.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 0.583333333333333,0.416666666666667,0.808333333333333,0.145833333333333,2.09472904752765,1.29166666666667,1.03993055555556,0.719532554257095,2.58333333333333 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/hallbey135.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 1.77777777777778,1.11111111111111,0.511111111111111,0.117283950617284,2.21610224809126,1.22222222222222,1.06172839506173,0.162790697674419,2.44444444444444 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/hallbey45.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 0.444444444444444,0.444444444444444,0.777777777777778,0.148148148148148,2.04319187054512,1.22222222222222,0.839506172839506,0.735294117647059,2.44444444444444 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/hallbey90.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 1,0.666666666666667,0.7,0.138888888888889,2.09472904752765,1.16666666666667,0.972222222222222,0.485714285714286,2.33333333333333 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/noise0.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 167.232244897959,10.5,0.0948223628652116,0.00119675135360267,6.81021034019223,15.3875510204081,85.2810286963765,0.0195225863576815,30.7751020408163 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/noise135.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 175.282382340691,10.8883798417326,0.0881891942540393,0.00121400547911368,6.80200937364454,15.3513119533528,85.1695828268834,-0.0290198479483709,30.7026239067056 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/noise45.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 171.309037900875,10.7600999583507,0.0849630049949654,0.00120828108377028,6.80736810958591,15.3496459808414,85.1320167426421,-0.00613755233092562,30.6992919616826 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/noise90.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 166.576326530612,10.4816326530612,0.0906541307262441,0.00121141191170346,6.80465727274799,15.3314285714286,85.2921959183674,0.0234960846239587,30.6628571428571 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/tumor0.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 5.9096926713948,1.17210401891253,0.641237521311846,0.026285733447345,4.4172348010461,13.1434988179669,42.3200700277764,0.930178604767005,26.2869976359338 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/tumor135.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 11.7410628019324,1.85700483091787,0.525156265683369,0.0187493290391842,4.7479643794381,13.2299516908213,42.8316632826904,0.862939448271703,26.4599033816425 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/tumor45.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 13.4202898550725,1.90434782608696,0.52403147702435,0.0187944876193144,4.74740394124269,13.2294685990338,42.8362330509463,0.843353524583834,26.4589371980676 3 | -------------------------------------------------------------------------------- /tests/testthat/validation_data/glcm_metrics/tumor90.csv: -------------------------------------------------------------------------------- 1 | "glcm_contrast","glcm_dissimilarity","glcm_homogeneity","glcm_ASM","glcm_entropy","glcm_mean","glcm_variance","glcm_correlation","glcm_SA" 2 | 9.47306238185255,1.64508506616257,0.557078024154112,0.0201052785331671,4.66477376870737,13.1424858223062,42.5314463726724,0.888634608157374,26.2849716446125 3 | --------------------------------------------------------------------------------