neurots.generate.algorithms.tmdgrower

Basic class for TreeGrower Algorithms.

Classes

TMDAlgo(input_data, params, start_point[, ...])

TreeGrower of TMD basic growth.

TMDApicalAlgo(*args, **kwargs)

TreeGrower of TMD apical growth.

TMDGradientAlgo(*args, **kwargs)

TreeGrower of TMD apical growth.

class neurots.generate.algorithms.tmdgrower.TMDAlgo(input_data, params, start_point, context=None, random_generator=numpy.random, **_)

Bases: AbstractAlgo

TreeGrower of TMD basic growth.

Parameters:
  • input_data (dict) – All the data required for the growth.

  • params (dict) – The parameters required for growth. It should include the branching_method selected from: |bio_oriented, symmetric, directional].

  • start_point (list[float]) – The first point of the trunk. the “min_bar_length” parameter are validated.

  • context (Any) – An object containing contextual information.

  • random_generator (numpy.random.Generator) – The random number generator to use.

bifurcate(current_section)

When the section bifurcates two new sections need to be created.

This method computes from the current state the data required for the generation of two new sections and returns the corresponding dictionaries.

Returns:

Two dictionaries containing the data of the two children sections.

Return type:

tuple[dict, dict]

extend(current_section)

Definition of stop criterion for the growth of the current section.

get_stop_criteria(current_section)

Return stop criteria that are the commonly shared by all TMDPath algorithms.

Returns:

Two dictionaries, each containing one entry whose key is TMD and value is a neurots.generate.algorithms.common.TMDStop object.

Return type:

tuple[dict, dict]

initialize()

Generates the data to be used for the initialization of the first section to be grown.

Saves the extracted input data into the corresponding structures.

Returns:

A neurots.generate.algorithms.common.TMDStop object and the number of sections.

Return type:

tuple[TMDStop, int]

static metric(section)

Return the metric at the current position, here path distance, recorded in section.

static metric_ref(section)

Return the metric reference.

The metric reference is the path distance reference, or zero if no section is provided as input.

select_persistence(input_data, random_generator=numpy.random)

Select the persistence.

Sample one persistence diagram from a list of diagrams and modifies according to input parameters.

terminate(current_section)

Terminate the current section.

When the growth of a section is terminated the “term” must be removed from the TMD grower.

class neurots.generate.algorithms.tmdgrower.TMDApicalAlgo(*args, **kwargs)

Bases: TMDAlgo

TreeGrower of TMD apical growth.

bifurcate(current_section)

When the section bifurcates two new sections need to be created.

This method computes from the current state the data required for the generation of two new sections and returns the corresponding dictionaries.

Returns:

Two dictionaries containing the data of the two children sections.

Return type:

tuple[dict, dict]

initialize()

Initialize the algorithm.

TMD basic grower of an apical tree based on path distance. Initializes the tree grower and computes the apical distance using the input barcode.

class neurots.generate.algorithms.tmdgrower.TMDGradientAlgo(*args, **kwargs)

Bases: TMDApicalAlgo

TreeGrower of TMD apical growth.

_majorize_process(section, stop, process, input_dir)

Currates the non-major processes to apply a gradient to large components.

bifurcate(current_section)

When the section bifurcates two new sections need to be created.

This method computes from the current state the data required for the generation of two new sections and returns the corresponding dictionaries.

Returns:

Two dictionaries containing the two children sections data.

Return type:

tuple[dict, dict]