CmpSpots
Class CmpPairSecondary

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

public class CmpPairSecondary
extends Cmpglb

Class CmpPairSecondary does secondary spot pairing for the 2D spot pairing program. This code supports additional improvements to the initial pairing by testing AP and US spots to see if they could pair better with AP or US spots in adjacent (i.e., nearest-neighbor) landmark sets. If a spots would pair better, it is moved to that landmark set and re-paired. The statistics are updated to reflect this.

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.24 $
Author:
P. Lemkin, NCI-Frederick, Frederick, MD, 21702
See Also:
Open2Dprot Home

Nested Class Summary
(package private)  class CmpPairSecondary.OptimizedPair
          Used for passing data on current optimized pair of spots
 
Field Summary
private static boolean NOT_NEEDED_WITH_MULT_LANDMARKS
           
 
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
CmpPairSecondary()
          CmpPairSecondary() - Constructor
 
Method Summary
private  DbSpot findBetterAltPairedSpot(CmpPairSecondary.OptimizedPair op)
          findBetterAltPairedSpot() - look for better matching landmark set for the p1 spot with a US or AP label in otherSample such that the dP for the new pair is better than the current dP.
private  DbSpot findOptNNspot(CmpPairSecondary.OptimizedPair op)
          findBetterAltPairedSpot() - look for better match kAlt in otherSample the dP for the new pair must be better than the old.
private  void rePairSpotsInAltLMset(CmpPairSecondary.OptimizedPair op)
          rePairSpotsInAltLMset() - move Gi spot in LM[k] to LM[kAlt] by adjusting pointers and also adjust pairing statistics.
 void secondarySpotPairing()
          secondarySpotPairing() - reanalyze & try to re-pair (US,AP) with adj LM sets.
 
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
 

Field Detail

NOT_NEEDED_WITH_MULT_LANDMARKS

private static final boolean NOT_NEEDED_WITH_MULT_LANDMARKS
See Also:
Constant Field Values
Constructor Detail

CmpPairSecondary

public CmpPairSecondary()
CmpPairSecondary() - Constructor

Method Detail

secondarySpotPairing

public void secondarySpotPairing()
secondarySpotPairing() - reanalyze & try to re-pair (US,AP) with adj LM sets. Look for AP or US in each LMi set and try to resolve them with the next nearest neighbor LM sets.
 I.e. promote for (Rsample,Sample):
          (US, US) or (AP, US) or (US, AP) or (AP, AP)
     to   (SP, SP) or (PP, PP).
 In the FUTURE may add code to promote
          (US,{SP,PP}) or ({SP,PP}, US)
     to   (AP,{SP,PP}) or ({SP,PP}, AP).
For all LM k which are valid search each spot in LM set k in both G1 and G2 which is either US or AP. For each such spot, search the valid alternative LM set k' for a dP and dL which would make that spot a SP or PP. If one is found, then move the spot from LM k set to LM k' and change the code accordingly. Also update the landmark sets that the spot is in.

Note: circa 1982 - A suggestion by Bob Conner/NCI - not implemented but should be investigated because of its consequences: Use PPs in secondary pairing as well as US and APs. If this were done, then would have to relabel the PP's previous partner (possibly using relaxation techniques).

See Also:
CmpAssign.getSpotLMSmappingStr(java.lang.String), DbLM#cvLMSIdx2Name, DbLM#getDumpLMsetSpotsStr, Util#appendPRmsg, findBetterAltPairedSpot(CmpSpots.CmpPairSecondary.OptimizedPair)

findBetterAltPairedSpot

private DbSpot findBetterAltPairedSpot(CmpPairSecondary.OptimizedPair op)
findBetterAltPairedSpot() - look for better matching landmark set for the p1 spot with a US or AP label in otherSample such that the dP for the new pair is better than the current dP. Note: we do NOT try to re-pair p1 spots with SP or PP labels.

Parameters:
op - is the optimized pair object used for passing data on the current optimized pair of spots
Returns:
pKoptimal if found better paired spot in another LM set.
See Also:
findOptNNspot(CmpSpots.CmpPairSecondary.OptimizedPair), rePairSpotsInAltLMset(CmpSpots.CmpPairSecondary.OptimizedPair)

rePairSpotsInAltLMset

private void rePairSpotsInAltLMset(CmpPairSecondary.OptimizedPair op)
rePairSpotsInAltLMset() - move Gi spot in LM[k] to LM[kAlt] by adjusting pointers and also adjust pairing statistics.

Parameters:
op - is the optimized pair object used for passing data on the current optimized pair of spots

findOptNNspot

private DbSpot findOptNNspot(CmpPairSecondary.OptimizedPair op)
findBetterAltPairedSpot() - look for better match kAlt in otherSample the dP for the new pair must be better than the old.

Parameters:
op - is the optimized pair object used for passing data on the current optimized pair of spots
Returns:
pKoptimal if found spot in kAlt, else null if none.