Cluster Contours and Split Images

This function takes clustered contours and splits them into multiple images, also does a check to make sure that the number of inputted filenames matches the number of clustered contours.

plantcv.cluster_contour_splitimg(img, grouped_contour_indexes, contours, hierarchy, outdir=None, file=None, filenames=None)

returns output_paths, output_imgs, output_masks

  • Parameters:
    • img - image data
    • grouped_contour_indexes - output of cluster_contours, indexes of clusters of contours
    • contours - contours to cluster, output of cluster_contours
    • hierarchy - object hierarchy
    • outdir - directory for output images (default outdir=None)
    • file - the name of the input image to use as a base name , output of filename from read_image function (default file=None)
    • filenames - input txt file with list of filenames in order from top to bottom left to right (likely list of genotypes, default filenames=None)
  • Context:
    • Takes clustered contours and splits them into multiple images.
    • Function input usually comes from the output of the cluster contours function.
  • Example use:

Output of Cluster Contours


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"

# Cluster Contours and Split into Separate Images

out = './examples/'
output_path, imgs, masks = pcv.cluster_contour_splitimg(img, clusters_i, contours, 
                                                        hierarchy, out, file, 

Split the Clusters into Separate Images (example of a few images)




Source Code: Here