CmpSpots
Class CmpPair

java.lang.Object
  extended by CmpSpots.Cmpglb
      extended by CmpSpots.CmpPair

public class CmpPair
extends Cmpglb

Class CmpPair does primary pairing of spots for the 2D spot pairing program.

This code was derived and refactored from GELLAB-II cmpgl2 C language files as well as the Open2Dprot Seg2Dgel program.

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/.

Version:
$Date: 2005/10/20 12:20:34 $ $Revision: 1.23 $
Author:
P. Lemkin, NCI-Frederick, Frederick, MD, 21702
See Also:
Open2Dprot Home

Field Summary
 
Fields inherited from class CmpSpots.Cmpglb
acc, accDatabaseFile, accFile, accFormatMode, AP, applicationName, argsV, asgn, banner, bannerTitle, baseImageFileNameRsample, baseImageFileNameSample, batchDir, cacheDir, cmpspotsURL, commutativeLMSswitch, CONSOLE_FLAG, CP, cs, data, DATE, dbLM, dbRsample, dbSample, DBUG_ALL_SSF_SPOTS, DBUG_APPEND, DBUG_ASSIGN_CODES, DBUG_ASSIGN_SSF_TO_LMS, DBUG_COMPUTE_RADII, DBUG_CONSOLE, DBUG_DUMP_LM_SET_SPOTS, DBUG_DUMP_PREFACE_EPILOGUE, DBUG_DUMP_SPF, DBUG_FIND_LMS_IN_SSFS, DBUG_FREE_0200000, DBUG_FREE_04000, DBUG_INITIAL_SPOT_PAIRING, DBUG_PRINT_AT, DBUG_PRINT_FULL_NODE_INFO, DBUG_PRINT_LMS_SET_SPOTS, DBUG_PRINT_LMS_SPOT_MAPPING, DBUG_READ_LANDMARKS, DBUG_READ_SSF_DATA, DBUG_SECONDARY_PAIRING, DBUG_SPECIFIC_SPOTS, DBUG_SWITCH_ANALYSIS, DBUG_SWITCHES, dBugBits, dbugBitsHelpStr, dBugLMsetList, debugSwitch, defaultSwitch, demoFileList, demoSwitch, docFileList, dtdSwitch, EP, fileSeparator, fio, fourSqrtPi, GS, ini, inPixFileRsample, inPixFileSample, inputFormatSwitch, isCsamplePrimeSwitch, jarFileList, jarLibrFileList, landmarkDatabaseFile, latchLandmarkSpotSwitch, legalImageFileExtens, LM, LMSETCOLOR, lmsFile, lmsFormatMode, MAX_LM_LATCH_THR, maxLatchDist, nbrAltLMSSwitch, nDbugLMsetList, NEVER, nlmDB, nSwitches, OPTBKGROUND, osName, pair, pair2ndary, paramH, pix, pix1, pix2, pixFileExtn, PP, ppxDir, pra, projDir, projDirSwitch, propertiesFile, propertiesFileSwitch, ps, PUBLISH, rdbmsDir, REVISION, rRoiDbug, rRoiDbugSwitch, RSAMPLE, rsampleName, rsampleSwitch, SAMPLE, sampleName, sampleSwitch, secondaryPairingSwitch, simplePixFileRsample, simplePixFileSample, sort, SP, spfFormatMode, spfFormatSwitch, spfOutputFile, spfOutputPrefaceFile, SPOTBOXCOLOR, sRoiDbug, sRoiDbugSwitch, ssfFileRsample, ssfFileSample, ssfFormatMode, ssfInputEpilogueFileRsample, ssfInputEpilogueFileSample, ssfInputFileRsample, ssfInputFileSample, ssfInputPrefaceFileRsample, ssfInputPrefaceFileSample, startTime, sw, switchOptCBvalue, switchOptData, switchOptValue, thrPPswitch, thrSPswitch, timerSwitch, tmpDir, updateSwitch, US, usageSwitch, USE_DEMO_DATA, useAccFileSwitch, useHistGUISwitch, useLmsFileSwitch, usePercentDensitySwitch, usePopupGUISwitch, userDir, util, VERSION, xmlDir
 
Constructor Summary
CmpPair()
          CmpPair() - Constructor
 
Method Summary
private  void checkG2unassignedSpots(int k)
          checkG2unassignedSpots() - Convolve LM[k]'s G2 vs.
 void convolveG1G2spots(int k)
          convolveG1G2spots() - convolve (x,y) pairs in list Rsample (G1) with Sample (G2) to find the best possible spot in G2 for each spot in G1.
private  void convolveG1withG2spots(int k)
          convolveG1withG2spots() - convolve (x,y) pairs in list Rsample (G1) with Sample (G2) to find the best best possible spot in G2 for each spot in G1.
 void findLMSinSsfs()
          findLMSinSsfs() - find the landmarks closest to each SSF spot.
private  void findOptLmsSsfSpots()
          findOptLmsSsfSpots() - find best fit for spots corresponding to the LM k by convolving the landmarks DB (x,y)k values with with all spots.
 void initialSpotPairing()
          initialSpotPairing() - do the initial spot pairing LM set by LM set by finding the mutually best fit of each spot in G1 with the LM spots in G2.
private  void latchLMvalidState()
          latchLMvalidState() - copy the (x,y) centroids of the best estimate SSF spots in dbLM.equivLMspotPtr[k][nsample] to dbLM.xlm[k][nsample] for the validLM[] landmarks that are "OK" for use as a better landmark centroid estimate.
