3D filament containers (MaskNodeTrees)

class fil3d.structs.MaskObjNodeTree(node_obj)

This node_tree object is made to contain the nodes which contain masks produced by fil_finder. Each tree contains a starting node and a string of nodes which define the tree.

The first node contains the aggregated mask and is merged with each a subsequent addition

__init__(node_obj)

Initiate a new MaskObjNodeTree object based on the starting node.

Parameters

node_obj (MaskObjNode) – Starting node of the tree.

addNodeOnNewVChannel(new_node, verbose=False)

The “standard” procedure of adding a new node onto a tree.

We take a new node and:

  1. merge the node into the tree root node (to capture the overall “shadow” of the tree)

  2. append the node to the list of nodes on the tree

  3. assume it is on the “next” velocity channel and append the length of the tree by 1

Parameters
  • new_node (MaskObjNode) – New node to be added onto the “next” velocity channel.

  • verbose (bool) – (optional) Currently not used. Defaults to False.

Returns

The length of the tree post adding the node on the new velocity channel (this should equal the old length + 1).

addNodeOnSameVChannel(new_node)

The “special” procedure of adding a node to a tree when the tree already has a node on that velocity channel.

In this special case we need to preserve the design that a given node at index i of the node list is representative of all the nodes that belong to this tree on that velocity channel (the channel being the tree starting velocity channel + i). To do this we take the new node and: #. merge the node into the tree root node (to capture the overall “shadow of the tree) #. merge the node with the last node in the list of nodes on the tree (with the assumption that the new node and the last node are on the same velocity channel)

Parameters

new_node (MaskObjNode) – New node to be added onto the same velocity channel as the last node.

Returns

The length of the tree post adding the node on the same velocity channel (this should equal what it was before.

getLastNode()

Return the last node.

Return type

MaskObjNode

getNode(node_number)

Return the node at a given index.

Parameters

node_number (int) – Index.

Return type

MaskObjNode

getTreeMask()

Return the mask that contains the overall area/shadow of the tree.

Return type

NumPy.Array