| [mmMaxgetindex] [Up] [mmMaxgetchildren] | Introspection Functions |
| User Feedback |
| y | Image
Properties of the node(s). Each row contains the following properties:
|
This function returns the properties of the given node, if index is specified,
or the properties for all nodes in a given level, if index is not specified or is negative.
Call mmMaxgetcount before this function to avoid accessing inexistent nodes.
unsigned char _a[21] = {1, 2, 3, 4, 4, 4, 3, 2, 3, 5, 6, 6, 4, 4, 4, 3, 3, 4, 1, 2, 2};
Image a(21, 1, 1, "uint8", (char *)_a);
MaxTree mt = mmMaxtree(a);
Image nn = mmMaxgetcount(mt);
for(int i = 0; i < 256; i++) {
if(nn.getpixel(i, 0, 0) > 0) {
printf("----------\nLevel: %d\n", i);
Image nodes = mmMaxgetnodes(mt, i);
int ***ptr = (int ***)nodes.pointers();
for(int j = 0; j < nodes.height(); j++) {
printf(" -\n");
printf(" isleaf: %d\n", ptr[0][j][0]);
printf(" parent level: %d\n", ptr[0][j][1]);
printf(" parent index: %d\n", ptr[0][j][2]);
printf(" area: %d\n", ptr[0][j][3]);
printf(" height: %d\n", ptr[0][j][10]);
printf(" volume: %d\n", ptr[0][j][11]);
printf(" centroid: (%d, %d)\n", ptr[0][j][4]/ptr[0][j][3], ptr[0][j][5]/ptr[0][j][3]);
printf(" bounding box: (%d, %d) - (%d, %d)\n", ptr[0][j][6], ptr[0][j][7], ptr[0][j][8], ptr[0][j][9]);
}
}
}
----------
Level: 1
-
isleaf: 0
parent level: 0
parent index: -1
area: 21
height: 7
volume: 70
centroid: (10, 0)
bounding box: (0, 0) - (20, 0)
----------
Level: 2
-
isleaf: 0
parent level: 1
parent index: 0
area: 17
height: 5
volume: 47
centroid: (9, 0)
bounding box: (1, 0) - (17, 0)
-
isleaf: 1
parent level: 1
parent index: 0
area: 2
height: 1
volume: 2
centroid: (19, 0)
bounding box: (19, 0) - (20, 0)
----------
Level: 3
-
isleaf: 0
parent level: 2
parent index: 0
area: 5
height: 2
volume: 8
centroid: (4, 0)
bounding box: (2, 0) - (6, 0)
-
isleaf: 0
parent level: 2
parent index: 0
area: 10
height: 4
volume: 22
centroid: (12, 0)
bounding box: (8, 0) - (17, 0)
----------
Level: 4
-
isleaf: 1
parent level: 3
parent index: 0
area: 3
height: 1
volume: 3
centroid: (4, 0)
bounding box: (3, 0) - (5, 0)
-
isleaf: 0
parent level: 3
parent index: 1
area: 6
height: 3
volume: 11
centroid: (11, 0)
bounding box: (9, 0) - (14, 0)
-
isleaf: 1
parent level: 3
parent index: 1
area: 1
height: 1
volume: 1
centroid: (17, 0)
bounding box: (17, 0) - (17, 0)
----------
Level: 5
-
isleaf: 0
parent level: 4
parent index: 1
area: 3
height: 2
volume: 5
centroid: (10, 0)
bounding box: (9, 0) - (11, 0)
----------
Level: 6
-
isleaf: 1
parent level: 5
parent index: 0
area: 2
height: 1
volume: 2
centroid: (10, 0)
bounding box: (10, 0) - (11, 0)
| [mmMaxgetindex] [Up] [mmMaxgetchildren] | |
| User Feedback | |
| Copyright (c) 1998-2008 by SDC Information Systems |