MaxTreeAlpha

MainPage

Class definition

 1 from morph_tree_alpha import MorphTreeAlpha
 2 from max_tree_draw_1d_image_tree import draw1DImageTree
 3 from max_tree_vmax import vmax
 4 from max_tree_hmax import hmax
 5 from max_tree_compute_height import computeHeight, compute_height_aux_py, \
 6                                     compute_height_aux_c
 7 from max_tree_compute_volume import computeVolume, compute_volume_aux_py,\
 8                                     compute_volume_aux_c
 9 from max_tree_compute_stability_measure import computeStabilityMeasure,\
10                                                compute_stability_measure_aux_py, \
11                                                compute_stability_measure_aux_c
12 from max_tree_compute_extinction_values import computeExtinctionValues,\
13                                                compute_extinction_values_aux_c, \
14                                                compute_extinction_values_aux_py
15 from max_tree_get_signature import getSignature, get_signature_aux_c, \
16                                    get_signature_aux_py
17 from max_tree_extinction_filter import extinctionFilter, extinction_filter_aux_c, \
18                                        extinction_filter_aux_py
19 from max_tree_mms_t import mmsT, mms_t_aux_c, mms_t_aux_py
20 from max_tree_mms_mser import mmsMSER, mms_mser_aux_c, mms_mser_aux_py
21 
22 from max_tree_area_diff_filter import area_difference_aux_c, areaDifference
23 
24 from max_tree_prog_area_diff_filter import prog_area_difference_aux_c, progAreaDifference
25 
26 class MaxTreeAlpha(MorphTreeAlpha):
27   """
28   This class builds the max-tree corresponding to a 8-bit grayscale image.
29   Many methods,to extract attributes and filter the max-tree are available.
30   **Input:**
31   img -> uint8 image, may be either 2D or 3D. When working with 1D signals use
32   a 2D array with the shape 1xW.
33   Bc -> Boolean array corresponding to the connectivity to be used during the
34   tree construction. The convention is that coordinates (0,0) or (0,0,0) are
35   in the center of the array.
36   """
37 
38   hmax = hmax
39   vmax = vmax
40   draw1DImageTree = draw1DImageTree
41   computeHeight = computeHeight
42   computeVolume = computeVolume
43   computeStabilityMeasure = computeStabilityMeasure
44   computeExtinctionValues = computeExtinctionValues
45   getSignature = getSignature
46   extinctionFilter = extinctionFilter
47   mmsT = mmsT
48   mmsMSER = mmsMSER
49   areaDifference = areaDifference
50   progAreaDifference = progAreaDifference
51 
52   def __init__(self, img, Bc, implementation = 'c'):
53     MorphTreeAlpha.__init__(self,img, Bc,option = 'max_tree',implementation = implementation)
54 
55     if self.implementation == 'c':
56         self.compute_height_aux = compute_height_aux_c
57         self.compute_volume_aux = compute_volume_aux_c
58         self.compute_stability_measure_aux = compute_stability_measure_aux_c
59         self.compute_extinction_values_aux = compute_extinction_values_aux_c
60         self.get_signature_aux = get_signature_aux_c
61         self.extinction_filter_aux = extinction_filter_aux_c
62         self.mms_t_aux = mms_t_aux_c
63         self.mms_mser_aux = mms_mser_aux_c
64         self.area_difference_aux = area_difference_aux_c
65         self.prog_area_difference_aux = prog_area_difference_aux_c
66     else:
67         self.compute_height_aux = compute_height_aux_py
68         self.compute_volume_aux = compute_volume_aux_py
69         self.compute_stability_measure_aux = compute_stability_measure_aux_py
70         self.compute_extinction_values_aux = compute_extinction_values_aux_py
71         self.get_signature_aux = get_signature_aux_py
72         self.extinction_filter_aux = extinction_filter_aux_py
73         self.mms_t_aux = mms_t_aux_py
74         self.mms_mser_aux = mms_mser_aux_py
1 from iamxt import MaxTreeAlpha