Title: | Quantify the contractile nature of vessels monitored under an operating microscope |
---|---|
Description: | A variety of tools to allow the quantification of videos of the lymphatic vasculature taken under an operating microscope. Lymphatic vessels that have been injected with a variety of blue dyes can be tracked throughout the video to determine their width over time. Code is optimised for efficient processing of multiple large video files. Functions to calculate physiologically relevant parameters and generate graphs from these values are also included. |
Authors: | James JW Hucklesby [aut, cre] , Peter S Russell [aut] , Anthony RJ Phillips [aut] , Catherine E Angel [aut] |
Maintainer: | James Hucklesby <[email protected]> |
License: | CC BY-NC-SA 4.0 |
Version: | 0.1.4 |
Built: | 2024-10-29 05:02:25 UTC |
Source: | https://github.com/jameshucklesby/vmeasur |
In order to calculate absolute densities from pixel sizes, the size of the field captured by an operating microscope must be determined. This function allows the user to select an image of a ruler captured under a microscope, before automatically determining the scale.
calibrate_pixel_size(file_path = tk_file.choose())
calibrate_pixel_size(file_path = tk_file.choose())
file_path |
The path to the image of a ruler to use for calibration. If left blank, the user will be prompted to select the file. |
A graphical representation of the ruler and calibration process. The number of pixels per mm will also be displayed.
## Not run: file = paste(system.file(package = "vmeasur"), "extdata/mm_scale.jpg", sep = "/") calibrate_pixel_size(file) ## End(Not run)
## Not run: file = paste(system.file(package = "vmeasur"), "extdata/mm_scale.jpg", sep = "/") calibrate_pixel_size(file) ## End(Not run)
A data set containing the widths of a test vessel in each frame of a video. Identical in format to that produced by select_roi and threshold_vessel
example_vessel
example_vessel
A data frame with 245,230 rows and 5 variables:
identification number of each row
y position in the image
width of the vessel at that position, in pixels
was that row excluded due to an air bubble
which frame was the pixel row acquired from
...
Collected for this package by Peter Russell (2021)
Set the output directory
output_dir(set = NULL, use_default = FALSE, set_default = FALSE)
output_dir(set = NULL, use_default = FALSE, set_default = FALSE)
set |
The directory to set to |
use_default |
Should the default value be used, or the system value |
set_default |
Should the system value be updated |
The file path to export to
Quantify the content of an entire directory of sub-directories at once
quantify_directory(target_folder)
quantify_directory(target_folder)
target_folder |
The folder to quantify the readings in |
A PDF file for each directory quantified, showing the quantification
This function calculates the overall widths and contraction parameters for the vessel as a whole.
quantify_mean_width(widths_file, pixel_scale = 73)
quantify_mean_width(widths_file, pixel_scale = 73)
widths_file |
A CSV file created by select_roi or threshold_vessel |
pixel_scale |
The number of pixels per mm, can be calculated with calibrate_pixel_size if unknown |
A list containing: A graph showing the detected contraction events, Details of each contraction event, The mean and standard deviation of the calculated contraction physiological parameters, The raw data used in the quantification process
quantify_mean_width(vmeasur::example_vessel)
quantify_mean_width(vmeasur::example_vessel)
Quantify the physiological parameters in each section of the vessel along it's length.
quantify_mean_width_sections(widths_file = tk_file.choose())
quantify_mean_width_sections(widths_file = tk_file.choose())
widths_file |
A csv file created by select_roi or threshold_vessel. If not specified, the user will be prompted to make a selection. |
Graphs showing the contractility over time, contraction position and amplitude detected, length of contraction and a heatmap overlay for verification of the overall data.
# quantify_mean_width_sections(widths_file = vmeasur::example_vessel)
# quantify_mean_width_sections(widths_file = vmeasur::example_vessel)
Generate heat maps and line plots showing the changes in vessel diameter along it's length
quantify_width_position(widths_file = tk_file.choose())
quantify_width_position(widths_file = tk_file.choose())
widths_file |
A csv file created by select_roi or threshold_vessel. The user will be prompted to select a file if this is not specified. |
Two plots: A heat map of the vessel diameter at each position over time and a plot showing the maximum change in diameter over time
quantify_width_position(vmeasur::example_vessel)
quantify_width_position(vmeasur::example_vessel)
vmeasur uses av to unpack temporary image files, which are then stored for further usage. This runs better if done to a high speed storage location such as a ram drive. This function sets that directory, and provides other options for specifying the structure of this temporary data.
scratch_dir( set = NULL, random_subfolder = FALSE, file_name = FALSE, wipe_scratch = FALSE )
scratch_dir( set = NULL, random_subfolder = FALSE, file_name = FALSE, wipe_scratch = FALSE )
set |
new directory to set. If left blank, no directory change will occur |
random_subfolder |
Should a random sub folder be created |
file_name |
Specify the name of the directory |
wipe_scratch |
Should the folder be cleared before use |
If not specified, the default R tempdir is used
the current location of the scratch directory
scratch_dir() scratch_dir("R:")
scratch_dir() scratch_dir("R:")
This function provides a graphical tool to walk the user through selecting a ROI from an AVI video.
select_roi()
select_roi()
Saves an annotated AVI and CSV file in the same directory as the video. Will also output and copy the paramaters used to create the video.
## Not run: select_roi() ## End(Not run)
## Not run: select_roi() ## End(Not run)
Using pre-determined values this function generates ROI from a video. If parameters are not known, use select_roi() This function is optimized to run in parallel, so should be relatively rapid. If running slowly, check the scratch disk is set correctly.
threshold_apply( threshold = 0.5, roi_name = "test", video_path = "image826.avi", radians = 0.217604550320612, xlength = 60, ylength = 242, xstart = 696, ystart = 323, image_list = NULL, fps = NULL )
threshold_apply( threshold = 0.5, roi_name = "test", video_path = "image826.avi", radians = 0.217604550320612, xlength = 60, ylength = 242, xstart = 696, ystart = 323, image_list = NULL, fps = NULL )
threshold |
The threshold for the red channel. Range 0-1. |
roi_name |
Name assigned to the region of interest |
video_path |
Location of the video file to process |
radians |
Degrees to rotate the image, in radians |
xlength |
Number of x pixels in the ROI |
ylength |
Number of y pixels in the ROI |
xstart |
ROI starting x co-ordinate |
ystart |
ROI starting y co-ordinate |
image_list |
If pre-computed, a list of images to use rather than a video |
fps |
Number of fps to process, this can be set lower for validation |
Saves the quantified CSV and overlaid video in the same directory as the video
Apply a threshold to a single frame
threshold_vessel(file_path = tk_file.choose(), threshold, min_area = 100)
threshold_vessel(file_path = tk_file.choose(), threshold, min_area = 100)
file_path |
path to the file to be used. If left blank, the user will be prompted to make a selection |
threshold |
The threshold to use |
min_area |
Minimum area to recognize as a vessel. Any smaller items will be ignored |
a data frame containing the widths of the vessel in each row of the image, and if any rows were excluded due to overexposure