Fill Segments

Propagate the labels of a segmented skeleton to fill the mask.

plantcv.morphology.fill_segments(mask, objects, stem_objects=None, label="default")

returns filled_img

  • Parameters:
  • Context:
    • Uses the watershed algorithm to fill the mask propagating the objects' labels.
  • Output data stored: Data ('segment_area') automatically gets stored to the Outputs class when this function is ran without the stem_objects parameter. When the optional parameter is utilized then the data variable names will be ('leaf_area') and ('stem_area'). Data sample names are modified with an optional label prefix. These data can always get accessed during a workflow (example below). For more detail about data output see Summary of Output Observations

Reference Image: mask, objects drawn as labels



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 = "print"

filled_img = pcv.morphology.fill_segments(mask=plant_mask, objects=obj, label="default")

# Access data stored out from fill_segments
segments_area = pcv.outputs.observations['default']['segment_area']['value']

Filled Image


Source Code: Here