TITLE: QuPath Visualization/Segmentation
AUTHORS: Michael X. Henderson

[DESCRIPTION]
This protocol describes QuPath visualization/segmentation.

[GUIDELINES]
QuPath is a visualization and segmentation platform optimized for whole slide images. This the place where you can visualize all your slides, and create the output that will be used by all other programs. In addition, we use QuPath to segment pathology and erase artifacts.
 


[STEPS]
SECTION: QuPath Visualization/Segmentation
1. Open QuPath. Click “Create Project.”
SECTION: QuPath Visualization/Segmentation
2. Select your QuPath folder for this project and upload images by pressing “Add Images.” Navigate to full slide scans and add slides for this project.
 

SECTION: QuPath Visualization/Segmentation
3. Upload series of images into new project on QuPath. Don’t worry about what the images are named or how they are ordered yet.
SECTION: QuPath Visualization/Segmentation
4. Adjust settings for images prior to import. Our typical settings are shown in the image to the right, although these may change (for example, for fluorescent images).
SECTION: Image Export for Registration
5.  Click the Rectangle Button.
 
Draw a rectangle around desired brain.

SECTION: Image Export for Registration
6. Click File > Export images > Original pixels > Export format (PNG), Downsample factor (12.0).
SECTION: Image Export for Registration
7. Save in QVN folder with appropriate Naming Designation, and record this designation in the QUINT
Section Log: Cohort abbreviation: Brain_s(Figure). So, for project NTG-G20 Inj 18, Brain A, for figure 23, we would give the image the name “NG18A_s023”.  In practice, if you have multiple sections around the same figure, you will need to name them uniquely so you don’t have multiple of the same image. For example, you may name sections “NG18A_s022” and “NG18A_s024”. 
SECTION: Image Export for Registration
8.  Move images to the QVN folder.
SECTION: Color Deconvolution
9. This defines what QuPath will see as brown and what it will see as blue. Color settings should be kept constant for a project. Generally, settings should be similar as long as you are using the same chromogen and same microscope. However, we have found that the default settings in QuPath are not ideal so these settings will need to be changed in each project. This can be done with a simple analysis script. Information on Setting Stain Vectors in QuPath is included in the Appendix. Set the color deconvolution by going to the “Image” tab. Draw a rectangle over the desired color from pathology (be as specific as possible).
SECTION: Color Deconvolution
9.1. Click on the “Image” tab.
SECTION: Color Deconvolution
9.2. Draw a rectangle over a pure brown part of the image (9 pixels+).
SECTION: Color Deconvolution
9.3.  Click on the “DAB” and it will ask you if you want to “Set stain vector from ROI” and click yes. 
SECTION: Color Deconvolution
9.4. If you are doing multiple images, go to the “Workflow” tab and click on “Set color deconvolution stains” under it and click “create script” and run the script it has automatically created you for all images. You NEED to do this before setting your thresholder and running it for consistent results.
SECTION: Segmentation
10. Name each annotation with abbreviated name designation found in the final column of the QUINT section log and described in Step 7.
SECTION: Segmentation
10.1.  Right click on the rectangle annotation in the annotation tab and select “Set Properties”.
SECTION: Segmentation
10.2. Write the abbreviated name you would like your input file to be denoted as in the ‘Name’ box and select ‘OK’.
SECTION: Segmentation
10.3.  Repeat for all desired annotations.
SECTION: Segmentation
11. Load your classifier for this project: Classify > Pixel classification > Load pixel classifier.
SECTION: Segmentation
12. Choose the correct classifier and “Any annotations.” Click “Create Objects.”
SECTION: Segmentation
13. Pixel Classifier: click “All Annotations.” Click “OK.”
 
SECTION: Segmentation
14.  Create objects: leave settings as they are, and click “OK.” 
 

SECTION: Segmentation
15. Click “Annotations” tab. Navigate to Annotations tab on the left side of the program screen and click it. Find the Annotation (Geometry) you just generated. Right click the row and select “Unlock”.
SECTION: Segmentation
16. Remove artifactual stain (see Appendix for examples; bubbles, edge effect, vasculature).
SECTION: Segmentation
16.1.  Click on to the slide, zoom in, and select the brush tool 
 

SECTION: Segmentation
16.2. To erase, hold down the Alt key while erasing artifacts.
 

SECTION: Segmentation
17.  After completing erase of artifact select “Automate” > Show script editor. 
SECTION: Segmentation
18. Script Editor: enter the script listed below into the box at line “1” and press Crtl + R to run. This will create your segmentation images that will be used in Nutil.

Code to Run: 

 

SECTION: Segmentation
19. Find exported images in your folder scheme under QuPath\export. The segmentation image should be a black and white image with objects in black. The images should be the exact same dimensions
of the earlier region of interest image you created as a PNG with a downsize factor corresponding to your classifier’s resolution.
SECTION: Segmentation
20. Plate the image and place into “Input” folder that will be used in final Nutil step.