MorphoPlugin

class morphonet.plugins.MorphoPlugin.MorphoPlugin

Bases: object

Plugin class to be heritate in order to create plugin in MorphoNet

Examples

>>> class MyFirstPLugin(MorphoPlugin):
>>>     def __init__(self):
>>>         MorphoPlugin.__init__(self)
>>>         self.set_name("My First Plugin ")
add_coordinates(text_name)

Define a new variable as a list of 3D coordinates wich allow you the get the list of corrdinates entered in the Morphow Window

Parameters:

text_name (string) – the name of the variable

Examples

>>> self.add_coordinates("seeds")
add_dropdown(text_name, option)

Define a new variable as a list of options for the plugin wich will be appear as a Dropdown in the Morphow Window

Parameters:
  • text_name (string) – the name of the variable

  • option (list of string) – list of options

Examples

>>> self.add_dropdown("Inverse",["no","yes"])
add_filepicker(text_name, default=None, Optional=False)

Define a new variable for the plugin wich will be appear as a filepicker in the Morphow Window

Parameters:
  • text_name (string) – the name of the variable

  • default_value (multi-type (optional)) – the default value of the variable

Examples

>>> self.add_filepicker("gaussian_sigma",8)
add_filesaver(text_name, default=None)

Define a new variable for the plugin wich will appear as a filepicker in the Morphow Window

Parameters:
  • text_name (string) – the name of the variable

  • default_value (multi-type (optional)) – the default value of the variable

Examples

>>> self.add_filesaver("save to","my/path/filename.txt")
add_inputfield(text_name, default=None)

Define a new variable for the plugin wich will appear as an Input Field in the Morphow Window

Parameters:
  • text_name (string) – the name of the variable

  • default_value (multi-type (optional)) – the default value of the variable

Examples

>>> self.add_inputfield("gaussian_sigma",8)
add_toggle(text_name, default=True)
filter_objects(objects, dataset)
gaussian_rawdata(t, sigma=2, preserve_range=True)
get_coordinates(text_name)

Return the list of coordinates defined in the Morphow Window

Parameters:

text_name (string) – the name of the variable

Examples

>>> seeds=self.get_coordinates("seeds")
get_dropdown(text_name)

Return the value of the variable enter in the Dropdown in the Morphow Window

Parameters:

text_name (string) – the name of the variable

Examples

>>> isOk=self.get_dropdown("Inverse")=="yes"
get_filepicker(text_name)

Return the value of the variable in the picker Input Field in the Morphow Window

Parameters:

text_name (string) – the name of the variable

Examples

>>> filename=self.get_filepicker("pick a file")
get_filesaver(text_name)

Return the value of the variable in the saver Input Field in the Morphow Window

Parameters:

text_name (string) – the name of the variable

Examples

>>> filename=self.get_filesaver("save to")
get_inputfield(text_name)

Return the value of the variable in the Input Field in the Morphow Window

Parameters:

text_name (string) – the name of the variable

Examples

>>> gauss=int(self.get_inputfield("Min gaussian_sigma"))
get_log()
get_toggle(text_name)
restart(cancel=False, label=None)

Restart function which have be to be exectuted at the end of the process in order to restart properlly the curation

Examples

>>>     def process(self,t,dataset,objects):
>>>         if not self.start(t,dataset,objects):
>>>             return None
>>>         ...
>>>         ... plugin execution  ...
>>>         ...
>>>         self.restart()
set_description(text_description)

Define the description of a plugin in order to display it in the MorphoNet Window

Parameters:

text_description (string) – the descrption

Examples

>>> self.set_description("The plugin description ")
set_icon_name(icon_name)

Define the name of the icon to be found in the icons folder to displayit on MorphoNet window

Parameters:

icon_name (string) – the icon name

Examples

>>> self.set_icon_name("plugin_name.png")
set_image_name(image_name)

Define the name of the images to be found in the image folder to display it on MorphoNet window

Parameters:

image_name (string) – the image name

Examples

>>> self.set_image_name("plugin_name.png")
set_name(text_name)

Define the plugin name

Parameters:

name (string) – the plugin name

Examples

>>> mc.set_name("My first Plugin")
set_parent(text_name)

Define the parent name in order to group plugin the in the MorphoNet Window

Parameters:

name (string) – the parent name

Examples

>>> self.set_parent("Create new objects")
start(t, dataset, objects, objects_require=True, backup=True)

Start function which have be to be exectuted at the begining of the process

Parameters:
  • t (time) – the specitic time step on the MorphoNet Window

  • dataset (dataset) – the dataset variable

  • objects – the selected objects int the MorphoNet Window

  • backup (Do we need to backup something ?) – False only when we don’t modify anything (seeds creation for example)

Examples

>>>     def process(self,t,dataset,objects): #PLUGIN EXECUTION
>>>         if not self.start(t,dataset,objects):
>>>             return None

Default Plugins