Seg2Dgel
Class Sg2cc

java.lang.Object
  extended by Seg2Dgel.Sg2glb
      extended by Seg2Dgel.Sg2cc

public class Sg2cc
extends Sg2glb

Class Sg2cc computes the pixel neighborhood central core (CC) for the 2D Gel Spot Segmenter from the averaged image (pix4).

 
 This computes two images (see Sg2glb.XXXX_CODE):
   pix3 which is the central core coded image
 and 
   pix2 which is the magnitude of the laplacian (or a monotonic 
        function corresponding to this magnitude).

 The filters used are determined by the command line switches.

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

Version:
$Date: 2005/10/15 21:48:11 $ $Revision: 1.13 $
Author:
P. Lemkin, NCI-Frederick, Frederick, MD, 21702
See Also:
Open2Dprot Home

Field Summary
static int nthCCImgCtr
          # of current CC image being dumped
private static int[] tmpB
          Tmp array used in buffer swapping
private static boolean useEuclideanNormFlag
          use either Euclidian else city-block norm
private static int xOffset
          Horizontal offset for convolution.
private static int yOffset
          Vertical offset for convolution.
 
Fields inherited from class Seg2Dgel.Sg2glb
acc, accDatabaseFile, accDatabaseSwitch, accFile, accFormatMode, allowTouchingEdgesSwitch, applicationName, argsV, averageODSwitch, avg, avgPixFile, banner, bannerTitle, baseImageFileName, baseStatusTime, batchDir, bfav, bfavm, bfavm1, bfavp, bfavp1, bfog, bfogm, bfogm1, bfogm2, bfogm3, bfogm4, bfogm5, bfogp, bfogp1, bfogp2, bfogp3, bfogp4, bfogp5, bkg, BKGRD_CODE, bkgrdCorrectionSwitch, bkgrdPixFile, bkgrdSizeFlag, BLACK, boundaryInSSFSwitch, bufbkg, bufcc, bufmag, bufrest, c11, c12, c13, c14, c15, c16, c17, c18, c19, c1a, c1b, c1c, c1d, c1e, c1f, c1g, c1h, c21, c22, c23, c24, c25, c26, c27, c28, c29, c2a, c2b, c2c, c2d, c2e, c2f, c2g, c2h, c31, c32, c33, c34, c35, c36, c37, c38, c39, c3a, c3b, c3c, c3d, c3e, c3f, c3g, c3h, c41, c42, c43, c44, c45, c46, c47, c48, c49, c4a, c4b, c4c, c4d, c4e, c4f, c4g, c4h, c51, c52, c53, c54, c55, c56, c57, c58, c59, c5a, c5b, c5c, c5d, c5e, c5f, c5g, c5h, c61, c62, c63, c64, c65, c66, c67, c68, c69, c6a, c6b, c6c, c6d, c6e, c6f, c6g, c6h, c71, c72, c73, c74, c75, c76, c77, c78, c79, c7a, c7b, c7c, c7d, c7e, c7f, c7g, c7h, c81, c82, c83, c84, c85, c86, c87, c88, c89, c8a, c8b, c8c, c8d, c8e, c8f, c8g, c8h, c91, c92, c93, c94, c95, c96, c97, c98, c99, c9a, c9b, c9c, c9d, c9e, c9f, c9g, c9h, ca1, ca2, ca3, ca4, ca5, ca6, ca7, ca8, ca9, caa, cab, cac, cacheDir, cad, cae, caf, cag, cah, cal, cal2gray, calFile, cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9, cba, cbb, cbc, cbd, cbe, cbf, cbg, cbh, cc, cc1, cc2, cc3, cc4, cc5, cc6, cc7, cc8, cc9, cca, ccb, ccc, ccd, cce, ccf, ccg, cch, ccMinSize, ccMinSizeSwitch, ccNum, ccPixFile, cd1, cd2, cd3, cd4, cd5, cd6, cd7, cd8, cd9, cda, cdb, cdc, cdd, cde, cdf, cdg, cdh, computingWindowSwitch, coneOfSilenceMode, CONSOLE_FLAG, ctlCorePixSwitch, cwx1, cwx2, cwy1, cwy2, data, DATE, dbSample, dbSpot, dbug, DBUG_ADD_INTERIOR_CC_PIXELS, DBUG_BND_ANALYSIS, DBUG_CALC_FEATURES, DBUG_CHAIN_CODE_RLM_ANALYSIS, DBUG_CONSOLE, DBUG_CVT_BND_TO_CHAINCODE, DBUG_DRAW_NOTCH_PAIR_LINE, DBUG_DRAW_SAT_SPOT_BND, DBUG_DUMP_CC_PPX, DBUG_FILL_CORNERS, DBUG_FILL_HOLES_IN_PCC_CONCAVITIES, DBUG_FIND_BND_NOTCHES_IN_CHAIN_CODE, DBUG_FIND_SPOT_LIST, DBUG_INNER_LOOP_FIND_SPOT, DBUG_MAX_PROPAGATE, DBUG_NBR_COMPONENTS, DBUG_PIX_DBCODE, DBUG_PRINT_GRAY2CAL_MAP, DBUG_PROP_SAT_SPOTS, DBUG_PROP_SPOT_TO_2ND_MAXIMA, DBUG_PUSH_XY_INTO_FBL, DBUG_RMV_CONCAVITIES, DBUG_RMV_INTERIOR_CC_PIXELS, DBUG_ROUND_CORNERS, DBUG_SPLIT_CHECK_SPOT, DBUG_SPLIT_PIX_BY_FBL_BND_ANALSIS, DBUG_SWITCHES, dbugBits, dbugBitsHelpStr, dbugBitsPixFlag, dbx1, dbx2, dby1, dby2, debugSwitch, defaultSwitch, defaultTypeCode, deleteIsolatedPixelsSwitch, demoFileList, demoSwitch, DFT_2D_GEL, DFT_2D_LC_MS, DFT_NO_DB, didPropSaturatedSpots, didSplitSpotFlag, diffODSwitch, docFileList, dotsSwitch, dpx1, dpx2, dpy1, dpy2, draw, drawBoundaryOverlayType, drawBoundarySwitch, drawDotOverlayType, drawMEROverlayType, drawMERSwitch, drawPlusOverlayType, drawPlusSwitch, drawSxSyEllipseSwitch, drawSxSyOverlayType, drawTitleSwitch, dtdSwitch, ENABLE_DEVELOPER_DEBUGGING, ENABLE_SATURATED_SPOTS, ENABLE_SPOT_SPLITTING, fbl, fileSeparator, fio, fnd, fourSqrtPi, gHist, glbPercentThr, gray2cal, gridSize, hashFBL, HASHFBLPRIME, hashWS, histThreshold, i0R, i10, i11, i12, i13, i14, i15, i16, i17, i18, i2U, i4L, i6D, ini, inPixFile, ISOLATED_PIXEL_CODE, j11, j12, j13, j14, j15, j16, j17, j18, j19, j1a, j1b, j1c, j1d, j1e, j1f, j1g, j1h, j21, j22, j23, j24, j25, j26, j27, j28, j29, j2a, j2b, j2c, j2d, j2e, j2f, j2g, j2h, j31, j32, j33, j34, j35, j36, j37, j38, j39, j3a, j3b, j3c, j3d, j3e, j3f, j3g, j3h, j41, j42, j43, j44, j45, j46, j47, j48, j49, j4a, j4b, j4c, j4d, j4e, j4f, j4g, j4h, j51, j52, j53, j54, j55, j56, j57, j58, j59, j5a, j5b, j5c, j5d, j5e, j5f, j5g, j5h, j61, j62, j63, j64, j65, j66, j67, j68, j69, j6a, j6b, j6c, j6d, j6e, j6f, j6g, j6h, j71, j72, j73, j74, j75, j76, j77, j78, j79, j7a, j7b, j7c, j7d, j7e, j7f, j7g, j7h, j81, j82, j83, j84, j85, j86, j87, j88, j89, j8a, j8b, j8c, j8d, j8e, j8f, j8g, j8h, j91, j92, j93, j94, j95, j96, j97, j98, j99, j9a, j9b, j9c, j9d, j9e, j9f, j9g, j9h, ja1, ja2, ja3, ja4, ja5, ja6, ja7, ja8, ja9, jaa, jab, jac, jad, jae, jaf, jag, jah, jarFileList, jarLibrFileList, jb1, jb2, jb3, jb4, jb5, jb6, jb7, jb8, jb9, jba, jbb, jbc, jbd, jbe, jbf, jbg, jbh, jc1, jc2, jc3, jc4, jc5, jc6, jc7, jc8, jc9, jca, jcb, jcc, jcd, jce, jcf, jcg, jch, jd1, jd2, jd3, jd4, jd5, jd6, jd7, jd8, jd9, jda, jdb, jdc, jdd, jde, jdf, jdg, jdh, keepInputImageSwitch, KILL_SPOT_CODE, killSpotColor, laplacianSwitch, legalImageFileExtens, lineLaplacianHeight, lineLaplacianWidth, lowPassSize, lowpassSwitch, lp13xZZSwitch, lp3x3Switch, lp5x5Switch, lp7x7Switch, mag2ndPixFile, MAX_BUFFERED_SPOTS, MAX_CC_CODE, MAX_INTERIOR_FBL_SIZE, MAX_PCC_CODE, maxColsToPrint, maxGhist, maxGrayPixel, MAXSUBSPOTS, meanGhist, merx1, merx2, merxp1, merxp2, mery1, mery2, meryp1, meryp2, MHISTSIZE, MIN_CC_CODE, MIN_PCC_CODE, MINBLOBAREA, minGhist, MINSPLITSPOTSIZE, nBitsPerPixel, nBkgrdSize, nBytesPerPixel, NEVER, ngh, notch, nPixels, nStatusName, nSwitches, optimizeInteriorFBLSwitch, osName, paramH, PCC_BASE_CODE, pix, pix1, pix2, pix3, pix4, pix5, pix6, pix7, pixDir, pixDumpSwitch, pixelSizeMicrons, pixFileExtn, pixHeight, pixWidth, ppxDir, pra, projDir, projDirSwitch, propertiesFile, propertiesFileSwitch, pTileGhist, PUBLISH, quickEstimateSwitch, rdbmsDir, rest, restOfPixFile, restOfPixSwitch, REVISION, rlmCWfile, rmvDprimeSizingSwitch, sampleSwitch, sat, saturatedSpotSwitch, scaledMaxOD, seg2dgelURL, segPixFile, segPixSwitch, sg2, simpleFileName, sizeFractionGaussianWidth, sort, split, splitLargeCCfblByBndAnalSwitch, splitLargeCCfblByRLManalSwitch, splitLargeCCfblByThreshAnalSwitch, splitMinCCsize, splitSpotSwitch, spotNumber, ssfFormatMode, ssfFormatSwitch, ssfOutputEpilogueFile, ssfOutputFile, ssfOutputPrefaceFile, startTime, statusMemoryFree, statusMemoryTot, statusName, statusStartTime, sw, switchOptCBvalue, switchOptData, switchOptValue, t1Area, t1Density, t1Range, t1SxSyRatio, t2Area, t2Density, t2Range, t2SxSyRatio, TEST_LARGE_IMAGE, thrAreaSwitch, thrDensitySwitch, thrRangeSwitch, thrSxSyRatioSwitch, timerSwitch, tmpDir, UNLABELED_CC_CODE, updateSwitch, usageSwitch, USE_13X13, USE_BKGD_AND_ISOLATED_PIXEL_BACKGROUND, USE_DEMO_DATA, USE_DOM_XML_SSF, use3x3laplacianSwitch, use5x5laplacianSwitch, useBkgdAndIsolatedPixelFlag, useBusseLaplacianSwitch, useCopyOfPix1ForPix5Switch, useHistGUISwitch, useHorizLineLaplacianSwitch, usePopupGUISwitch, userDir, useVertLineLaplacianSwitch, util, VERSION, WHITE, widthWindmp, windmpStepSize, wrk, wXsize, wYsize, xDbug, xmlDir, xPentrance, xPexit, yDbug, yPentrance, yPexit, yTitle
 
