morphoclass.transforms.edge_features package

Module contents

Transforms for edge feature extraction.

class morphoclass.transforms.edge_features.ExtractDistanceWeights(scale=1.0)

Bases: morphoclass.transforms.edge_features.extract_edge_features.ExtractEdgeFeatures

The distance weights edge feature extractor.

The feature is computed as exp(-len(edge)^2 / scale^2).

Parameters

scale (float) – The scale factor for the formula above.

extract_edge_features(data)

Extract the distance weights edge features from given data sample.

The feature is computed as exp(-len(edge)^2 / scale^2).

Parameters

data (torch_geometric.data.Data) – A data sample.

Returns

edge_attr – The extracted distance weights edge features.

Return type

torch.tensor

class morphoclass.transforms.edge_features.ExtractEdgeFeatures

Bases: abc.ABC

Base class for edge feature extractors.

abstract extract_edge_features(data)

Extract some edge features from given data sample.

Parameters

data (torch_geometric.data.Data) – A data sample.

Returns

edge_attr – The extracted edge attributes, shape (n_edges, n_features).

Return type

torch.tensor

class morphoclass.transforms.edge_features.ExtractEdgeIndex(make_undirected=False)

Bases: object

Extract the adjacency matrix from apical trees.

The data should contain the field tmd_neuron, see the ExtractTMDNeuron class.

For each apical tree in the neuron the the adjacency matrix is extracted and saved as edge_index field in the Data objects. The edge_index is a sparse representation of the adjacency matrix.

Parameters

make_undirected (bool) – Symmetrise the adjacency matrix