tutorials:analyse-structure
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tutorials:analyse-structure [2025/06/27 15:25] – created t | tutorials:analyse-structure [2025/06/27 18:19] (current) – [Requirements] t | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== A simple people' | + | ====== A simple people' |
There exists the rare case that you might want to conduct some statistical analysis on the structure of your simulated or measured plant outside of XL and GroIMP. GroIMP' | There exists the rare case that you might want to conduct some statistical analysis on the structure of your simulated or measured plant outside of XL and GroIMP. GroIMP' | ||
- | Here, we present an example on how to export structures from GroIMP and how to analyze them in R. | + | Here, we present an example on how to export structures from GroIMP and how to analyze them in R. There, the rTwig library allows for convenient analysis of QSM-like structures, which we will export from GroIMP. |
+ | |||
+ | Note that there are also the [[tutorials: | ||
+ | |||
+ | There are three typical data origins for structures that people want to analyze: Manually measured FASTRAK or [[groimp-platform: | ||
===== Requirements ===== | ===== Requirements ===== | ||
- | * GroIMP " | + | * GroIMP " |
* GroIMP " | * GroIMP " | ||
* Some recent version of R | * Some recent version of R | ||
Line 11: | Line 15: | ||
===== GroIMP import & export===== | ===== GroIMP import & export===== | ||
- | ==== Import ==== | + | As always in GroIMP, you can import your file using Object -> Insert File / Insert File to RGG. The difference is that if you insert to RGG, the file will be imported under the RGG Root instead of under Node.0. For our example here, both are equivalent. |
- | + | ==== Import: FASTRAK ==== | |
- | When using FASTRAK data, you can open a new RGG project and simply | + | Importing FASTRAK data in .xml format requires the fastrakReader plugin. |
+ | Note that your data might be scaled in an unexpected way relative to your GroIMP project. In the picture below is an example of FASTRAK data inserted in a New RGG project, note the size of the FASTRAK tree relative to the " | ||
{{: | {{: | ||
Line 37: | Line 42: | ||
</ | </ | ||
+ | ==== Import: DTD ==== | ||
+ | DTD files can be imported in exactly the same way as FASTRAK files, but no special plugin is required. | ||
+ | |||
+ | ==== Import: QSM ==== | ||
+ | To import a QSM in GroIMP, you need to provide it as a comma-separated file with .qsm extension which contains these columns: start_x, | ||
+ | This is consistent with the rTwig naming convention. The intended usage pipeline is to standardize QSMs from various QSM tool origins in rTwig, then you can simply export the required variables from the $cylinder data as a table. | ||
+ | |||
+ | |||
+ | ==== Export ==== | ||
+ | Export from GroIMP as .qsm is provided by the qsm plugin. Under View -> Export -> complete scene you need to specify a file name and select text/qsm as filetype. The resulting file is simply a comma separated table which contains information for every cylinder in your scene: | ||
+ | {{: | ||
+ | |||
+ | You can also export to .qsm from RGG using: | ||
+ | <code java> | ||
+ | export3DScene(getWD() + my_name + " | ||
+ | </ | ||
+ | |||
+ | ===== Import in R ===== | ||
+ | Please take a quick look the rTwig documentation to get an idea what is possible with this library and how it works in general. The main point here is that we can import our .qsm file using the reconstruct_qsm() function: | ||
+ | |||
+ | <code sas> | ||
+ | library(rTwig) | ||
+ | qsm <- reconstruct_qsm( | ||
+ | cylinder = read.csv(" | ||
+ | id = " | ||
+ | branch_order = " | ||
+ | start_x = " | ||
+ | end_x = " | ||
+ | ) | ||
+ | plot_qsm(qsm, | ||
+ | </ | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ===== Analysis in R ===== | ||
+ | The most useful rTwig functions are probably the plot_qsm() function you already saw (it has diverse coloring options and can also be used for point clouds) and the tree_metrics() function. Besides this, you can always just use the qsm cylinder data to come up with your own analysis. tree_metrics() is somewhat similar to the GROGRA functions, it outputs a whole range of overall descriptors and distributions for various aspects of your tree's morphology. Pleas reference the rTwig documentation for further details. | ||
+ | |||
+ | <code sas> | ||
+ | metrics <- tree_metrics(qsm) | ||
+ | plot(metrics$stem_taper$height_m, | ||
+ | xlab = " | ||
+ | ylab = " | ||
+ | lines(metrics$stem_taper$height_m, | ||
+ | </ | ||
+ | |||
+ | {{: | ||
+ | |||
+ | tree_metrics() provides some useful aggregations that are similar to GroIMP queries, like for example the aggregation of individual cylinder segments into branches. | ||
+ | The actual analysis to perform will however heavily depend on the type of your data source and how the data was collected (e.g. biologically meaningful shoot-based data vs. pure geometry acquisitions) | ||
tutorials/analyse-structure.1751030731.txt.gz · Last modified: 2025/06/27 15:25 by t