# This is a simple image with 2 diagonal and 1 orthogonal connections.
# With Formula 6 (default):
kimuraLength(matrix(c(
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 1
), ncol = 4, nrow = 3, byrow = TRUE))
# With Formula 4:
kimuraLength(
matrix(c(
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 1
), ncol = 4, nrow = 3, byrow = TRUE),
formula = 4
)
# With Formula 6 and a mask which makes the function ignore the right side
# of the image. If stict_mask = TRUE, only 1 diagonal connection can be
# found. If set to FALSE, i.e., relaxed mask borders, then 2 diagonal
# connections are counted.
kimuraLength(
skel_img = matrix(c(
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 1
), ncol = 4, nrow = 3, byrow = TRUE),
mask = matrix(
c(
TRUE, TRUE, FALSE, FALSE,
TRUE, TRUE, FALSE, FALSE,
TRUE, TRUE, FALSE, FALSE
),
ncol = 4, nrow = 3,
byrow = TRUE
), strict_mask = FALSE
)
Run the code above in your browser using DataLab