Constructor Summary
Sg2cc()
          Sg2cc() - Constructor
 
Method Summary
static void centralCorePix(boolean euclideanNormFlag)
          centralCorePix() - Compute the 2nd derivative, i.e., Laplacian, of the average of pix1 where the average was put into pix4.
 void dumpCCppx(boolean incNflag, java.lang.String tag, java.lang.String msg)
          dumpCCppx() - debugging tool to dump the CC image in gellab/tmp file with name: "CCfile-nnn-tag" + pixFileExtn where 'nnn' is the current iteration # incremented if incNflag is set and 'tag' is a short string.
private static boolean get3x3Laplacian(int x1, int x2, int y)
          get3x3Laplacian() - Compute: 3x3 Laplacianfor line y [x1:x2] and save results in bufcc[x1:x2] and bufmag[x1:x2].
private static boolean get5x5Laplacian(int x1, int x2, int y)
          get5x5Laplacian() - Compute: 5x5 Laplacian for line y [x1:x2] and save results in bufcc[x1:x2] and bufmag[x1:x2].
private static boolean getBusseLaplacian(int x1, int x2, int y)
          getBusseLaplacian() - Compute: Busse Laplacian for line y [x1:x2] and save results in bufcc[x1:x2] and bufmag[x1:x2].
private static boolean getLineLaplacian(int x1, int x2, int y, boolean horizLineFilterFlag)
          getLineLaplacian() - Compute: Line filter Laplacian for line y [x1:x2] and save results in bufcc[x1:x2] and bufmag[x1:x2].
 
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

