# getSignature()

MainPage

Description: This method computes the signature of a node. The signature may be either of area or volume, and it takes in consideration the max-tree composite nodes.

Signature: levels, signature = MaxTreeAlpha.getSignature(attrib, start, end = 0, cte = 0)

Input:
• attrib: 1d-array int32. Array containing either the area or volume attribute of the max-tree nodes.
• start: str. Start node of which the signature will be computed.
• end: str. End node of the signature, default value is 0 (the root).
• cte: int. 0 for area signature and 1 for volume signature.
Output:
• levels: 1d-array, int32. Array containing the gray-levels values of the signature
• signature: 1d-array, int32. Array containing the signature.

# C++ Aux Function

```OK
```
```OK [C/C++ extension is up-to-date]
```

# Python Implementation

``` 1 import numpy as np
2
3 def getSignature(self,attrib, start, end = 0, cte = 0):
4     """
5     This method returns a tuple containing the gray-levels and the
6     attribute signature. Composite nodes are considered.
7     cte:
8     0 -> shape signature
9     1 -> volume signature
10     """
11     par = self.node_array[0,:]
12     h = self.node_array[2,:]
13     area = self.node_array[3,:]
14     attrib = attrib.astype(np.int32)
15     signature = self.get_signature_aux(par, h, area, attrib, int(start), int(end), int(cte))
16     levels = np.arange(h[end], h[start] + 1, dtype = np.int32)
17     return levels, signature
```

# Example

``` 1 from max_tree_alpha import MaxTreeAlpha
2 import numpy as np
3 import ia870
4 import ia636
5