Plot Module : Getting started
This module called MorphoPlot provides various functions to directly plot your own data on the MorphoNet windows without sending anything to the MorphoNet database.
Please follow the documentation for more detail of each function.
Curation
The main purpose of the MorphoPlot module is to curate your data segmented data using the 3D viewer.
The API allows you to curate 3D segmented datasets, using MorphoNet along with a python script.
An example of a curation script :
[7]:
import morphonet
mc=morphonet.Plot(start_browser=False)
[ ]:
mc.set_dataset(begin=0,end=10,raw="myrawdata_t{:03d}.inr",segment="mysegmentdata_t{:03d}.inr",xml_file="propertiesfile.xml")
mc.curate()
You can follow this tutorial for a full detailed example.
Plugins
In order to perform actions, MorphoNet uses plugins (called morphoplugins).
A plugin is a python function that is applied to your dataset (for instance fusing two labels of a segmented image together). These functions are displayed onto the MorphoNet graphical interface and can be called from the 3D viewer, and apply on any dataset.
You can find the documentation for the MorphoPlugins here
The list of default plugins included in MorphoNet are available here
Create your own plugin !
In order to apply your own image processing algorithms, you can create your own plugins.
This MARS.py file is an example how to create a plugin in MorphoNet. You will also need vt_tools.py in order to be able to execute this plugin.
Your class (in the above example called MARS) has to derivate from MorphoPlugin
You also have to add your new plugin in your curation script (in this example, it is located in the plugins folder of the API), like this:
[ ]:
from plugins.MARS import MARS
mc.add_plugin(MARS())
Create a property
In order to annotate your datasets, you can create and add properties.
For example, by adding the following line in your main code :
[ ]:
info=mc.create_property("Cell_Name","string")
You can now name cells of an embryo by selecting a cell in the viewer and entering its name in a text field.
Documentation :
To learn more about the parameters that can be used, see : here
To learn more about how curate existing information, please see here, in the Properties section
Tips :
To avoid any problems when using this function, do not use spaces in the info_name (here = “Cell_Name” in this example) and in the info_type (here = “string” in this example) parameters.
Put this function in your main code before the “mc.curate()” function. “mc.curate()” sends the data to the 3D viewer, so if a property is created afterwards, it is not sent.
Simulation
MorphoPlot can also be use for simulation. You can focus on the physcial model of your system and use the 3D viewer to plot your model.
You can follow this tutorial for a full simulation example.
This example show you how to simply plot multiples cubes in the browser
[ ]:
#...
import morphonet
mp=morphonet.Plot(start_browser=False)
mp.add_primitive("cube",obj)
#...
obj="#Test Primitives\n"
for c in self.cells:
obj+="p "+str(tp)+","+str(c.id)+" cube ("+str(c.p.position.x)+","+str(c.p.position.y)+","+str(c.p.position.z)+") "+str(c.radius)+" (1,1,1,1) \n"
mp.plot_at(tp,obj)
#...
[ ]: