find_threads {ggbrain} | R Documentation |
This function finds 'threads' hanging off of the edges of blobs in an image, allowing the user to trim them
Description
This function finds 'threads' hanging off of the edges of blobs in an image, allowing the user to trim them
Arguments
im |
A numeric matrix representing an image, with non-zero values representing pixels to display |
min_neighbors |
the minimum number of neighbors a pixel must have to be retained |
maxit |
the maximum number of iterations to run the thread trimming algorithm. Default: 15. |
diagonal |
Whether to count diagonal elements as valid neighbors |
Details
This algorithm runs count_neighbors iteratively until no pixel exceeds the trimming threshold min_neighbors
or the maximum number of iterations, maxit
, is reached.
By running iteratively, long tails are trimmed sequentially by pruning the most disconnected voxels.
Value
A logical matrix matrix of the same size as im
containing the number of neighboring pixels
Author(s)
Michael Hallquist