axon_synthesis.synthesis.main_trunk.create_graph

Create the edges between the terminals and the obstacles (if any).

This is needed to easily compute a Steiner Tree (Euclidean Steiner Tree is complicated).

Functions

one_graph(source_coords, target_points, config)

Create the nodes and edges for one axon based on the target points and the atlas.

Classes

CreateGraphConfig([intermediate_number, ...])

Class to store the parameters needed for graph creation.

class axon_synthesis.synthesis.main_trunk.create_graph.CreateGraphConfig(intermediate_number: int = 5, min_intermediate_distance: float = 1000, min_random_point_distance: float | None = None, random_max_tries: int = 10, random_point_bbox_buffer: float = 0, voronoi_steps: int = 1, duplicate_precision: float = 0.001, use_orientation_penalty: bool = True, orientation_penalty_exponent: float = 0.1, orientation_penalty_amplitude: float = 1, use_depth_penalty: bool = True, depth_penalty_sigma: float = 0.25, depth_penalty_amplitude: float = 10, preferred_regions: int | str | list[int | str] | None = None, preferred_region_min_random_point_distance: float | None = None, preferring_sigma: float = 100, preferring_amplitude: float = 1, preferred_region_tree: KDTree | None = None, use_terminal_penalty: bool = False)

Bases: object

Class to store the parameters needed for graph creation.

intermediate_number

The number of intermediate points added before Voronoï process.

Type:

int

min_intermediate_distance

The min distance between two successive intermediate points.

Type:

float

min_random_point_distance

The min distance used to add random points.

Type:

float | None

random_point_bbox_buffer

The distance used to add a buffer around the bbox of the points.

Type:

float

voronoi_steps

The number of Voronoi steps.

Type:

int

duplicate_precision

The precision used to detect duplicated points.

Type:

float

use_orientation_penalty

If set to True, a penalty is added to edges whose direction is not radial.

Type:

bool

orientation_penalty_exponent

The exponent used for the orientation penalty.

Type:

float

orientation_penalty_amplitude

The amplitude of the orientation penalty.

Type:

float

use_depth_penalty

If set to True, a penalty is added to edges whose direction is not parallel to the iso-depth curves.

Type:

bool

depth_penalty_sigma

The sigma used for depth penalty.

Type:

float

depth_penalty_amplitude

The amplitude of the depth penalty.

Type:

float

preferred_regions

The list of brain regions in which edge weights are divided by the preferring factor.

Type:

int | str | list[int | str] | None

preferred_region_min_random_point_distance

The min distance used to pick random points in preferred regions.

Type:

float | None

preferring_sigma

The sigma used to compute the preferring factor for the given regions.

Type:

float

preferring_amplitude

The amplitude used to compute the preferring factor for the given regions.

Type:

float

preferred_region_tree

The KDTree object containing the preferred region points.

Type:

scipy.spatial._kdtree.KDTree | None

use_terminal_penalty

If set to True, a penalty is added to edges that are connected to a terminal.

Type:

bool

compute_region_tree(atlas: AtlasHelper, *, force: bool = False)

Compute the preferred region tree using the given Atlas.

load_region_tree_from_file(file)

Get the preferred region tree from a file.

pick_preferred_region_random_points(rng=None, max_tries: int = 10)

Create random points in preferred regions with min distance between them.

property preferred_region_min_distance

Get the min distance used to generate random points in the preferred regions.

axon_synthesis.synthesis.main_trunk.create_graph.one_graph(source_coords: ndarray, target_points: DataFrame, config: CreateGraphConfig, depths: VoxelData | None = None, *, forbidden_regions: VoxelData | None = None, output_path: str | PathLike | None = None, figure_path: str | PathLike | None = None, rng: None | int | Sequence[int] | SeedSequence | BitGenerator | Generator = None, logger: Logger | LoggerAdapter | None = None)

Create the nodes and edges for one axon based on the target points and the atlas.