Skip to content

Commit

Permalink
Merge pull request #65 from mundialis/gui_analyse_trees
Browse files Browse the repository at this point in the history
GUI section for analyse trees
  • Loading branch information
linakrisztian authored Jan 3, 2024
2 parents c587315 + 4e46a2b commit 87179d8
Show file tree
Hide file tree
Showing 11 changed files with 215 additions and 133 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
# PURPOSE: lib for m.analyse.trees
#
# COPYRIGHT: (C) 2021-2023 by mundialis and the GRASS Development Team
# COPYRIGHT: (C) 2023 by mundialis and the GRASS Development Team
#
# This program is free software under the GNU General Public
# License (>=v2). Read the file COPYING that comes with GRASS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
# PURPOSE: Applies the classification model to the current region
#
# COPYRIGHT: (C) 2018-2023 by mundialis GmbH & Co. KG and the GRASS
# COPYRIGHT: (C) 2023 - 2024 by mundialis GmbH & Co. KG and the GRASS
# Development Team
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -26,7 +26,10 @@
# %module
# % description: Applies the classification model.
# % keyword: raster
# % keyword: classification
# % keyword: statistics
# % keyword: machine learning
# % keyword: worker
# %end

# %option G_OPT_V_INPUT
Expand Down
34 changes: 21 additions & 13 deletions grass-gis-addons/m.analyse.trees/r.trees.mlapply/r.trees.mlapply.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#
# MODULE: r.trees.mlapply
#
# AUTHOR(S): Julia Haas, Markus Metz
# AUTHOR(S): Julia Haas, Markus Metz, Lina Krisztian
#
# PURPOSE: Applies the tree classification model in parallel to the
# current region
#
# COPYRIGHT: (C) 2018-2023 by mundialis GmbH & Co. KG and the GRASS
# COPYRIGHT: (C) 2023 - 2024 by mundialis GmbH & Co. KG and the GRASS
# Development Team
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -27,41 +27,49 @@
# %module
# % description: Applies the classification model in parallel to the current region.
# % keyword: raster
# % keyword: classification
# % keyword: statistics
# % keyword: machine learning
# % keyword: trees analysis
# %end

# %option G_OPT_V_INPUT
# % key: area
# % description: Name of vector defining area of interest
# % label: Name of vector defining area of interest
# % guisection: Input
# %end

# %option G_OPT_I_GROUP
# % key: group
# % description: Name of input group
# % label: Name of input group
# % guisection: Input
# %end

# %option G_OPT_F_INPUT
# % key: model
# % description: Name of input model file
# % label: Name of input model file
# % guisection: Input
# %end

# %option G_OPT_R_OUTPUT
# % key: output
# % description: Name of classified output raster map
# % label: Name of classified output raster map
# % guisection: Output
# %end

# %option G_OPT_M_NPROCS
# % label: Number of cores for multiprocessing, -2 is the number of available cores - 1
# % answer: -2
# % guisection: Parallel processing
# %end

# %option
# % key: tile_size
# % type: double
# % required: no
# % answer: 1000
# % description: Edge length of grid tiles in map units for parallel processing
# %end

# %option G_OPT_M_NPROCS
# % label: Number of parallel processes
# % description: Number of cores for multiprocessing, -2 is the number of available cores - 1
# % answer: -2
# % label: Edge length of grid tiles in map units for parallel processing
# % guisection: Parallel processing
# %end


Expand Down
83 changes: 52 additions & 31 deletions grass-gis-addons/m.analyse.trees/r.trees.mltrain/r.trees.mltrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
#
# MODULE: r.trees.mltrain
#
# AUTHOR(S): Markus Metz <metz at mundialis.de>
# AUTHOR(S): Markus Metz, Lina Krisztian
#
# PURPOSE: Trains a random forest model for tree detection
#
# COPYRIGHT: (C) 2023 by mundialis and the GRASS Development Team
# COPYRIGHT: (C) 2023 - 2024 by mundialis and the GRASS Development Team
#
# This program is free software under the GNU General Public
# License (>=v2). Read the file COPYING that comes with GRASS
Expand All @@ -19,99 +19,97 @@
# %Module
# % description: Trains a random forest model for tree detection.
# % keyword: raster
# % keyword: statistics
# % keyword: geomorphology
# % keyword: classification
# % keyword: statistics
# % keyword: machine learning
# % keyword: trees analysis
# %end

# %option G_OPT_R_INPUT
# % key: red_raster
# % required: yes
# % label: Name of the red band
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: green_raster
# % required: yes
# % label: Name of the green band
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: blue_raster
# % required: yes
# % label: Name of the blue band
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: nir_raster
# % required: yes
# % label: Name of the NIR raster
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: ndvi_raster
# % required: yes
# % label: Name of the NDVI raster
# %end

# %option G_OPT_R_INPUT
# % key: ndwi_raster
# % required: no
# % label: Name of the NDWI raster
# %end

# %option G_OPT_R_INPUT
# % key: ndgb_raster
# % required: no
# % label: Name of the normalized green-blue difference raster
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: ndsm
# % required: yes
# % label: Name of the nDSM raster
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: slope
# % required: yes
# % label: Name of the nDSM slope raster
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: nearest
# % required: yes
# % label: Name of raster with nearest peak IDs
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: peaks
# % required: yes
# % label: Name of raster with peaks and ridges
# % guisection: Input
# %end

