![]() |
Leptonica
1.82.0
Image processing and image analysis suite
|
#include "allheaders.h"
Go to the source code of this file.
Functions | |
l_ok | l_dnaJoin (L_DNA *dad, L_DNA *das, l_int32 istart, l_int32 iend) |
L_DNA * | l_dnaaFlattenToDna (L_DNAA *daa) |
L_DNA * | l_dnaSelectRange (L_DNA *das, l_int32 first, l_int32 last) |
NUMA * | l_dnaConvertToNuma (L_DNA *da) |
L_DNA * | numaConvertToDna (NUMA *na) |
L_DNA * | pixConvertDataToDna (PIX *pix) |
L_ASET * | l_asetCreateFromDna (L_DNA *da) |
l_ok | l_dnaRemoveDupsByAset (L_DNA *das, L_DNA **pdad) |
l_ok | l_dnaUnionByAset (L_DNA *da1, L_DNA *da2, L_DNA **pdad) |
l_ok | l_dnaIntersectionByAset (L_DNA *da1, L_DNA *da2, L_DNA **pdad) |
L_HASHMAP * | l_hmapCreateFromDna (L_DNA *da) |
l_ok | l_dnaRemoveDupsByHmap (L_DNA *das, L_DNA **pdad, L_HASHMAP **phmap) |
l_ok | l_dnaUnionByHmap (L_DNA *da1, L_DNA *da2, L_DNA **pdad) |
l_ok | l_dnaIntersectionByHmap (L_DNA *da1, L_DNA *da2, L_DNA **pdad) |
l_ok | l_dnaMakeHistoByHmap (L_DNA *das, L_DNA **pdav, L_DNA **pdac) |
L_DNA * | l_dnaDiffAdjValues (L_DNA *das) |
Rearrangements l_int32 *l_dnaJoin() l_int32 *l_dnaaFlattenToDna() L_DNA *l_dnaSelectRange() Conversion between numa and dna NUMA *l_dnaConvertToNuma() L_DNA *numaConvertToDna() Conversion from pix data to dna L_DNA *pixConvertDataToDna() Set operations using aset (rbtree) L_ASET *l_asetCreateFromDna() L_DNA *l_dnaRemoveDupsByAset() L_DNA *l_dnaUnionByAset() L_DNA *l_dnaIntersectionByAset() Hashmap operations L_HASHMAP *l_hmapCreateFromDna() l_int32 l_dnaRemoveDupsByHmap() l_int32 l_dnaUnionByHmap() l_int32 l_dnaIntersectionByHmap() l_int32 l_dnaMakeHistoByHmap() Miscellaneous operations L_DNA *l_dnaDiffAdjValues() We have two implementations of set operations on an array of doubles: (1) Using an underlying tree (rbtree) The key for each float64 value is the value itself. No collisions can occur. The tree is sorted by the keys. Lookup is done in O(log n) by traversing from the root, looking for the key. (2) Building a hashmap from the keys (hashmap) The keys are made from each float64 by casting into a uint64. The key is then hashed into a hashtable. Collisions of hashkeys are very rare, and the hashtable is designed to allow more than one hashitem in a table entry. The hashitems are put in a list at each hashtable entry, which is traversed looking for the key.
Definition in file dnafunc1.c.
[in] | da | source dna |
Definition at line 332 of file dnafunc1.c.
Referenced by l_dnaIntersectionByAset().
[in] | daa |
Notes: (1) This 'flattens' the dnaa to a dna, by joining successively each dna in the dnaa. (2) It leaves the input dnaa unchanged.
Definition at line 152 of file dnafunc1.c.
References L_Dnaa::dna, l_dnaCreate(), l_dnaJoin(), and L_Dnaa::nalloc.
[in] | da |
Definition at line 232 of file dnafunc1.c.
References l_dnaGetCount(), l_dnaGetDValue(), numaAddNumber(), and numaCreate().
[in] | das | input l_dna |
Definition at line 785 of file dnafunc1.c.
References l_dnaAddNumber(), l_dnaCreate(), l_dnaGetCount(), and l_dnaGetIValue().
[in] | da1 | |
[in] | da2 | |
[out] | pdad | intersection of the two arrays |
Notes: (1) See sarrayIntersection() for the approach. (2) Here, the key in building the sorted tree is the number itself. (3) Operations using an underlying tree are O(nlogn), which is typically less efficient than hashing, which is O(n).
Definition at line 462 of file dnafunc1.c.
References l_asetCreateFromDna(), l_dnaCreate(), and l_dnaGetCount().
[in] | da1 | |
[in] | da2 | |
[out] | pdad | intersection of the array values |
Notes: (1) Make dna with numbers common to both input arrays. (2) Use the values in the dna as the hash keys.
Definition at line 664 of file dnafunc1.c.
References L_Hashitem::count, l_dnaAddNumber(), l_dnaCreate(), l_dnaGetCount(), l_dnaGetDValue(), l_hashFloat64ToUint64(), and l_hmapCreateFromDna().
[in] | dad | dest dna; add to this one |
[in] | das | [optional] source dna; add from this one |
[in] | istart | starting index in das |
[in] | iend | ending index in das; use -1 to cat all |
Notes: (1) istart < 0 is taken to mean 'read from the start' (istart = 0) (2) iend < 0 means 'read to the end' (3) if das == NULL, this is a no-op
Definition at line 103 of file dnafunc1.c.
References l_dnaAddNumber(), l_dnaGetCount(), and l_dnaGetDValue().
Referenced by l_dnaaFlattenToDna(), l_dnaUnionByAset(), and l_dnaUnionByHmap().
[in] | das | |
[out] | pdav | array (set) of unique values |
[out] | pdac | array of counts, aligned with the array of values |
Notes: (1) Generates a histogram represented by two aligned arrays: value and count.
Definition at line 730 of file dnafunc1.c.
References L_Hashitem::count, L_Hashmap::hashtab, l_dnaAddNumber(), l_dnaCreate(), l_dnaGetDValue(), l_hmapCreateFromDna(), L_Hashitem::next, L_Hashmap::tabsize, and L_Hashitem::val.
[in] | das | |
[out] | pdad | with duplicated removed |
Definition at line 364 of file dnafunc1.c.
Referenced by l_dnaUnionByAset().
[in] | das | |
[out] | pdad | hash set of unique values |
[out] | phmap | [optional] hashmap used for lookup |
Notes: (1) Generates the set of (unique) values from das. (2) The values in the hashitems are indices into das.
Definition at line 565 of file dnafunc1.c.
References L_Hashmap::hashtab, l_dnaAddNumber(), l_dnaCreate(), l_dnaGetDValue(), l_hmapCreateFromDna(), L_Hashitem::next, L_Hashmap::tabsize, and L_Hashitem::val.
Referenced by l_dnaUnionByHmap().
[in] | das | |
[in] | first | use 0 to select from the beginning |
[in] | last | use -1 to select to the end |
Definition at line 185 of file dnafunc1.c.
References l_dnaAddNumber(), l_dnaCopy(), l_dnaCreate(), l_dnaGetCount(), and l_dnaGetDValue().
[in] | da1 | |
[in] | da2 | |
[out] | pdad | union of the two arrays |
Notes: (1) See sarrayUnionByAset() for the approach. (2) Here, the key in building the sorted tree is the number itself. (3) Operations using an underlying tree are O(nlogn), which is typically less efficient than hashing, which is O(n).
Definition at line 416 of file dnafunc1.c.
References l_dnaCopy(), l_dnaDestroy(), l_dnaJoin(), and l_dnaRemoveDupsByAset().
[in] | da1 | |
[in] | da2 | |
[out] | pdad | union of the array values |
Notes: (1) Make dna with numbers found in either of the input arrays.
Definition at line 622 of file dnafunc1.c.
References l_dnaCopy(), l_dnaDestroy(), l_dnaJoin(), and l_dnaRemoveDupsByHmap().
[in] | da | input dna |
Notes: (1) Derive the hash keys from the values in da. (2) The indices into da are stored in the val field of the hashitems. This is necessary so that hmap and da can be used together.
Definition at line 526 of file dnafunc1.c.
References l_dnaGetCount(), l_dnaGetDValue(), and l_hashFloat64ToUint64().
Referenced by l_dnaIntersectionByHmap(), l_dnaMakeHistoByHmap(), and l_dnaRemoveDupsByHmap().
numaConvertToDna
[in] | na |
Definition at line 260 of file dnafunc1.c.
References l_dnaAddNumber(), l_dnaCreate(), numaGetCount(), and numaGetFValue().
[in] | pix | 32 bpp RGB(A) |
Notes: (1) This writes the RGBA pixel values into the dna, in row-major order.
Definition at line 296 of file dnafunc1.c.