Utils

morphonet.data.utils.generate_init_naming_parameters(begin_cell_count, xml_folder, xml_file, atlas_path)

Generate the parameter files needed for ASCIDIANS initial naming.

Parameters:
  • begin_cell_count (int) – Number of cells for starting time point

  • xml_folder (str) – Folder containing property files to name

  • xml_file (str) – Name of the property file to use for naming

  • atlas_path (list) – list of properties file paths to use for naming template atlas

Returns:

path to the parameter file created

Return type:

str

morphonet.data.utils.generate_prop_naming_parameters(xml_folder, xml_file, atlas_path)

Generate the parameter file used by ASCIDIANS to propagate naming in a property file, and save it to disk

Parameters:
  • xml_folder (str) – folder containing the property file

  • xml_file (str) – name of the file in the XML folder

  • atlas_path (list) – list of properties file paths to use for naming template atlas

Returns:

The path to the property file

Return type:

str

morphonet.data.utils.get_all_regionprop_names()

Print all computable region property

morphonet.data.utils.get_next_cells_in_lineage(cell_key, lineage_property)

For a given cell key, provide the list of daughter cell keys from the lineage information

Parameters:
  • cell_key (str) – Cell key to find the mother. Format : t,id,channel (channel being optional)

  • lineage_property (MorphoNet.data property) – Name of the lineage property

Returns:

daughters cell key list

Return type:

list

morphonet.data.utils.get_object_id(t, idc, ch=0)

Returns the object key used in properties from the cell t, id and channel :param t: time point of the object :type t: int :param idc: object identifier in segmentation :type idc: int :param ch: channel number (optional, default = 0) :type ch: int :return: object key :rtype: str

morphonet.data.utils.get_object_t_id_ch(object_id)

Split the object identifier used to store object properties key to access time point, channel and object identifier :param object_id: Object if with format t,id,channel :type object_id: str :return: tuple (t,id,ch) :rtype: tuple

morphonet.data.utils.get_previous_cell_in_lineage(cell_key, lineage_property)

For a given cell key, provide the mother cell key from the lineage information

Parameters:
  • cell_key (str) – Cell key to find the mother. Format : t,id,channel (channel being optional)

  • lineage_property (MorphoNet.data property) – Name of the lineage property

Returns:

Mother cell key

Return type:

str

morphonet.data.utils.indent_xml(elem, level=0)

Recursively auto indent a XML object to save it to file

Parameters:
  • elem (xml.etree.ElementTree.Element) – XML object to be indented

  • level (int) – Level of indentation (Default value = 0)

Returns:

Indented XML object

Return type:

xml.etree.ElementTree.Element

morphonet.data.utils.is_property_a_regionprop(property_name)

Test if the given property_name is among the region props possible in MorphoNet

Parameters:

property_name (str) – Name of the property to test (case sensitive)

Returns:

True if the property is among the region props possible in MorphoNet

Return type:

bool

morphonet.data.utils.list_properties_in_pickle(pickle_file)

Read the pickle file given in parameter, and retrieve all properties found inside by name

Parameters:

pickle_file (str) – Name of the pickle file

Returns:

List the property names found

Return type:

list

morphonet.data.utils.load_cell_list(path_lineage, lineage_property='cell_lineage', seg_channel=0)

Load the content of “cell_lineage” property from the properties file, as a dict of key being cell keys, value the cell object

Parameters:
  • path_lineage (str) – Path to the property file

  • lineage_property (str) – Name of the lineage property

  • seg_channel (int) – Channel number (optional, default = 0)

Returns:

Dict of key being cell keys, value the cell object

Return type:

dict

morphonet.data.utils.load_properties_from_xml(xml_file, seg_channel=0)

Load all properties from a property file (xml) as MorphoNet.data properties

Parameters:
  • xml_file (str) – name of the property file to read

  • seg_channel (int) – channel number (optional, default = 0)

Returns:

list of properties

Return type:

list

morphonet.data.utils.remove_folder(path)

Empty the folder given in parameter, and delete it

Parameters:

path (str) – path to the folder to remove

morphonet.data.utils.write_lineage_to_step(dataset, step, lineage_property)

Save a given dictionary to a morphonet text format property. Giving a type to the information is important

Parameters:
  • step – Step identifier for dataset

  • name_file (str) – Name of the information and file

  • property_dict (dict) – Dict of key being cell keys, value being value