# %option
# % key: group
# % type: string
# %option G_OPT_R_INPUT
# % key: ndwi_raster
# % required: no
# % answer: ml_input
# % gisprompt: new,group,group
# % description: Name of output imagery group
# % label: Name of the NDWI raster
# % guisection: Optional input
# %end

# %option G_OPT_F_OUTPUT
# % key: save_model
# % label: Save model to file (for compression use e.g. '.gz' extension)
# % description: Name of file to store model results using python joblib
# % required: yes
# %option G_OPT_R_INPUT
# % key: ndgb_raster
# % required: no
# % label: Name of the normalized green-blue difference raster
# % guisection: Optional input
# %end


# %option
# % key: ndvi_threshold
# % type: double
# % required: no
# % label: Define NDVI threshold for potential trees
# % answer: 130
# % guisection: Parameters
# %end

# %option
Expand All @@ -120,6 +118,7 @@
# % required: no
# % label: Define NIR threshold for potential trees
# % answer: 130
# % guisection: Parameters
# %end

# %option
Expand All @@ -128,6 +127,7 @@
# % required: no
# % label: Define nDSM threshold for potential trees
# % answer: 1
# % guisection: Parameters
# %end

# %option
Expand All @@ -136,6 +136,7 @@
# % required: no
# % label: Define threshold for 75 percentile of slope for potential trees
# % answer: 70
# % guisection: Parameters
# %end

# %option
Expand All @@ -144,15 +145,35 @@
# % required: no
# % label: Define area size threshold for potential trees
# % answer: 5
# % guisection: Parameters
# %end

# %option G_OPT_M_NPROCS
# % label: Number of parallel processes
# % description: Number of cores for multiprocessing, -2 is the number of available cores - 1
# % answer: -2
# %option
# % key: group
# % type: string
# % required: no
# % answer: ml_input
# % gisprompt: new,group,group
# % label: Name of output imagery group
# % guisection: Output
# %end

# %option G_OPT_F_OUTPUT
# % key: save_model
# % label: Save model to file (for compression use e.g. '.gz' extension)
# % description: Name of file to store model results using python joblib
# % required: yes
# % guisection: Output
# %end

# %option G_OPT_MEMORYMB
# % guisection: Parallel processing
# %end

# %option G_OPT_M_NPROCS
# % label: Number of cores for multiprocessing, -2 is the number of available cores - 1
# % answer: -2
# % guisection: Parallel processing
# %end


Expand Down
37 changes: 22 additions & 15 deletions grass-gis-addons/m.analyse.trees/r.trees.peaks/r.trees.peaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
#
# MODULE: r.trees.peaks
#
# AUTHOR(S): Markus Metz <metz at mundialis.de>
# AUTHOR(S): Markus Metz, Lina Krisztian
#
# PURPOSE: Assigns pixels to nearest peak (tree crown)
#
# COPYRIGHT: (C) 2023 by mundialis and the GRASS Development Team
# COPYRIGHT: (C) 2023 - 2024 by mundialis and the GRASS Development Team
#
# This program is free software under the GNU General Public
# License (>=v2). Read the file COPYING that comes with GRASS
Expand All @@ -19,9 +19,10 @@
# %Module
# % description: Assigns pixels to nearest peak (tree crown).
# % keyword: raster
# % keyword: classificati1on
# % keyword: statistics
# % keyword: geomorhology
# % keyword: classification
# % keyword: geomorphology
# % keyword: trees analysis
# %end

# %option G_OPT_R_INPUT
Expand All @@ -30,13 +31,15 @@
# % required: yes
# % multiple: no
# % label: Name of the nDSM raster
# % guisection: Input
# %end

# %option G_OPT_V_INPUT
# % key: area
# % answer: study_area
# % required: no
# % description: Name of vector defining area of interest
# % label: Name of vector defining area of interest
# % guisection: Optional input
# %end

# %option
Expand All @@ -45,15 +48,9 @@
# % required: no
# % label: Resolution to use for forms detection
# % answer: 0.8
# % guisection: Optional input
# %end

# %option
# % key: tile_size
# % type: double
# % required: no
# % answer: 2000
# % description: Edge length of grid tiles in map units for parallel processing
# %end

# %option G_OPT_R_OUTPUT
# % key: nearest
Expand All @@ -80,13 +77,23 @@
# % guisection: Output
# %end

# %option G_OPT_MEMORYMB
# % guisection: Parallel processing
# %end

# %option G_OPT_M_NPROCS
# % label: Number of parallel processes
# % description: Number of cores for multiprocessing, -2 is the number of available cores - 1
# % label: Number of cores for multiprocessing, -2 is the number of available cores - 1
# % answer: -2
# % guisection: Parallel processing
# %end

# %option G_OPT_MEMORYMB
# %option
# % key: tile_size
# % type: double
# % required: no
# % answer: 2000
# % label: Edge length of grid tiles in map units for parallel processing
# % guisection: Parallel processing
# %end


Expand Down
Loading

0 comments on commit 87179d8

Please sign in to comment.