Segment Curvature¶
Measure the curvature of segments.
plantcv.morphology.segment_curvature(segmented_img, objects)
returns labeled image
- Parameters:
- segmented_img - Segmented image (output either from plantcv.morphology.segment_skeleton or plantcv.morphology.segment_id), used for creating the labeled image.
- objects - Segment objects (output from either plantcv.morphology.prune, plantcv.morphology.segment_skeleton, or plantcv.morphology.segment_sort).
- Context:
- Calculates curvature of segments by taking the ratio of the geodesic distance (plantcv.morphology.segment_path_length) over the euclidean distance plantcv.morphology.segment_euclidean_length). Measurement of two-dimensional tortuosity. Values closer to 1 indicate that a segment is a straight line while larger values indicate the segment has more curvature. Users can pass only leaf objects (returned from plantcv.morphology.segment_sort) to only collect curvature of leaves.
- Output data stored: Data ('segment_curvature') automatically gets stored to the
Outputs
class when this function is ran. These data can always get accessed during a workflow (example below). 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 = "print"
labeled_img = pcv.morphology.segment_curvature(segmented_img=segmented_img,
objects=obj)
# Pass just leaf objects and hierarchies (output from pcv.morphology.segment_sort)
labeled_img2 = pcv.morphology.segment_curvature(segmented_img=leaf_segmented,
objects=leaf_obj)
# Access data stored out from segment_curvature
segment_curvatures = pcv.outputs.observations['segment_curvature']['value']
Labeled Image
Labeled Image (only leaves)