Converts a label image to coordinates summarizing their positions

labelImageCentroids(img, physical = FALSE, convex = TRUE)

Arguments

img

ants image of labels (ints)

physical

boolean if you want physical space coordinates or not

convex

- if TRUE, return centroid, if FALSE return point with min average distance to other points with same label

Value

list with labels , array of label values, and centroids <- coordinates of label centroids

Author

Avants BB, Duda JT

Examples


labelImage <- makeImage(c(2, 2, 2), 0:7)
labelImageCentroids(labelImage)
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
#> $labels
#> [1] 1 2 3 4 5 6 7
#> 
#> $vertices
#>      xc yc zc
#> [1,]  2  1  1
#> [2,]  1  2  1
#> [3,]  2  2  1
#> [4,]  1  1  2
#> [5,]  2  1  2
#> [6,]  1  2  2
#> [7,]  2  2  2
#>