tutorials:analyse-structure
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorials:analyse-structure [2025/06/27 18:19] – [Requirements] t | tutorials:analyse-structure [2026/05/15 11:51] (current) – [Import: FASTRAK] Tim | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| - | 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' | + | Sometimes, |
| 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. | 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. | ||
| Line 15: | Line 15: | ||
| ===== GroIMP import & export===== | ===== GroIMP import & export===== | ||
| - | 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. | + | 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, always use " |
| ==== Import: FASTRAK ==== | ==== Import: FASTRAK ==== | ||
| Importing FASTRAK data in .xml format requires the fastrakReader plugin. | Importing FASTRAK data in .xml format requires the fastrakReader plugin. | ||
| Line 90: | Line 90: | ||
| tree_metrics() provides some useful aggregations that are similar to GroIMP queries, like for example the aggregation of individual cylinder segments into branches. | 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) | + | 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). Supposing you have Fastrak data where every cylinder segment represents a yearly shoot, you could e.g. analyze the yearly apical growth of the stem on several spruce trees like this, just using the raw QSM data: |
| + | <code sas> | ||
| + | library(dplyr) | ||
| + | library(ggplot2) | ||
| + | |||
| + | folder_path <- " | ||
| + | file_list <- list.files(path = folder_path, | ||
| + | qsm_list <- list() | ||
| + | for (file in file_list) { | ||
| + | cyl_data <- read.csv(file) | ||
| + | tree_id <- tools:: | ||
| + | qsm <- reconstruct_qsm( | ||
| + | cylinder = cyl_data, | ||
| + | id = " | ||
| + | branch_order = " | ||
| + | start_x = " | ||
| + | end_x = " | ||
| + | mutate(tree_id = tree_id) | ||
| + | qsm_list[[tree_id]] <- qsm | ||
| + | } | ||
| + | |||
| + | stem_list <- lapply(qsm_list, | ||
| + | qsm %> | ||
| + | filter(branch_order == 0) %>% | ||
| + | arrange(base_distance) %> | ||
| + | mutate(year = 1: | ||
| + | |||
| + | all_stems <- bind_rows(stem_list) | ||
| + | all_years <- sort(unique(all_stems$year)) | ||
| + | all_stems %> | ||
| + | ggplot(., aes(x = year, y=length)) + | ||
| + | geom_point(aes(color = tree_id)) + | ||
| + | geom_smooth(method = " | ||
| + | ggtitle(" | ||
| + | xlab(" | ||
| + | scale_x_continuous(breaks = all_years) + | ||
| + | theme_minimal() | ||
| + | </ | ||
| + | {{: | ||
tutorials/analyse-structure.1751041194.txt.gz · Last modified: 2025/06/27 18:19 by t