xOffset

private static int xOffset
Horizontal offset for convolution.


yOffset

private static int yOffset
Vertical offset for convolution.


tmpB

private static int[] tmpB
Tmp array used in buffer swapping


useEuclideanNormFlag

private static boolean useEuclideanNormFlag
use either Euclidian else city-block norm


nthCCImgCtr

public static int nthCCImgCtr
# of current CC image being dumped

Constructor Detail

Sg2cc

public Sg2cc()
Sg2cc() - Constructor

Method Detail

centralCorePix

public static void centralCorePix(boolean euclideanNormFlag)
centralCorePix() - Compute the 2nd derivative, i.e., Laplacian, of the average of pix1 where the average was put into pix4. The 2nd derivative absolute magnitude is stored in pix2 and the binary direction set to 1 if direction=3 else 0 and stored in pix3.
 The global pixel neighborhood variables are:  
                                   i2U
                                 3 i12   1
   shift direction <===    i4L i14 i10 i10 i0R
                                 5 i16   7
                                   i6D
 The buffering is done for the both  5x5 neighborhood for which\
 the 3x3 is a subset.
 That is:    Absolute Magnitude(Laplacian(pix4)) ==> pix2
                      Direction(Laplacian(pix4)) ==> pix3


get3x3Laplacian

private static boolean get3x3Laplacian(int x1,
                                       int x2,
                                       int y)
