View source: R/measure_injury.R
measure_injury | R Documentation |
The measures_injury
function calculates the percentage of injury in images
by performing binary segmentation and identifying lesions. It processes
either a single image or a batch of images specified by a pattern in a
directory.
measure_injury(
img = NULL,
pattern = NULL,
index = "GRAY",
threshold = "Otsu",
invert = FALSE,
opening = 5,
closing = FALSE,
filter = FALSE,
erode = FALSE,
dilate = FALSE,
plot = TRUE,
dir_original = NULL,
parallel = FALSE,
workers = NULL,
verbose = TRUE
)
img |
The image to be analyzed. |
pattern |
A pattern of file name used to identify images to be imported.
For example, if |
index |
A character value specifying the target mode for conversion to
binary image when |
threshold |
The theshold method to be used.
|
invert |
Inverts the binary image if desired. This is useful to process
images with a black background. Defaults to |
opening , closing , filter , erode , dilate |
Morphological operations (brush size)
|
plot |
Show image after processing? |
dir_original |
The directory containing the original and processed images. Defaults to NULL. In this case, the function will search for the image img in the current working directory. |
parallel |
If |
workers |
A positive numeric scalar or a function specifying the number of parallel processes that can be active at the same time. By default, the number of sections is set up to 30% of available cores. |
verbose |
If |
The function processes each image by reading it, applying binary segmentation to detect lesions, filling the segmented areas, calculating the injury percentage, and optionally saving the processed image with highlighted lesions. In batch mode, it uses the provided pattern to identify images in the specified directory and can utilize parallel processing for efficiency.
A numeric value representing the injury percentage for a single image, or a data frame with injury percentages for batch processing.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.