VasOMatic
VasOMatic is an ImageJ macro dedicated to analysing vascular coverage by pericytes on large fields of view. ChunkAnalyzer is a R script for viewing and preprocessing the output tables of VasOMatic.
OVERVIEW
The VasOMatic macro was written using FIJI (FIJI is Just ImageJ, 10.1038/nmeth.2019). First part of the algorithm is an interactive loop where users are invited to segment the vascular component of the image, using median smoothing, thresholding, and particle analysis to remove background noise and close holes in the mask. The quality of the vascular mask is critical, as it will serve as the foundation for the subsequent steps. A second interactive loop allows the user to segment the paravascular (e.g., pericytes, astrocyte endfeet, etc…) part of the image. The second part of the algorithm splits the vascular mask into chunks using ImageJ’s watershed function. The length, diameter, coverage, and paravascular signal are retrieved individually for each chunk, using skeleton measurement, distance mapping, and masks overlap, respectively. Results are finally displayed in three windows. The individual chunks data are shown in ImageJ’s results window, vasculature characteristics are depicted as a cumulative graph of length vs. diameter, and the global results from the ROI, namely FOV dimensions, total vasculature length, diameter, and coverages are presented in ImageJ’s log window.
HOW TO USE VASOMATIC
Introduction: The VasOMatic macro aims to collect coverage data of one channel overlapping the vascular structure (pericytes in the given example) and plot them in relation to local vascular diameter. It can also be used to assess general vascular morphology such as diameter distribution and vascular density. The macro works on ImageJ 1.53, using Java 1.8.0_322. Please update ImageJ and/or Java if any problems are observed.
- Step 1: Load the VasOMatic.ijm into ImageJ with Plugin>>Macro>>Install…
- Step 2: Open your image on ImageJ.
Note: Whole section files (e.g., OME.TIFF) may be very large and difficult to handle without causing ImageJ to crash. Alternate softwares, e.g., QuPath, allow large 2D image handling and incorporate ImageJ.
- Step 3: Select the image. If it is a subfield selected within FIJI’s field of view, remove all exterior background by doing “Image>>Clear outside” prior to run the macro.
- Step 4: Press F1 to run the macro. Alternatively, use “Plugins>>Macros>>Run…”
Note: To change the bound key, open VasOMatic.ijm in a text editor and in the first line of the code replace “f1” by the key of your choice.
- Step 5: In the “Channel allocation” window, allocate the channels accordingly. Projection type is relevant for z-stacks only and will apply the corresponding transform before treating the data, as the macro works on 2D images.
- Step 6: In the “Mask adjustments” window, specify the filtering options for vascular segmentation. Values are in pixel, and you will be able to change them if you are not satisfied with the segmentation run.
- Step 7: Use the “Threshold” window to adjust for the initial segmentation of the vasculature. You can observe the changes in the “Vessel premask” window. Once you are satisfied, press OK in the “Action Required” window.
- Step 8: Check on the “Vessel mask overlap” window that the mask (red) includes most of the vessels while leaving the background (gray). Once you approve the segmentation, press “Yes” and proceed to Step 9. Otherwise, press “No” to go back to Step 6.
- Step 9: Similarly to Step 6, use the “Threshold” window to segment the paravascular signal (e.g., pericytes). Press “OK” when done.
- Step 10: Similarly to Step 8, check the quality of the segmentation from the “Paravascular mask overlap” window. Pressing “No” will go back to Step 9, while pressing “Yes” allows the macro to proceed.
Note: The macro may need to run for some time (a few mins for large images) after this step. Wait until the results window appear.
- Step 11: Collect the data from the results windows and paste them in another file (e.g., Excel) for further analyses. General results are displayed in the “VAS-O-MATIC RESULTS” window. Individual values for the chunks are in the “Results” window. The “Vessel distribution” graph is a cumulative histogram of the vascular diameter in relation to length.
HOW TO USE THE CHUNK ANALYZER
Introduction: This part of the analysis uses the VasOMatic_Chunk_Analyzer.R script, which runs on R 4.2.0. Chunk data should be stored in a .csv file with headers organised as : Subject, Group, Replicate, ROI, Diameter, Length, Coverage, Signal. The first four are for identification purposes, fill with ones if unused. The last four are the direct output from VasOMatic. The script requires the following R packages: rlang, vctrs, data.table, ggplot2, forcats, svDialogs, abind, and matrixStats.
- Step 1: Open the ChunkAnalyzer.R script in R (RGui or R Studio).
- Step 2: Run the whole script. Use Edit>Run All… in RGui, or Ctrl+Shift+Enter in R Studio.
Note: The script will ask you to download or update the required packages (rlang, vctrs, data.table, ggplot2, forcats, svDialogs, abind, and matrixStats) if they are not installed yet. Select a CRAN mirror and proceed.
- Step 3: In the browser that opens, select the .csv file containing the chunks data to analyse. Data must be sorted as presented above.
- Step 4: Confirm adequate detection of the groups, subjects, and ROIs.
- Step 5: Select action in the ‘hub’ window: New Dataset: Returns to Step 3. Bin Dataset: Groups the data in bins corresponding to vascular size for each subject on a given ROI, plots the results groupwise, and exports a .csv table ready for statistics. Scatterplot: Creates density maps for a ROI showing the distribution of data for the different groups or of a selected subject, or plots all ROIs of a single group. Plots can be saved as .png. Exit: Ends the script.
VasOMatic code and sample data can be downloaded at: https://git.ecdf.ed.ac.uk/achagnot/vas-o-matic. VasOMatic’s code can be used and modified freely. For publications, VasOMatic should be cited as: 10.5281/zenodo.11198371.