#!/usr/bin/env python # coding: utf-8 # # RhizoScan Pipeline # This pipeline is a step by step pipeline # ## Common import # In[1]: get_ipython().run_line_magic('pylab', 'inline') from matplotlib import pyplot as plt from IPython.display import Image # ## RhizoScan Import # In[2]: from rhizoscan import get_data_path from rhizoscan.root.pipeline import load_image, detect_petri_plate, compute_graph, compute_tree from rhizoscan.root.pipeline.arabidopsis import segment_image, detect_leaves from rhizoscan.root.graph.mtg import tree_to_mtg # ## RSA Image # In[3]: image_filename = get_data_path('pipeline/arabido.png') Image(image_filename) # ### Load Image # In[4]: image = load_image(image_filename) imshow(image) # ### Detect features (Petri plate) # In[5]: pmask, px_scale, hull = detect_petri_plate(image,border_width=25, plate_size=120, fg_smooth=1) imshow(pmask) # ### Image Segmentation # In[6]: rmask, bbox = segment_image(image,pmask,root_max_radius=5) imshow(rmask) # ### Detect leaves and seed # In[7]: seed_map = detect_leaves(rmask, image, bbox, plant_number=2, leaf_bbox=[0,0,1,.4]) #imshow(seed_map) imshow(seed_map+rmask) # ### Compute the graph corresponding to the RSA # In[8]: graph = compute_graph(rmask,seed_map,bbox) graph.plot(linewidth=4) # ### Extract a tree from the graph # In[9]: tree = compute_tree(graph, px_scale=px_scale) tree.plot(linewidth=4) # ### Save the RSA into an MTG # In[10]: g = rsa = tree_to_mtg(tree) g.display() # In[ ]: # In[ ]: