O2Plib.db
Class DbSpot

java.lang.Object
  extended by O2Plib.db.DbBaseSpot
      extended by O2Plib.db.DbSpot

public class DbSpot
extends DbBaseSpot

Class DbSpot supports a spot data structure for spot features in Open2Dprot programs. It contains data for a single spot. There are a number of optional fields that may be used depending on the application. Note this class extends DbBaseSpot.

 1. In applications where paired spots are used (CSD DB programs),
    the Rsample, landmark and paired spot related features are used.
 2. The spot boundary is optional depending on the application.
 3. The statistical features to represent a composite sample are
    optional depending on the application (CSD DB data mining).
 4. Composite Cspots are statistical representations of a set of
    corresponding spots from replicate samples. These fields
    are optional (CSD DB data mining).
This file is derived from GELLAB-II cmpgl2.c as of "Version November 9, 1999" with major refactoring for use in Open2Dprot.

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/21 16:01:38 $ $Revision: 1.35 $
Author:
P. Lemkin, NCI-Frederick, Frederick, MD, 21702

Field Summary
 int[] altLMset
          Sorted list of next nearest LM sets [0:nbrAltLMs-1] to this spot
 float[] altLMsetDistSq
          corresponding distances of next nearest landmarks [0:nbrAltLMs-1]
 int area
          spot area in pixels
 DbSpot bestPairedSpot
          ptr to best paired spot for spot-pairing, if not null
 DbBoundary bnd
          Spot boundary for the CC if used
 int ccNumber
          Spot connected component number (CC#) from spot list .
 int ccRsampleIdx
          [DEPRICATE] Seg2Dgel CC# index for Rsample spot
 int ccSampleIdx
          [DEPRICATE] Seg2Dgel CC# index for Rsample spot
 float density
          Note: store the various density modes in the same array! This could be selected from (densityPrime, %density, volume).
 float densityPct
          percent spot density
 float densityPrime
          density' is density corrected for background and is computed as (density - mnBackground*area).
 int dLx
          relative X distance from Rsample spot to LM
 int dLy
          relative Y distance from Rsample spot to LM
 float dMax
          spot MAX OD
 float dMin
          spot MIN OD
 boolean extrapolatedFlag
          set if spot is an extrapolated EP spot.
 boolean lmFlag
          set true if spot is a landmark spot
static int maxNbrAltLMs
          Maximum # of alternate paired landmarks (N3).
 int merx1
          Spot minimum enclosing rectangle x1 in pixel coordinates
 int merx2
          Spot minimum enclosing rectangle x2 in pixel coordinates
 int mery1
          Spot minimum enclosing rectangle y1 in pixel coordinates
 int mery2
          Spot minimum enclosing rectangle y2 in pixel coordinates
 float mnBackground
          spot mean background density in calibrated OD if available.
 int mnBkgrdGrayvalue
          spot mean background grayvalue
 float mnDensity
          mean spot density
 int nbrAltLMs
          The # of alternate paired landmarks for this spot.
 int nCsample
          # of samples in Cspot Csample' estimate if not 0.
 DbSpot nextLMspot
          ptr to Next LM-set spot if not null
 DbSpot nextSpot
          ptr to Next spot instance in spot list if not null
 DbSpot prevSpot
          ptr to Previous spot instance in spot list if not null
 DbSpot rSpotNext
          Next instance for CSD database Rspot linked list
 float sdArea
          Csample' S.D.
 float sdDprime
          Csample' S.D.
 float sdXcentroid
          Csample' S.D.
 float sdYcentroid
          Csample' S.D.
 java.lang.String spotBoundaryStr
          spot boundary string if using boundaries
 float sx
          spot size weight mean std dev
 float sxy
          spot size weight mean std dev
 float sy
          spot size weight mean std dev
static java.lang.String VERSION
          Version for this module
 float volume
          percent spot volume
 float xMom
          spot X density weighted centroid
 int[] xyList
          List of all packed (x<<16 | y) 16-bit pixel coordinates in the spot which is updated by the particular application - optional.
 float yMom
          spot Y density weighted centroid
 
Fields inherited from class O2Plib.db.DbBaseSpot
AP, APCOLOR, BF_DISPLAY_SPOT, BF_FAILED_SXSYR1RANGE, BF_FAILED_SXSYR2RANGE, BF_FAILED_T1AREA, BF_FAILED_T1DENSITY, BF_FAILED_T1DENSRANGE, BF_FAILED_T2AREA, BF_FAILED_T2DENSITY, BF_FAILED_T2DENSRANGE, BF_ISVALIDSPOT, bitFeatures, code, CP, CPCOLOR, dbRsample, dbSample, dL, dP, EP, EPCOLOR, GS, idxRsample, idxSample, LM, LMCOLOR, lmNbrI, lmNbrS, LMSETCOLOR, MAX_SPOT_SUBLIST_SIZE, nSample, PP, PPCOLOR, RSAMPLE, RSPOTCOLOR, SAMPLE, SP, SPCOLOR, SPOT_FEATURE_AREA, SPOT_FEATURE_DENS_PCT, SPOT_FEATURE_DENS_PRIME, SPOT_FEATURE_DENSITY, SPOT_FEATURE_MAX_DENS, SPOT_FEATURE_MEAN_DENSITY, SPOT_FEATURE_MIN_DENS, SPOT_FEATURE_VOLUME, SPOTBOXCOLOR, spotNumber, swappedRsampleAndSampleFlag, US, USCOLOR
 
Constructor Summary
DbSpot()
          DbSpot() - Constructor for new DbSpot.
DbSpot(DbSample dbSample)
          DbSpot() - Constructor for new DbSpot.
DbSpot(DbSample dbRsample, DbSample dbSample)
          DbSpot() - Constructor for new DbSpot.
DbSpot(DbSample dbRsample, DbSample dbSample, int maxNbrAltLandmark)
          DbSpot() - Constructor for new DbSpot.
DbSpot(DbSample dbSample, int maxNbrAltLandmark)
          DbSpot() - Constructor for new DbSpot.
 
Method Summary
 boolean copyValues(DbSpot sp, boolean copyPointersFlag)
          copyValues() - copy values in spot sp into this spot.
 void createAltLMset(int maximumAltLMs)
          createAltLMset() - create alternate landmark set for this spot.
 java.lang.String cvPrettyPrintSpot()
          cvPrettyPrintSpot() - pretty print a spot if it exists else return "Null".
static java.lang.String cvSpotToPrettyPrintListStr(DbSpot p1, boolean addSubPairListFlag)
          cvSpotToPrettyPrintListStr() - get the pretty-print features of the specified spot and its pair spot if it is paired.
static java.lang.String cvSpotToPrettyPrintListStr(DbSpot p1, boolean addSubPairListFlag, boolean addCCnbrFlag)
          cvSpotToPrettyPrintListStr() - get the pretty-print features of the specified spot and its pair spot if it is paired.
static java.lang.String cvSpotToPrintStr(DbSpot p1, int spotFormatToUse)
          cvSpotToPrintStr() - Debugging print the features of the specified spot and print its paired spot features if it is paired.
static java.lang.String cvSpotToPrintStr(DbSpot p1, int spotFormatToUse, boolean addCCdataFlag)
          cvSpotToPrintStr() - Debugging print the features of the specified spot and print its paired spot features if it is paired.
static java.lang.String getAllSSFspotsStr(java.lang.String title, DbSample dbS, int[] filterByLMsets)
          getAllSSFspotsStr() - get the printable list of all spots the specified sample..
 java.lang.String getAltLMsetStr()
          getAltLMsetStr() - create an alternate landmark set list string for this spot.
static java.lang.String getPrettyPrintSpotStr(DbSpot p1)
          getPrettyPrintSpotStr() - get the pretty-print spot features of specified
static java.lang.String getPrettyPrintSpotStr(DbSpot p1, boolean addCCnbrFlag)
          getPrettyPrintSpotStr() - get the pretty-print spot features of specified
static DbSpot[] getSubListSpotsPairedWithThisSpot(DbSpot spot, int maxSublistSize)
          getSubListSpotsPairedWithThisSpot() - get a sublist of spots (in the other sample) that are paired with this spot.
 void setDbSamples(DbSample dbRsample, DbSample dbSample)
          setDbSamples() - set the dbRsample and dbSample objects for this spot.
static void setNbrAltLMsize(int maxNbrAltLandmark)
          setNbrAltLMsize() - set the default maximum # of alternate paired landmarks all spots in the database could belong to.
 java.lang.String toString()
          toString() - print SSF features of the spot.
 
Methods inherited from class O2Plib.db.DbBaseSpot
copyBaseValues, copyRsampleToSampleBaseValues, swapBaseValues, verifyNotCircularSSFlist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
Version for this module

See Also:
Constant Field Values

ccNumber

public int ccNumber
Spot connected component number (CC#) from spot list . Value -1 means no number.


area

public int area
spot area in pixels


density

public float density
Note: store the various density modes in the same array! This could be selected from (densityPrime, %density, volume).


densityPrime

public float densityPrime
density' is density corrected for background and is computed as (density - mnBackground*area).


densityPct

public float densityPct
percent spot density


volume

public float volume
percent spot volume


dMax

public float dMax
spot MAX OD


dMin

public float dMin
spot MIN OD


mnBkgrdGrayvalue

public int mnBkgrdGrayvalue
spot mean background grayvalue


mnBackground

public float mnBackground
spot mean background density in calibrated OD if available.


mnDensity

public float mnDensity
mean spot density


xMom

public float xMom
spot X density weighted centroid


yMom

public float yMom
spot Y density weighted centroid


sx

public float sx
spot size weight mean std dev


sy

public float sy
spot size weight mean std dev


sxy

public float sxy
spot size weight mean std dev


spotBoundaryStr

public java.lang.String spotBoundaryStr
spot boundary string if using boundaries


merx1

public int merx1
Spot minimum enclosing rectangle x1 in pixel coordinates


merx2

public int merx2
Spot minimum enclosing rectangle x2 in pixel coordinates


mery1

public int mery1
Spot minimum enclosing rectangle y1 in pixel coordinates


mery2

public int mery2
Spot minimum enclosing rectangle y2 in pixel coordinates


xyList

public int[] xyList
List of all packed (x<<16 | y) 16-bit pixel coordinates in the spot which is updated by the particular application - optional.


bnd

public DbBoundary bnd
Spot boundary for the CC if used


maxNbrAltLMs

public static int maxNbrAltLMs
Maximum # of alternate paired landmarks (N3). This may be changed by the user.


nbrAltLMs

public int nbrAltLMs
The # of alternate paired landmarks for this spot.


altLMset

public int[] altLMset
Sorted list of next nearest LM sets [0:nbrAltLMs-1] to this spot


altLMsetDistSq

public float[] altLMsetDistSq
corresponding distances of next nearest landmarks [0:nbrAltLMs-1]


nCsample

public int nCsample
# of samples in Cspot Csample' estimate if not 0. It can also be 1 which indicates that there is no Cspot.


sdXcentroid

public float sdXcentroid
Csample' S.D. of means


sdYcentroid

public float sdYcentroid
Csample' S.D. of means


sdDprime

public float sdDprime
Csample' S.D. of means


sdArea

public float sdArea
Csample' S.D. of means


dLx

public int dLx
relative X distance from Rsample spot to LM


dLy

public int dLy
relative Y distance from Rsample spot to LM


lmFlag

public boolean lmFlag
set true if spot is a landmark spot


extrapolatedFlag

public boolean extrapolatedFlag
set if spot is an extrapolated EP spot. [CHECK] is this redundent with (code==EP)?


ccRsampleIdx

public int ccRsampleIdx
[DEPRICATE] Seg2Dgel CC# index for Rsample spot


ccSampleIdx

public int ccSampleIdx
[DEPRICATE] Seg2Dgel CC# index for Rsample spot


prevSpot

public DbSpot prevSpot
ptr to Previous spot instance in spot list if not null


nextSpot

public DbSpot nextSpot
ptr to Next spot instance in spot list if not null


nextLMspot

public DbSpot nextLMspot
ptr to Next LM-set spot if not null


bestPairedSpot

public DbSpot bestPairedSpot
ptr to best paired spot for spot-pairing, if not null


rSpotNext

public DbSpot rSpotNext
Next instance for CSD database Rspot linked list

Constructor Detail

DbSpot

public DbSpot(DbSample dbSample,
              int maxNbrAltLandmark)
DbSpot() - Constructor for new DbSpot. Set the default # of alternate paired landmarks (N3). All other fields default to null or zero.

Parameters:
dbSample - for this spot
maxNbrAltLandmark - - max # of alternative landmark sets this spot could belong to.

DbSpot

public DbSpot(DbSample dbRsample,
              DbSample dbSample,
              int maxNbrAltLandmark)
DbSpot() - Constructor for new DbSpot. Set the default # of alternate paired landmarks (N3). All other fields default to null or zero.

Parameters:
dbRsample - is sample for pairing with this spot
dbSample - for this spot
maxNbrAltLandmark - - max # of alternative landmark sets this spot could belong to.

DbSpot

public DbSpot(DbSample dbRsample,
              DbSample dbSample)
DbSpot() - Constructor for new DbSpot. All other fields default to null or zero.

Parameters:
dbRsample - is sample for pairing with this spot
dbSample - for this spot

DbSpot

public DbSpot(DbSample dbSample)
DbSpot() - Constructor for new DbSpot. All other fields default to null or zero.

Parameters:
dbSample - for this spot

DbSpot

public DbSpot()
DbSpot() - Constructor for new DbSpot. All other fields default to null or zero.

Method Detail

createAltLMset

public void createAltLMset(int maximumAltLMs)
createAltLMset() - create alternate landmark set for this spot.

Parameters:
maximumAltLMs - - set the size of the alternate landmark list

setDbSamples

public void setDbSamples(DbSample dbRsample,
                         DbSample dbSample)
setDbSamples() - set the dbRsample and dbSample objects for this spot.

Overrides:
setDbSamples in class DbBaseSpot
Parameters:
dbRsample - is sample for pairing with this spot
dbSample - for this spot

setNbrAltLMsize

public static void setNbrAltLMsize(int maxNbrAltLandmark)
setNbrAltLMsize() - set the default maximum # of alternate paired landmarks all spots in the database could belong to. Do NOT resize existing spot arrays. Do that separately if required.

Parameters:
maxNbrAltLandmark - - max # of alternative landmark sets this spot could belong to.

copyValues

public boolean copyValues(DbSpot sp,
                          boolean copyPointersFlag)
copyValues() - copy values in spot sp into this spot. Note: copy arrays or string objects by reference

Parameters:
sp - is spot
copyPointersFlag - to copy spot pointers as well
Returns:
true if succeed.

getSubListSpotsPairedWithThisSpot

public static DbSpot[] getSubListSpotsPairedWithThisSpot(DbSpot spot,
                                                         int maxSublistSize)
getSubListSpotsPairedWithThisSpot() - get a sublist of spots (in the other sample) that are paired with this spot.

Parameters:
p - is DbSpot pointer to list of spots
Returns:
true if the list is Circular, false if it is not and is OK.

getAltLMsetStr

public java.lang.String getAltLMsetStr()
getAltLMsetStr() - create an alternate landmark set list string for this spot. The list is sorted by the distances also included in the string in (...). Example,
  "B(35) E(42) G(62)"

Returns:
nearest landmark print string - does not include its landmark

getPrettyPrintSpotStr

public static java.lang.String getPrettyPrintSpotStr(DbSpot p1)
getPrettyPrintSpotStr() - get the pretty-print spot features of specified

Parameters:
p1 - is spot to print and includ ccNumber data
Returns:
print string or null if bad spot.

getPrettyPrintSpotStr

public static java.lang.String getPrettyPrintSpotStr(DbSpot p1,
                                                     boolean addCCnbrFlag)
getPrettyPrintSpotStr() - get the pretty-print spot features of specified

Parameters:
p1 - is spot to print
Returns:
print string or null if bad spot.

cvSpotToPrettyPrintListStr

public static java.lang.String cvSpotToPrettyPrintListStr(DbSpot p1,
                                                          boolean addSubPairListFlag)
cvSpotToPrettyPrintListStr() - get the pretty-print features of the specified spot and its pair spot if it is paired. Note: Show the spotNumber as well as the ccNumber.

Parameters:
p1 - is spot print and include ccNumber data
addSubPairListFlag - get all AP spots paired to either spots of main pair.
Returns:
print string or null if bad spot.

cvSpotToPrettyPrintListStr

public static java.lang.String cvSpotToPrettyPrintListStr(DbSpot p1,
                                                          boolean addSubPairListFlag,
                                                          boolean addCCnbrFlag)
cvSpotToPrettyPrintListStr() - get the pretty-print features of the specified spot and its pair spot if it is paired. Note: Show the spotNumber as well as the ccNumber.

Parameters:
p1 - is spot print
addSubPairListFlag - get all AP spots paired to either spots of main pair.
Returns:
print string or null if bad spot.

cvSpotToPrintStr

public static java.lang.String cvSpotToPrintStr(DbSpot p1,
                                                int spotFormatToUse)
cvSpotToPrintStr() - Debugging print the features of the specified spot and print its paired spot features if it is paired.

Parameters:
p1 - is spot print, include CC number data
spotFormatToUse - (IO_FORMAT_xxxx)
Returns:
print string or null if bad spot.

cvSpotToPrintStr

public static java.lang.String cvSpotToPrintStr(DbSpot p1,
                                                int spotFormatToUse,
                                                boolean addCCdataFlag)
cvSpotToPrintStr() - Debugging print the features of the specified spot and print its paired spot features if it is paired.

Parameters:
p1 - is spot print
spotFormatToUse - (IO_FORMAT_xxxx)
addCCdataFlag - to add CC number data
Returns:
print string or null if bad spot.

toString

public java.lang.String toString()
toString() - print SSF features of the spot.

Overrides:
toString in class java.lang.Object
Parameters:
r - is DbSpot to convert to a string
Returns:
converted string else "***NULL***" if bad spot.

cvPrettyPrintSpot

public java.lang.String cvPrettyPrintSpot()
cvPrettyPrintSpot() - pretty print a spot if it exists else return "Null".

Parameters:
q - is the spot to use
Returns:
prettyprint version of spot

getAllSSFspotsStr

public static java.lang.String getAllSSFspotsStr(java.lang.String title,
                                                 DbSample dbS,
                                                 int[] filterByLMsets)
getAllSSFspotsStr() - get the printable list of all spots the specified sample.. If any filters are used, then only use if spot's lmSet is in the set.
 E.g., 
   . . .
 Rsample spot list
 Rsample spot# 1 (xMom,yMom)=(223,321) LM[A] ltLMs={B(6) C(12) P(37} \
                 bpSpt#=354 nxtLMspt#=36 nxtSpt#=2
 Rsample spot# 2 (xMom,yMom)=(243,361) LM[A] ltLMs={B(8) C(11) P(35} \
                 bpSpt#=642 nxtLMspt#=38 nxtSpt#=3
            . . .    

Parameters:
title - if not null
dbS - is the sample to list all spots
filterByLMsets - of landmark sets to filter spots (if not null).
Returns:
report string