Skip to contents

Corrects cylinder radii

Usage

correct_radii(cylinder, twig_radius, broken_branch = TRUE)

Arguments

cylinder

QSM cylinder data frame

twig_radius

Twig radius in millimeters

broken_branch

Enable or disable the broken branch filter. Defaults to enabled (TRUE).

Value

Returns a data frame

Examples


## TreeQSM Processing Chain
file <- system.file("extdata/QSM.mat", package = "rTwig")
qsm <- import_qsm(file)
#> Importing TreeQSM
cylinder <- qsm$cylinder
cylinder <- update_cylinders(cylinder)
#> Updating Cylinder Ordering
#> Calculating Total Children
#> Building Cylinder Network
#> Caching Network
#> Verifying Topology
#> Calculating Growth Length
#> Calculating Reverse Branch Order
#> Calculating Branch Segments
#> Calculating Alternate Branch Numbers
#> Calculating Path Metrics
cylinder <- correct_radii(cylinder, twig_radius = 4.23)
#> Generating Paths
#> Filtering Paths
#> Modeling Paths
#> Updating Radii
str(cylinder)
#> Classes ‘tidytable’, ‘tbl’, ‘data.table’ and 'data.frame':	1136 obs. of  33 variables:
#>  $ length                      : num  0.09392 0.07216 0.06654 0.00938 0.06795 ...
#>  $ 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 ...
#>  $ added                       : num  0 0 0 0 0 0 0 0 0 0 ...
#>  $ BranchOrder                 : int  0 0 0 0 0 0 0 0 0 0 ...
#>  $ reverseBranchOrder          : num  20 20 20 20 20 20 20 20 20 20 ...
#>  $ PositionInBranch            : int  1 2 3 4 5 6 7 8 9 10 ...
#>  $ segment                     : int  1 1 1 1 1 1 1 1 1 1 ...
#>  $ parentSegment               : int  0 0 0 0 0 0 0 0 0 0 ...
#>  $ mad                         : num  0.00072 0.000538 0.000523 0.000335 0.000438 ...
#>  $ SurfCov                     : num  0.875 1 1 1 1 1 1 1 1 1 ...
#>  $ UnmodRadius                 : num  0.0465 0.0454 0.0442 0.0437 0.0429 ...
#>  $ OldRadius                   : num  0.0465 0.0454 0.0442 0.0437 0.0429 ...
#>  $ growthLength                : num  32.8 32.7 32.6 32.6 32.6 ...
#>  $ branch                      : int  1 1 1 1 1 1 1 1 1 1 ...
#>  $ branch_alt                  : int  0 0 0 0 0 0 0 0 0 0 ...
#>  $ parent                      : num  0 1 2 3 4 5 6 7 8 9 ...
#>  $ extension                   : int  1 2 3 4 5 6 7 8 9 10 ...
#>  $ totalChildren               : int  1 1 1 1 1 1 1 1 1 1 ...
#>  $ distanceFromBase            : num  0.0939 0.1661 0.2326 0.242 0.31 ...
#>  $ distanceToTwig              : num  3.4 3.31 3.24 3.17 3.16 ...
#>  $ reversePipeAreaBranchorder  : int  82 82 82 82 82 82 82 82 82 82 ...
#>  $ reversePipeRadiusBranchorder: num  9.06 9.06 9.06 9.06 9.06 ...
#>  $ vesselVolume                : num  279 271 266 260 259 ...
#>  $ radius                      : num  0.0465 0.0454 0.0442 0.0437 0.0429 ...
#>  $ modified                    : num  0 0 0 0 0 0 0 0 0 0 ...
#>  - attr(*, ".internal.selfref")=<externalptr> 

## SimpleForest Processing Chain
file <- system.file("extdata/QSM.csv", package = "rTwig")
cylinder <- read.csv(file)
cylinder <- update_cylinders(cylinder)
#> Finding Branches
#> Calculating Total Children
#> Building Cylinder Network
#> Caching Network
#> Verifying Topology
#> Calculating Path Metrics
cylinder <- correct_radii(cylinder, twig_radius = 4.23)
#> Generating Paths
#> Filtering Paths
#> Modeling Paths
#> Updating Radii
str(cylinder)
#> Classes ‘tidytable’, ‘tbl’, ‘data.table’ and 'data.frame':	1149 obs. of  30 variables:
#>  $ ID                          : int  1 2 3 4 5 6 7 8 9 10 ...
#>  $ parentID                    : num  0 1 2 3 4 5 6 7 8 9 ...
#>  $ startX                      : num  0.761 0.759 0.771 0.768 0.765 ...
#>  $ startY                      : num  -16.4 -16.4 -16.4 -16.3 -16.4 ...
#>  $ startZ                      : num  254 254 254 254 254 ...
#>  $ endX                        : num  0.759 0.771 0.768 0.765 0.769 ...
#>  $ endY                        : num  -16.4 -16.4 -16.3 -16.4 -16.4 ...
#>  $ endZ                        : num  254 254 254 254 254 ...
#>  $ axisX                       : num  -0.0286 0.2148 -0.0473 -0.0498 0.0678 ...
#>  $ axisY                       : num  -0.078889 0.163918 0.03933 -0.011114 -0.000265 ...
#>  $ axisZ                       : num  0.996 0.963 0.998 0.999 0.998 ...
#>  $ length                      : num  0.0497 0.0529 0.0535 0.0525 0.0528 ...
#>  $ growthLength                : num  31.4 31.4 31.3 31.3 31.2 ...
#>  $ averagePointDistance        : num  0.00589 0.00378 0.00205 0.00246 0.00251 ...
#>  $ segmentID                   : num  1 1 1 1 1 1 1 1 1 1 ...
#>  $ parentSegmentID             : num  0 0 0 0 0 0 0 0 0 0 ...
#>  $ branchOrder                 : int  0 0 0 0 0 0 0 0 0 0 ...
#>  $ reverseBranchOrder          : int  18 18 18 18 18 18 18 18 18 18 ...
#>  $ UnmodRadius                 : num  0.0472 0.0479 0.0469 0.0467 0.0453 ...
#>  $ branch_alt                  : num  0 0 0 0 0 0 0 0 0 0 ...
#>  $ branchID                    : int  1 1 1 1 1 1 1 1 1 1 ...
#>  $ positionInBranch            : int  1 2 3 4 5 6 7 8 9 10 ...
#>  $ totalChildren               : int  1 1 1 1 1 1 1 1 1 1 ...
#>  $ distanceFromBase            : num  0.0497 0.1027 0.1562 0.2086 0.2614 ...
#>  $ distanceToTwig              : num  3.43 3.38 3.33 3.27 3.22 ...
#>  $ reversePipeAreaBranchorder  : int  69 69 69 69 69 69 69 69 69 69 ...
#>  $ reversePipeRadiusBranchorder: num  8.31 8.31 8.31 8.31 8.31 ...
#>  $ vesselVolume                : num  237 233 229 226 222 ...
#>  $ radius                      : num  0.0472 0.0479 0.0469 0.0467 0.0453 ...
#>  $ modified                    : num  0 0 0 0 0 0 0 0 0 0 ...
#>  - attr(*, ".internal.selfref")=<externalptr>