Standardizes QSM variable names and ordering across different QSM software
Details
Renames supported QSM software output columns to be consistent.
All names are lower case and underscore delimited. See the dictionary
vignette for a detailed description of column names. A consistent QSM format
ensures maximum compatibility when analyzing QSMs made with different
software. This function can be run either before or after
update_cylinders()
has been run, or at any stage.
Examples
## TreeQSM Processing Chain
file <- system.file("extdata/QSM.mat", package = "rTwig")
qsm <- import_qsm(file)
#> Importing TreeQSM
cylinder <- qsm$cylinder
cylinder <- standardize_qsm(cylinder)
#> Verifying Cylinders
#> Please run `update_cylinders()` before using rTwig functions.
#> Running `update_cylinders()' will suppress this message.
str(cylinder)
#> Classes ‘tidytable’, ‘tbl’, ‘data.table’ and 'data.frame': 1136 obs. of 28 variables:
#> $ start_x : num 0.768 0.768 0.768 0.769 0.769 ...
#> $ start_y : num -16.4 -16.4 -16.4 -16.3 -16.3 ...
#> $ start_z : num 254 254 254 254 254 ...
#> $ axis_x : num 0.00995 -0.0111 0.01364 0.01571 0.01449 ...
#> $ axis_y : num 0.0912 0.0391 0.0367 0.0271 0.0267 ...
#> $ axis_z : num 0.996 0.999 0.999 1 1 ...
#> $ end_x : num 0.769 0.768 0.769 0.769 0.77 ...
#> $ end_y : num -16.4 -16.4 -16.3 -16.3 -16.3 ...
#> $ end_z : num 254 254 254 254 254 ...
#> $ id : int 1 2 3 4 5 6 7 8 9 10 ...
#> $ parent : num 0 1 2 3 4 5 6 7 8 9 ...
#> $ radius : num 0.0465 0.0454 0.0442 0.0437 0.0429 ...
#> $ raw_radius : num 0.0465 0.0454 0.0442 0.0437 0.0429 ...
#> $ length : num 0.09392 0.07216 0.06654 0.00938 0.06795 ...
#> $ branch : int 1 1 1 1 1 1 1 1 1 1 ...
#> $ branch_position: int 1 2 3 4 5 6 7 8 9 10 ...
#> $ branch_order : int 0 0 0 0 0 0 0 0 0 0 ...
#> $ reverse_order : num 20 20 20 20 20 20 20 20 20 20 ...
#> $ branch_alt : int 0 0 0 0 0 0 0 0 0 0 ...
#> $ segment : int 1 1 1 1 1 1 1 1 1 1 ...
#> $ parent_segment : int 0 0 0 0 0 0 0 0 0 0 ...
#> $ total_children : int 1 1 1 1 1 1 1 1 1 1 ...
#> $ growth_length : num 32.8 32.7 32.6 32.6 32.6 ...
#> $ base_distance : num 0 0.0722 0.1387 0.1481 0.216 ...
#> $ twig_distance : num 3.4 3.31 3.24 3.17 3.16 ...
#> $ vessel_volume : num 279 271 266 260 259 ...
#> $ pipe_area : int 82 82 82 82 82 82 82 82 82 82 ...
#> $ pipe_radius : num 9.06 9.06 9.06 9.06 9.06 ...
#> - attr(*, ".internal.selfref")=<externalptr>
## SimpleForest Processing Chain
file <- system.file("extdata/QSM.csv", package = "rTwig")
cylinder <- read.csv(file)
cylinder <- standardize_qsm(cylinder)
#> Verifying Cylinders
#> Please run `update_cylinders()` before using rTwig functions.
#> Running `update_cylinders()' will suppress this message.
str(cylinder)
#> Classes ‘tidytable’, ‘tbl’, ‘data.table’ and 'data.frame': 1149 obs. of 28 variables:
#> $ start_x : num 0.761 0.759 0.771 0.768 0.765 ...
#> $ start_y : num -16.4 -16.4 -16.4 -16.3 -16.4 ...
#> $ start_z : num 254 254 254 254 254 ...
#> $ axis_x : num -0.0286 0.2148 -0.0473 -0.0498 0.0678 ...
#> $ axis_y : num -0.078889 0.163918 0.03933 -0.011114 -0.000265 ...
#> $ axis_z : num 0.996 0.963 0.998 0.999 0.998 ...
#> $ end_x : num 0.759 0.771 0.768 0.765 0.769 ...
#> $ end_y : num -16.4 -16.4 -16.3 -16.4 -16.4 ...
#> $ end_z : num 254 254 254 254 254 ...
#> $ id : int 1 2 3 4 5 6 7 8 9 10 ...
#> $ parent : num 0 1 2 3 4 5 6 7 8 9 ...
#> $ radius : num 0.0472 0.0479 0.0469 0.0467 0.0453 ...
#> $ raw_radius : num 0.0472 0.0479 0.0469 0.0467 0.0453 ...
#> $ length : num 0.0497 0.0529 0.0535 0.0525 0.0528 ...
#> $ branch : int 1 1 1 1 1 1 1 1 1 1 ...
#> $ branch_position: int 1 2 3 4 5 6 7 8 9 10 ...
#> $ branch_order : int 0 0 0 0 0 0 0 0 0 0 ...
#> $ reverse_order : int 18 18 18 18 18 18 18 18 18 18 ...
#> $ branch_alt : num 0 0 0 0 0 0 0 0 0 0 ...
#> $ segment : num 1 1 1 1 1 1 1 1 1 1 ...
#> $ parent_segment : num 0 0 0 0 0 0 0 0 0 0 ...
#> $ total_children : int 1 1 1 1 1 1 1 1 1 1 ...
#> $ growth_length : num 31.4 31.4 31.3 31.3 31.2 ...
#> $ base_distance : num 0 0.0529 0.1065 0.1589 0.2117 ...
#> $ twig_distance : num 3.43 3.38 3.33 3.27 3.22 ...
#> $ vessel_volume : num 237 233 229 226 222 ...
#> $ pipe_area : int 69 69 69 69 69 69 69 69 69 69 ...
#> $ pipe_radius : num 8.31 8.31 8.31 8.31 8.31 ...
#> - attr(*, ".internal.selfref")=<externalptr>
## aRchi Processing Chain
file <- system.file("extdata/QSM2.csv", package = "rTwig")
cylinder <- read.csv(file)
cylinder <- standardize_qsm(cylinder)
#> Verifying Cylinders
#> Please run `update_cylinders()` before using rTwig functions.
#> Running `update_cylinders()' will suppress this message.
str(cylinder)
#> Classes ‘tidytable’, ‘tbl’, ‘data.table’ and 'data.frame': 1231 obs. of 28 variables:
#> $ start_x : num 0.763 0.77 0.77 0.763 0.764 ...
#> $ start_y : num -16.4 -16.4 -16.4 -16.4 -16.3 ...
#> $ start_z : num 254 254 254 254 254 ...
#> $ axis_x : num 0.1307 -0.0172 -0.2653 0.0294 0.1055 ...
#> $ axis_y : num 0.1531 -0.1311 0.0981 0.1203 -0.2048 ...
#> $ axis_z : num 0.98 0.991 0.959 0.992 0.973 ...
#> $ end_x : num 0.77 0.77 0.763 0.764 0.766 ...
#> $ end_y : num -16.4 -16.4 -16.4 -16.3 -16.4 ...
#> $ end_z : num 254 254 254 254 254 ...
#> $ id : int 1 2 3 4 5 6 7 8 9 10 ...
#> $ parent : num 0 1 2 3 4 5 6 7 8 9 ...
#> $ radius : num 0.0428 0.0428 0.0428 0.0428 0.0428 ...
#> $ raw_radius : num 0.0428 0.0428 0.0428 0.0428 0.0428 ...
#> $ length : num 0.0579 0.0269 0.0258 0.0245 0.0256 ...
#> $ branch : int 1 1 1 1 1 1 1 1 1 1 ...
#> $ branch_position: int 1 2 3 4 5 6 7 8 9 10 ...
#> $ branch_order : num 0 0 0 0 0 0 0 0 0 0 ...
#> $ reverse_order : num 20 20 20 20 20 20 20 20 20 20 ...
#> $ branch_alt : int 0 0 0 0 0 0 0 0 0 0 ...
#> $ segment : int 1 1 1 1 1 1 1 1 1 1 ...
#> $ parent_segment : int 0 0 0 0 0 0 0 0 0 0 ...
#> $ total_children : int 1 1 1 1 1 1 1 1 1 1 ...
#> $ growth_length : num 34.2 34.2 34.2 34.1 34.1 ...
#> $ base_distance : num 0 0.0269 0.0527 0.0772 0.1027 ...
#> $ twig_distance : num 3.44 3.38 3.36 3.33 3.3 ...
#> $ vessel_volume : num 416 409 406 403 400 ...
#> $ pipe_area : int 121 121 121 121 121 121 121 121 121 121 ...
#> $ pipe_radius : num 11 11 11 11 11 11 11 11 11 11 ...
#> - attr(*, ".internal.selfref")=<externalptr>