TITLE: QuPath Digital Quantification of Liver Immune Cells
AUTHORS: Xinle Wang, Catia Perciani, Xue-Zhong Ma, Chao Jiang, Justin Manuel, Sai Chung, Cornelia Thoeni, Trevor McKee, Ian McGilvray, Sonya Macparland

[DESCRIPTION]
<div class = "text-blocks"><div class = "text-block">Digital image analysis is a widely employed technique to effectively reduce sample processing time and bias. Whole slide imaging and analysis of immunohistochemically stained sample slides allows for rapid cellular quantification and insight into single cell and subcellular data that cannot be acquired by the naked eye. QuPath is an emerging open-source platform for digital pathology that provides as a free, flexible and highly accessible option to investigate histology and cellular infiltration. Despite the introduction of program modules that assist with quantification, research methodologies in the literature are inconsistent and impedes comparison across studies. This protocol offers validated, step-by-step instruction on how to optimize and run parameters using the QuPath Positive Cell Detection module, outlines how to quantitate and assess spatial distribution of cells in the liver lobule structure and presents tips and tricks to easily navigate the QuPath platform. The protocol will act to standardize optimization in QuPath for improved comparison in the literature and serve as a guide for new users. </div></div>

[STEPS]
?. [Download, Import and Organize Images]
Download open-source QuPath software from http://qupath.github.io. To avoid incompatible features in newer versions of the software, refrain from changing software versions during the same analysis.
?. [Sample Image Quality Control]
Before quantification analysis, it is important to assess the sample cohort for stain consistency. The same digital quantification parameters can only be applied to consistently stained samples. Depending on the liver sample examined, non-specific staining can occur despite identical staining protocol. In the case of inconsistent staining, the samples need to be segregated for low and high sensitivity digital cellular detection and analyzed separately to ensure true positivity capture.
?. [Image Annotation]
Annotate around the entire sample region of interest (ROI) using the magic wand icon. Note: Hold down on CTRL and SHIFT to avoid annotation overlap for artifact exclusion.
?. [Analysis Optimization]
In a particular ROI, optimize parameters for the positive cell detection module (Analyze > Cell detection > Positive cell detection) to capture individual cells and positivity threshold for "Cell: DAB OD mean". Once satisfied with parameters, run optimized module on second and third ROI to validate.
If using QuPath v.0.2.3, it is highly recommended to set the "Background radius" parameter to a negative value prior to optimizing remaining parameters, to avoid detection issues that lead to uneven tiling detection.
It is recommended to perform manual positive cell annotations with the "Points" annotation function in a select ROI when optimizing. Annotate and save all points annotations. "Measurement maps" (Measure>Show measurement maps) can be used to facilitate optimization in real time. Select "Cell: DAB OD Mean" and use scale bar to locate optimal positivity threshold. The optimal positivity threshold can be determined with overlapping points annotations map colour.
?. [Run Analysis]
Open saved positive cell detection script (Automate > Show script editor). Run script for analysis (Run > Run) for single analysis of current image. For multiple image processing or batch processing, select "Run for project" and choose images to assess.
Images to be analyzed need to be closed in viewer before batch processing.
?. [Export Results]
Export detection results for all annotations (Export > Export Measurements).
For annotation detection results of liver lobule locational analysis, select "Annotations" in "Export Type".
?. [Sample Image Quality Control]
Each individual image should be assessed for stain and slide preparation artifacts. The artifacts will be excluded from digital analysis. To exclude artifacts, either avoid artifact when annotating for sample by holding down CTRL and SHIFT, or annotate the artifact only using the annotation tools post-analysis, select all detections, insert detections into hierarchy and delete the artifact annotation (not keeping object detections).
Video instructions available at https://www.dropbox.com/sh/9jlpijg9bburnnc/AACyg2ntSZbFhIYnUIYI37DOa?dl=0
?. [Download, Import and Organize Images]
Open QuPath software and set initial preferences using the gear icon or from the menu (Edit > Preference). It is recommended to set "Set image type" as "Auto estimate" in Preference > General. This will enable the software to estimate image type as hematoxylin & eosin (H&E), horseradish peroxidase-based 3,3′-diaminobenzidine (H-DAB) or fluorescence without prompting user to manually enter for each image.
?. [Download, Import and Organize Images]
Create new project in a new, empty folder with Create project button. All files associated with the project will be saved into this folder and can be accessed through the Open project button.
?. [Download, Import and Organize Images]
Import sample images through dragging and dropping onto QuPath interface. Image names that are italicized correspond to unprocessed images. To facilitate organization, images can be assigned a metadata to categorize based on user-inputted "key" and "value" (e.g. key = stain and value = CD68 to mark macrophages). The images can be sorted by right clicking the project title and selecting Sort by... > key name
Video instructions available at https://www.dropbox.com/sh/9jlpijg9bburnnc/AACyg2ntSZbFhIYnUIYI37DOa?dl=0
?. [Spatial Lobular Analysis]
For concentrical locational analysis of periportal versus pericentral immune cells, locate and annotate liver lobule regions. Set all lobule annotations to class "Other" and save annotations using Save Annotation script below. Once saved, further concentrical partition using partitioning script below.
In cases where the entirety of the liver lobule cannot be identified, an alternative rectangular locational partition can be applied (See step 9)
The partitioning script is coded to delete original lobule annotation. It is important to save lobule annotations before running partition script. The annotations can be restored using the Restore Annotation Script below.
User should input "line length" (length of lobule side to lobule centre) and "ROIName" (e.g. ROI1) into Partitioning Script.
?. [Analysis Optimization]
Once parameters are established, save optimized positive cell detection script to project folder for future access and batch processing.
Video instructions available at https://www.dropbox.com/sh/9jlpijg9bburnnc/AACyg2ntSZbFhIYnUIYI37DOa?dl=0
?. [Spatial Lobular Analysis]
For rectangular locational analysis of periportal versus pericentral immune cells, locate portal tract and central vein regions and annotate using the rectangle annotation tool between the regions. Select annotated rectangle and partition using partitioning script below.
Rectangle vs concentrical division:Rectangle- In certain disease states, it is difficult to identify all portal tract regions and central vein for a complete liver lobule annotation. In addition, the central vein does not always land directly in the middle of the annotated lobule. In these cases, choosing to analyze the portal tract-central vein axis by rectangular division is ideal to accurately identify positive cells.Concentrical- In the case of liver biopsy tissue or samples with limited area for analysis, it may be difficult to identify adjacent portal tract and central vein regions for rectangular analysis. In this case, analysis by concentrical divisions radiating from either the portal tract or central vein can assist in providing spatial information.
Rectangle annotations can be saved using the Save Annotation Script in step 15 below.
?. [Image Annotation]
Annotate sub ROIs within overarching sample ROI with rectangle annotation tool for optimization of stain positivity detection parameters.
Optimizing on smaller sub ROIs will save processing time. Whole image processing (20X magnification) takes approximately 1 min while sub ROIs capturing the sinusoid take around 10-20 seconds.
Attempt to capture varying ROIs (ROIs that depict varying degrees of background staining or ROIs that capture different portions of the liver sinusoid) to best ensure optimized parameters consistently detect across the entire sample.
?. [Analysis Optimization]
Delete all optimization detections.
?. [Spatial Lobular Analysis]
?. [Run Analysis]
Save image detections.
?. [Export Results]
Export detection results for all annotations (Export > Export Measurements). Export file types include .tsv and .csv files.
For annotation detection results of liver lobule locational analysis, select "Annotations" in "Export Type".
?. [Spatial Lobular Analysis]
Select all detections, insert detections into hierarchy and save to analyze positivity per partition