private  boolean rmvDupLMvalidState()
          rmvDupLMvalidState() - Test and remove additional duplicate landmarks setting duplicates to dbLM.validLM[k] to "SM"
private  boolean setupLMvalidityCWstate()
          setupLMvalidityCWstate() - setup the landmark validity database.
private  boolean testLatchLMvalidState()
          testLatchLMvalidState() - Test for landmark sets where error distance between landmarks > maxLatchDist, setting landmarks outside of the latch threshold to dbLM.validLM[k] "NL".
 
Methods inherited from class CmpSpots.Cmpglb
get2D, get2D, initGlb, resetGlb, set2D
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmpPair

public CmpPair()
CmpPair() - Constructor

Method Detail

initialSpotPairing

public void initialSpotPairing()
initialSpotPairing() - do the initial spot pairing LM set by LM set by finding the mutually best fit of each spot in G1 with the LM spots in G2. Then reverse the process. Best fit is defined to be the case where a spot in G1 points to a spot in G2 which then points back to the spot in G1.

See Also:
DbLM#cvLMSIdx2Name, Util#appendPRmsg, convolveG1G2spots(int), CmpAssign.assignCodes(int)

findLMSinSsfs

public void findLMSinSsfs()
findLMSinSsfs() - find the landmarks closest to each SSF spot. Then add these spots to the landmark set (LMS) linked list of such spots. Then replace the DL landmark distance (probably 0) with the current value.

See Also:
CmpAssign.getSpotLMSmappingStr(java.lang.String), Util#appendPRmsg, findOptLmsSsfSpots(), latchLMvalidState(), rmvDupLMvalidState(), setupLMvalidityCWstate(), testLatchLMvalidState()

findOptLmsSsfSpots

private void findOptLmsSsfSpots()
findOptLmsSsfSpots() - find best fit for spots corresponding to the LM k by convolving the landmarks DB (x,y)k values with with all spots. This is done for both the Rsample and Sample. This sets up the dbLM.lmErrDist[k][nsample] and dbLM.equivLMspotPtr[k][nsample] structures.


setupLMvalidityCWstate

private boolean setupLMvalidityCWstate()
setupLMvalidityCWstate() - setup the landmark validity database. The landmarks for samples G1 and G2 must be inside of the computing windows for G1 and G2 respectively. This sets dbLM.validLM[] as either "OK" or "NG", and dbLM.useLM[] as true or false.

Returns:
true if all landmarks are inside the computing windows for both the Rsample and Sample

rmvDupLMvalidState

private boolean rmvDupLMvalidState()
rmvDupLMvalidState() - Test and remove additional duplicate landmarks setting duplicates to dbLM.validLM[k] to "SM"

Returns:
true if no duplicate landmarks

testLatchLMvalidState

private boolean testLatchLMvalidState()
testLatchLMvalidState() - Test for landmark sets where error distance between landmarks > maxLatchDist, setting landmarks outside of the latch threshold to dbLM.validLM[k] "NL". This is only applied if latchLandmarkSpotSwitch is true.

Returns:
true if no duplicate landmarks or not latching

latchLMvalidState

private void latchLMvalidState()
latchLMvalidState() - copy the (x,y) centroids of the best estimate SSF spots in dbLM.equivLMspotPtr[k][nsample] to dbLM.xlm[k][nsample] for the validLM[] landmarks that are "OK" for use as a better landmark centroid estimate. This is only done if latchLandmarkSpotSwitch is enabled.


convolveG1G2spots

public void convolveG1G2spots(int k)
convolveG1G2spots() - convolve (x,y) pairs in list Rsample (G1) with Sample (G2) to find the best possible spot in G2 for each spot in G1. Note spots left over in G2 will later get US labels. Then check G2 spots which have no best fit spot in G1 and assign them one. Note: all spots get best paired spots in the other sample - even if it is a poor pair. The mutual pairing is done here.
Variables g1Ptr, g2Ptr point to the G1, G2 LM sets currently being processed. The xOffset and yOffset are the coordinate system difference between the LM k for G1 and G2.

Parameters:
k - is the landmark being convolved.
See Also:
DbLM#cvLMSIdx2Name, DbLM#getDumpLMsetSpotsStr, Util#appendPRmsg, convolveG1withG2spots(int), checkG2unassignedSpots(int)

convolveG1withG2spots

private void convolveG1withG2spots(int k)
convolveG1withG2spots() - convolve (x,y) pairs in list Rsample (G1) with Sample (G2) to find the best best possible spot in G2 for each spot in G1. Note spots left over in G2 will get US labels. Then check G2 spots which have no best fit spot in G1 and assign them one. The initial pairing is done here.
Variables g1Ptr, g2Ptr point to the G1, G2 LM sets currently being processed. The xOffset and yOffset are the coordinate system difference between the LM k for G1 and G2.

Parameters:
k - is the landmark being convolved in range [0:nlandmarks-1]
See Also:
DbLM#cvLMSIdx2Name, DbLM#getDumpLMsetSpotsStr, Util#appendPRmsg

checkG2unassignedSpots

private void checkG2unassignedSpots(int k)
checkG2unassignedSpots() - Convolve LM[k]'s G2 vs. G1 spots for which G2 spots have no best paired spot in G1. Rsample (G1) with Sample (G2). This checks G2 spots that have no best fit spot in G1 and assign them a US label. Initial pairing is done here.
Variables g1Ptr, g2Ptr point to the G1, G2 LM sets currently being processed. The xOffset and yOffset are the coordinate system difference between the LM k for G1 and G2.

Parameters:
k - is the landmark being convolved.
See Also:
DbLM#cvLMSIdx2Name