find.endpoints: Find endpoints for the line of action of a muscle

View source: R/find.endpoints.R

find.endpointsR Documentation

Find endpoints for the line of action of a muscle

Description

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.

Usage

find.endpoints(images, mode = "origin.insertion", show.plot = FALSE, method = "kmeans")

Arguments

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.

Details

"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.

Value

endpoints

A 2X3 matrix of coordinates featuring the endpoints of a line to rotate the muscle fibers. To be used in fiber.angle to determine pennation angles around a line of action.

mask

The coordinates representing the binary mask in "images"

Author(s)

J. Arbour

References

Arbour, J. 2023. GoodFibes: an R package for the detection of muscle fibers from diceCT scans. Integrative Organismal Biology 5(1): obad030.

See Also

fiber.angle


GoodFibes documentation built on April 27, 2026, 9:09 a.m.