morphoclass.transforms.node_features.extract_distances module¶
The base class for node distance feature extractors.
-
class
morphoclass.transforms.node_features.extract_distances.ExtractDistances(vertical_axis='y', negative_ipcs=False, negative_bpcs=False)¶ Bases:
objectExtract some distance features from apical trees.
The data should contain the field tmd_neuron, see the ExtractTMDNeuron class.
This is an abstract class. Sub-classes of this class should implement get_distance(apical) to implement concrete distance extraction from the apical tree.
- Parameters
vertical_axis (str) – The name of the axis along which the neurons are vertically oriented. In other words, the axis that is perpendicular to the cortex surface. This is only relevant for BPCs and is only considered if the parameter negative_bpcs is true, in which case the projection of the two apicals onto this axis decides which one of the two is lower than the other one.
negative_ipcs (bool) – If true then the distance features of all cells labelled as IPCs will have their sign inverted (feature => -feature).
negative_bpcs (bool) – If true then all cells labelled as BPCs will have their lower apical’s distance features inverted by flipping their sign. (feature => -feature). To determine which of the two apicals is lower the node positions are projected onto the axis specified in vertical_axis.
-
get_distances(apical)¶ Extract the node distance feature from an apical tree.
- Parameters
apical (tmd.Tree.Tree) – An apical tree.
- Returns
A torch tensor of shape (n_nodes,) and of dtype float32 with the extracted node distance features.
- Return type
torch.tensor