get3x3Laplacian() - Compute: 3x3 Laplacianfor line y [x1:x2] and save results in bufcc[x1:x2] and bufmag[x1:x2].
 The global 3x3 pixel neighborhood variables are:  
                               i13 i12 i11
   shift direction <===        i14 i18 i10 
                               i15 i16 i17
      0  0  0 
 dX = 1 -2  1
      0  0  0 

      0  1  0
 dY = 0 -2  0
      0  1  0

 Where, CC is 1 if dX and dY<0, else 0.
        mag is magnitude fct (dX, dY).

Parameters:
x1 - is leftmost pixel on line to Laplacian
x2 - is rightmost pixel on line to Laplacian
y - is line to Laplacian
Returns:
true if succeed

get5x5Laplacian

private static boolean get5x5Laplacian(int x1,
                                       int x2,
                                       int y)
get5x5Laplacian() - Compute: 5x5 Laplacian for line y [x1:x2] and save results in bufcc[x1:x2] and bufmag[x1:x2].
  
 The global 5x5 pixel neighborhood variables are:  
                                   i2U
                               i13 i12 i11
   shift direction <===    i4L i14 i18 i10 i0R
                               i15 i16 i17
                                   i6D

      0  0  0  0  0
 dX = 1  1 -4  1  1
      0  0  0  0  0

      0  1  0
      0  1  0
 dY = 0 -4  0
      0  1  0
      0  1  0

 Where, CC is 1 if dX and dY<0, else 0.
        mag is magnitude fct (dX, dY).

