|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectSeg2Dgel.Sg2glb
Seg2Dgel.Sg2hash
public class Sg2hash
Class Sg2hash specifies the picture hash table used by the 2D gel spot segmenter. There may be more than one hash table used so we make the data dynamic. E.g., hashFBL, hashWS etc.
A hash table (hIdxTbl or hXYtbl)[0:sizeHashPrime] is used to determine if a (x,y) coordinate is in the hash table and where (if its value is non:zero). Formerly a linear search of the FBL or WS was performed, but the hash function take its place and is much faster. Prime number hashing is used. The hash table will grow if required. When the hash table is "released", we merely need to clear the entires. This may be faster than just reallocating the memory, although for larger hash tables, it may just be faster to reallocate the memory.
The packing format is as follows:
# bits 24 16
-----------------------
hIdxTbl[] | free | index to FBL |
-----------------------
# bits 16 16
--------------
hXYtbl[] | X | Y |
--------------
This code was derived and refactored from GELLAB-II sg2gii C
language files.
This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The Open2Dprot Mozilla and Legal files are available on http://Open2Dprot.sourceforge.net/.
| Field Summary | |
|---|---|
private Sg2fbl |
fblHash
instance of Final Blob List (FBL) associated with the hash |
private int[] |
hIdxTbl
hash table index to FBL or WS stack data which is the associated hash table value. |
private int[] |
hXYtbl
hash table packed XY (x<<16 | y) data used as the key. |
(package private) int[] |
pixBitMap
[FUTURE] alternate hashing schem using a pix bitmap to lookup pixel membership. |
int |
sizeHashPrime
current hash table prime number size |
int |
sizeHashPrimeDefault
default hash table prime number size |
private Sg2wrk |
wrkHash
instance of Working Stack (WS) associated with the hash |
| Constructor Summary | |
|---|---|
Sg2hash()
Sg2hash() - initialize the hash table data structures to empty. |
|
| Method Summary | |
|---|---|
void |
clearHash()
clearHash() - clear the pix hash table by writing zero into the table. |
int |
getHash(int x,
int y)
getHash() - get the FBL or WS stack index value if (x,y) is in the XY point picture hash table. |
int |
getHashSize()
getHashSize() - get the size of the current picture hash table |
int |
growHashFBL(Sg2fbl fbl,
int newHashSizeMax)
growHashFBL() - grow the FBL hash tables to at least the newSize by finding a prime number GEQ the specified newSize. |
int |
growHashWS(Sg2wrk wrk,
int newSize)
growHashWS() - grow the WS hash tables to at least the newSize by finding a prime number GEQ the specified newSize. |
void |
putHashFBL(int stackIdx,
int x,
int y)
putHashFBL() - put (x,y) into the XY point picture FBL hash table hXYtbl[] and also save the corresponding FBL stack index value in hIdxTbl[]. |
void |
putHashWS(int stackIdx,
int x,
int y)
putHashWS() - put (x,y) into the XY point picture WS hash table hXYtbl[] and also save the corresponding WS stack index value in hIdxTbl[]. |
int |
unpackHashX(int hashValue)
unpackHashX() - extract the X value from the hash XY packed value |
int |
unpackHashY(int hashValue)
unpackHashY() - extract the Y value from the hash XY packed value |
| Methods inherited from class Seg2Dgel.Sg2glb |
|---|
get2D, get2D, getPixLineBuf, getPixLineBuf, initGlb, isDBwindow, isDBwindow, put2Dbuf, resetGlb, set2D, set2D, setPixLineBuf, setPixLineBuf, showReportStatus |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public int sizeHashPrimeDefault
public int sizeHashPrime
private int[] hXYtbl
private int[] hIdxTbl
private Sg2fbl fblHash
private Sg2wrk wrkHash
int[] pixBitMap
| Constructor Detail |
|---|
public Sg2hash()
| Method Detail |
|---|
public final int growHashFBL(Sg2fbl fbl,
int newHashSizeMax)
Sg2fbl - instance of FBL associated with hash tablenewSize - is the minimum size of the hash table.
public final int growHashWS(Sg2wrk wrk,
int newSize)
Sg2wrk - instance of WS associated with hash tablenewSize - is the minimum size of the hash table.
public final int getHashSize()
public final void clearHash()
public final void putHashFBL(int stackIdx,
int x,
int y)
public final void putHashWS(int stackIdx,
int x,
int y)
public final int getHash(int x,
int y)
public final int unpackHashX(int hashValue)
public final int unpackHashY(int hashValue)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||