Analyze Stem Objects

Primary, or stem, objects identified during workflows that examine the morphology of plants or plant organs can have specific characteristics measured about the stem segments of a skeleton.

plantcv.morphology.analyze_stem(rgb_img, stem_objects, label=None)

returns labeled_img

  • Parameters:
    • rgb_img - RGB image data for plotting.
    • stem_objects - List of stem segments (output from segment_sort function)
    • label - Optional label parameter, modifies the variable name of observations recorded. (default = pcv.params.sample_label)
  • Context:
    • Used to output stem morphological characteristics, including height, angle, and length.
  • Example use:

  • Output data stored: Data ('stem_angle', 'stem_height', and 'stem_length') automatically gets stored to the Outputs class when this function is ran. All data stored in the Outputs class gets printed out while running pcv.outputs.save_results but these data can always get accessed during a workflow. For more detail about data output see Summary of Output Observations

from plantcv import plantcv as pcv

# Set global debug behavior to None (default), "print" (to file), 
# or "plot" (Jupyter Notebooks or X11)

pcv.params.debug = "plot"
# Optionally, set a sample label name
pcv.params.sample_label = "plant"

stem_debug_img1 = pcv.morphology.analyze_stem(rgb_img=img1, stem_objects=stem_objects1)
# Access data stored out from analyze_stem
stem_angle = pcv.outputs.observations['plant']['stem_angle']['value']

stem_debug_img2 = pcv.morphology.analyze_stem(rgb_img=img2, stem_objects=stem_objects2, label="rep1")
stem_angle = pcv.outputs.observations['rep1']['stem_angle']['value']

Image 1 with identified stem characteristics


Image 2 with identified stem characteristics


Source Code: Here