Parameters:
x1 - is leftmost pixel on line to Laplacian
x2 - is rightmost pixel on line to Laplacian
y - is line to Laplacian
Returns:
true if succeed

getBusseLaplacian

private static boolean getBusseLaplacian(int x1,
                                         int x2,
                                         int y)
getBusseLaplacian() - Compute: Busse Laplacian for line y [x1:x2] and save results in bufcc[x1:x2] and bufmag[x1:x2]. This is similar to the 3x3 laplacian except that the grid spacing is larger. It is specified by the
-laplacian:B,{'P' | 'C'},gridSize switch. The 'P' is a pixel value at each point whereas the 'C' is a 'coneOfSilence' weighted average. The algorithm was originally developed by Heinz Busse, University of Kiel, Germany for the DEC10/SAIL version of the segmenter.
      0  0  0 
 dX = 1 -2  1
      0  0  0 

      0  1  0
 dY = 0 -2  0
      0  1  0

 Where, CC is 1 if dX and dY<0, else 0.
        mag is magnitude fct (dX, dY).

Parameters:
x1 - is leftmost pixel on line to Laplacian
x2 - is rightmost pixel on line to Laplacian
y - is line to Laplacian
Returns:
true if succeed

getLineLaplacian

private static boolean getLineLaplacian(int x1,
                                        int x2,
                                        int y,
                                        boolean horizLineFilterFlag)
getLineLaplacian() - Compute: Line filter Laplacian for line y [x1:x2] and save results in bufcc[x1:x2] and bufmag[x1:x2]. This is is an asymetric filter. It will compute the It is specified by the
     -laplacian:L,, 
 switch. 
 Current legal filters are 
 (lineLaplacianHeight X lineLaplacianWidth)

 The Vertical line detector filter using horizonal diff
 =======================================================
       0  0  0 
 dX3 = 1 -2  1
       1 -2  1
         ...
       0  0  0 

       0  0  0  0  0
 dX5 = 1  2 -6  2  1
       1  2 -6  2  1
           ...
       0  0  0  0  0

       0  0  0  0  0  0  0
 dX7 = 1  2  3 -12 3  2  1
       1  2  3 -12 3  2  1
               ...
       0  0  0  0  0  0  0

       0  0  0  0  0  0  0  0  0
 dX9 = 1  2  3  4 -20 4  3  2  1
       1  2  3  4 -20 4  3  2  1
                ...
       0  0  0  0  0  0  0  0  0

 The Horizontal line detector filter using vertical diff
 =======================================================

       0  1  1 ... 0
 dY3 = 0 -2 -2 ... 0
       0  1  1 ... 0 

       0  1  1 ... 0
       0  2  2 ... 0
 dY5 = 0 -6 -6 ... 0
       0  2  2 ... 0
       0  1  1 ... 0

       0  1   1 ... 0
       0  2   2 ... 0
       0  3   3 ... 0
 dY7 = 0 -12 -12 ...0
       0  3   3 ... 0
       0  2   2 ... 0
       0  1   1 ... 0

       0  1   1 ... 0
       0  2   2 ... 0
       0  3   3 ... 0
       0  4   4 ... 0
 dY9 = 0 -20 -20 ... 0
       0  4   4 ... 0
       0  3   3 ... 0
       0  2   2 ... 0
       0  1   1 ... 0

 Where, CC is 1 if dX and dY<0, else 0.
        mag is magnitude fct (dX, dY).

Parameters:
x1 - is leftmost pixel on line to Laplacian
x2 - is rightmost pixel on line to Laplacian
y - is line to Laplacian
horizLineFilterFlag - horizontal line filter, else vertical line filter
Returns:
true if succeed

dumpCCppx

public void dumpCCppx(boolean incNflag,
                      java.lang.String tag,
                      java.lang.String msg)
dumpCCppx() - debugging tool to dump the CC image in gellab/tmp file with name: "CCfile-nnn-tag" + pixFileExtn where 'nnn' is the current iteration # incremented if incNflag is set and 'tag' is a short string. and 'msg' is a short string which is printed along with the name to stdout.

Parameters:
incNflag - is true if increment n
tag - is used to construct file name
msg - is inserted in image