View source: R/find.endpoints.R
| find.endpoints | R Documentation |
Uses a binary mask of either a tendon or the origin and insertion sites of a muscle. Used by fiber.angle to calculate the pennation angle of fibers.
find.endpoints(images, mode = "origin.insertion", show.plot = FALSE, method = "kmeans")
images |
A vector of png image file names, created using list.files. Should include a binary mask. |
mode |
The coordinates of all white values from the image mask are obtained. If "origin.insertion", first uses k-means or hclust to automatically identify two clusters representing the origin and insertion sites. The mean of each of these clusters is taken and returned in endpoints. If "tendon" is selected, a line is fit through the coordinates of the mask and the fitted values from the highest and lowest z-value of the mask are returned. |
show.plot |
Optionally show the two clusters generated by k-means for the "origin.insertion" option. Check that these are sensible. |
method |
Either "kmeans" or "hclust". "hclust" option first downsamples the mask to 5000 points, then conducts hierarchical cluster analysis using a Eucliedean distance matrix and Ward's algorithm. Default "kmeans" is often faster but may not always be effective if regions are variable in size or very wide. |
"images" must have the exact same dimensions (pixel width and height, image slice position) and orientation of the images used for fiber tracking. If cropped, the exact same settings should have been used on both image stacks.
endpoints |
A 2X3 matrix of coordinates featuring the endpoints of a line to rotate the muscle fibers. To be used in |
mask |
The coordinates representing the binary mask in "images" |
J. Arbour
Arbour, J. 2023. GoodFibes: an R package for the detection of muscle fibers from diceCT scans. Integrative Organismal Biology 5(1): obad030.
fiber.angle
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.