TITLE: BTI mobile plant phenotyping system: Image analysis protocol
AUTHORS: Li'ang  Yu, Magdalena M Julkowska

[DESCRIPTION]
This protocol is a part of BTI mobile plant phenotyping system (https://github.com/Leon-Yu0320/BTI-Plant-phenotyping). In this part, we'll introduce using jupyter book as an interactive user-friendly interface to set appropriate parameters for image analysis by PlantCV. 

[STEPS]
SECTION: Package installation
1. Installation of packages required for analyiss

Jupyter notebook and plantCV are reuqired for analysis. Please refer https://jupyter.org/ for installating jupyter notebook and refer https://plantcv.readthedocs.io/en/stable/ for installing  jupyter notebook. 

In particular, we developed the current workflow based on  plantCV 3.12.1 by conda installation. To reduce potential errors and bugs, installing the same version will be highly recommeded. Use the following command to excute installation:

 

SECTION: Package installation
2. Test installtion success 
Before launching jupyter notebook, Please download the two example notebook from https://github.com/Leon-Yu0320/BTI-Plant-phenotyping/tree/main/notebook_example. To test the installation, pick either of the notebooks and add to the jupyter notebook webpage. See one the following example: 

Test the first chunk of the analysis to check if the PlantCV library was loaded. See one of the following examples: 

 


SECTION: Load  images for parameter adjustment
4. Example images can be downloaded from https://github.com/Leon-Yu0320/BTI-Plant-phenotyping/tree/main/images_example. We'll select one of the three images from two types of experiments as example to adjust parameters. Please modify the directory where exmaple images been saved under your local  computer. See one the the following example: 


 

 

  

SECTION: Parameter for MULTI_PLANT IMAGES
5. The pipeline for MULTI_PLANT IMAGES was based on the PlantCV tutorial https://plantcv.readthedocs.io/en/v3.2.0/multi-plant_tutorial/with some modifications and optimizations. Parameters associated with five parts, including:

1.  position and white-balance corrections
2.  image color space transformation
3.  image masking
4. selection of regions of interest (ROIs)
5. extraction phenotypes from each individual plant

Each part will be tested to reach the optimum effects of phenotype data extraction. See tips for each part below:  

Before executing the pipeline for each part, a quick check of image quality will be necessary. For users' image data, the following bad examples should be excluded for parameter settings and analysis:

   
position and white-balance corrections
After the image loading, the initial step is shifting or rotating the image at the center by using shift functions. The step is necessary which provides a framework for the selection of regions of interest (ROI). Please see two examples below; 

 


 
Followed by white-balance correction, color can be compared across images so that image processing can be the same between images


 
  

image color space transformation
The transformation from RGB to LAB color space is the preliminary step to isolating the plants from the background based on the nature of contrast between green objects and the background.  In this protocol, we selected the "a" channel which brings the highest level of contrast between plant tissues and background. 

See code for color space transformation as below:
 

  
image masking
Effective masking from LAB transformed binary images requires the well-defined edge of plant tissues and background. Thus, a good cut-off for transformation should be selected. Attached is one example with over-masked, good-mask, and less-masked images being processed (from left to right). 
  
See the code for masking below:
 

selection of regions of interest (ROI)
The ROIs define the individual plants to be included for extracting phenotypes. The coordinates of the X and Y-axis of the left-upper corner of the region, H and W are corresponded to the height and width of the ROI. 

 


  
Based on ROIs selected, a detailed division of an individual plant will be defined using a circle with a fixed circle radius. To realize a better segmentation purpose, plants should be placed at the center of the coordinate circle. 

 

 
extraction phenotypes from each individual plant

The final phenotype extraction will be performed based on small regions defined for each plant along with results being saved with a numeric ordering (from 0-15) and planting pots without plants will be skipped. 

 
The final output will be generated along with the edge of leaves being marked. Check if most of the desired leaf area was covered by blue edge lines. 
 

SECTION: Parameter for SIDE_VIEW IMAGES
6. The pipeline for SIDE_VIEW IMAGES was refered based on PlantCV tutorial https://plantcv.readthedocs.io/en/stable/tutorials/vis_tutorial/ with some modifications and optimizations. Parameters assiocaited wtih five parts, including:

1.  position and white-balance corrections
2.  image color space transformation
3.  image masking
4. selection of regions of interests (ROIs)
5. extraction phenotypes from a plant


position and white-balance corrections
After the image loading, shifting or rotating image is optional.  If adjustment of position is needed, refer code from the MULTI_PLANT IMAGE protocol for details. Also, white balance correction is optional as shown below:
 

  
image color space transformation

Effective masking from LAB and HSV transfomred  binary images requires the well-defined edge of plant tissues and background. Thus, a good cut-off for transformation should be selected. In side-view image pipeline, we applied slightly different strategy by combining two separate binary images into the same channel. Specicically, we selected the V and A channel for channel integration. 

Initially, users can visulize all channels at a glance for transformation. With our setups, the A and V channels are recommended and we'll merge two channels as follow

 

  

 

  


  

 
 selection of regions of interests (ROIs)

 
  
 
  

extraction phenotypes from a plant
For side view images, taking images from seven angles will be recommended as representatieve input to describe leaf area of the entire plants. Quality control from image each angle per plant will be necessary before proceeding to the next batch analysis step. See examples which represent the good quality image as below: 
 

  

SECTION: Package installation
3.