Class Landmark

java.lang.Object
  extended by Landmark

public class Landmark
extends java.lang.Object

Landmark class supports landmark data structures and operations. Landmarks are numbered internally [0:51] and vlsually as overlays by the ImageScroller.drawLandmarksTextInImage() method as [A:Z,a:z] and are display as "+letter" in the selected landmark color. They are used by the warping transforms (AffineWarp, etc).

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 Flicker Mozilla and Legal files are available on http://open2dprot.sourceforge.net/Flicker

Version:
$Date$ $Revision$
Author:
P. Lemkin (LECB/NCI), G. Thornwall (SAIC), Frederick, MD
See Also:
Flicker Home

Field Summary
static java.awt.Color[] colorLM
           
private static Flicker flk
           
static java.awt.Font[] fontLM
          color of the landmark
(package private) static java.awt.Font lmsFont
          font for drawing LMS overlay
static int maxLMS
          max # of landmarks allowed
(package private) static int MAXLMS
          3 for affine, but 10x10 for warp
static java.lang.String[] nameLM
          font of the landmark
static int nLM
          highest landmark #
static int[] ox1
          X coordinates in left output image 1
static int[] ox2
          X coordinates in right output image 2
static int[] oy1
          Y coordinates in left output image 1
static int[] oy2
          Y coordinates in right output image 2
private static Util util
           
static int[] x1
          X coordinates in left input image 1
static int[] x2
          X coordinates in right input image 2
static int xLM1a
           
static int xLM1b
           
static int xLM1c
           
static int xLM2a
           
static int xLM2b
           
static int xLM2c
           
static int[] y1
          Y coordinates in left input image 1
static int[] y2
          Y coordinates in right input image 2
static int yLM1a
           
static int yLM1b
           
static int yLM1c
           
static int yLM2a
           
static int yLM2b
           
static int yLM2c
           
 
Constructor Summary
Landmark(Flicker flkS, java.awt.Font lmsFontUse, int maxLMSuse)
          Landmark() - Constructor.
 
Method Summary
static boolean addDemoLandmarks(int nPairs)
          addDemoLandmarks() - add 3 or 6 demo landmark pairs but only for
 boolean addLandmark()
          addLandmark() - "Add LM" add temporary landmarks to landmark list If exist in both I1 and I2 images into permanent landmarks and indicate in images push landmark.
static void clean()
          clean() - reinitialize the landmarks data structures
 void deleteLandmark()
          deleteLandmark() - "Delete LM" undo the last landmark if any
 int deleteLastLandmark()
          deleteLastLandmark() - delete last landmark
(package private)  java.lang.String getStateStr()
          getStateStr() - get this landmark state as a string
 float landmarkSimilarity()
          landmarkSimilarity() - compute landmark similarity for >=3 LMs.
static int pushLandmark(int x1d, int y1d, int x2d, int y2d)
          pushLandmark() - push (x1,y1,x2,y2) and return nLM.
(package private)  void readState()
          readState() - Read state from .flk startup state file.
static void setColorAll(java.awt.Color color)
          setColorAll() - set the landmark color for all landmarks
 void showLandmarkSimilarity()
          showLandmarkSimilarity() - show landmark similarity for >=3 LMs
static void updateScrollers()
          updateScrollers() - update LM in both siCanvases and repaint.
(package private)  void writeState(java.lang.StringBuffer sBuf)
          writeState() - Write this landmark state to string buffer sBuf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flk

private static Flicker flk

util

private static Util util

MAXLMS

static final int MAXLMS
3 for affine, but 10x10 for warp

See Also:
Constant Field Values

xLM1a

public static int xLM1a

yLM1a

public static int yLM1a

xLM2a

public static int xLM2a

yLM2a

public static int yLM2a

xLM1b

public static int xLM1b

yLM1b

public static int yLM1b

xLM2b

public static int xLM2b

yLM2b

public static int yLM2b

xLM1c

public static int xLM1c

yLM1c

public static int yLM1c

xLM2c

public static int xLM2c

yLM2c

public static int yLM2c

lmsFont

static java.awt.Font lmsFont
font for drawing LMS overlay


maxLMS

public static int maxLMS
max # of landmarks allowed


nLM

public static int nLM
highest landmark #


x1

public static int[] x1
X coordinates in left input image 1


y1

public static int[] y1
Y coordinates in left input image 1


x2

public static int[] x2
X coordinates in right input image 2


y2

public static int[] y2
Y coordinates in right input image 2


ox1

public static int[] ox1
X coordinates in left output image 1


oy1

public static int[] oy1
Y coordinates in left output image 1


ox2

public static int[] ox2
X coordinates in right output image 2


oy2

public static int[] oy2
Y coordinates in right output image 2


colorLM

public static java.awt.Color[] colorLM

fontLM

public static java.awt.Font[] fontLM
color of the landmark


nameLM

public static java.lang.String[] nameLM
font of the landmark

Constructor Detail

Landmark

public Landmark(Flicker flkS,
                java.awt.Font lmsFontUse,
                int maxLMSuse)
Landmark() - Constructor.

Parameters:
flk - is main class
lmsFont - is font to use for all landmarks
maxLMS - is max # of landmarks will ever use. if maxLMS==0, use MAXLMS
Method Detail

clean

public static void clean()
clean() - reinitialize the landmarks data structures


setColorAll

public static void setColorAll(java.awt.Color color)
setColorAll() - set the landmark color for all landmarks


updateScrollers

public static void updateScrollers()
updateScrollers() - update LM in both siCanvases and repaint.


pushLandmark

public static int pushLandmark(int x1d,
                               int y1d,
                               int x2d,
                               int y2d)
pushLandmark() - push (x1,y1,x2,y2) and return nLM. if list is full, return -1. if new LM is already in list, return -2.

Parameters:
x1d - coordinate image 1
y1d - coordinate image 1
x2d - coordinate image 2
y2d - coordinate image 2
Returns:
if new LM is already in list, return -2, if list is full, return -1. otherwise nLM

deleteLastLandmark

public int deleteLastLandmark()
deleteLastLandmark() - delete last landmark

Returns:
new nLM

landmarkSimilarity

public float landmarkSimilarity()
landmarkSimilarity() - compute landmark similarity for >=3 LMs.
 Similarity is defined as 
    Sqrt( |sum(LSQerr(x1,y1))-sum(LSQerr(x2,y2))| )

Returns:
-1.0F if not enough landmarks, else the RMS differences within each landmark set/gel.

showLandmarkSimilarity

public void showLandmarkSimilarity()
showLandmarkSimilarity() - show landmark similarity for >=3 LMs


addLandmark

public boolean addLandmark()
addLandmark() - "Add LM" add temporary landmarks to landmark list If exist in both I1 and I2 images into permanent landmarks and indicate in images push landmark. Clear the obj coordinates.

Returns:
true if succeed.

deleteLandmark

public void deleteLandmark()
deleteLandmark() - "Delete LM" undo the last landmark if any


readState

void readState()
readState() - Read state from .flk startup state file.


writeState

void writeState(java.lang.StringBuffer sBuf)
writeState() - Write this landmark state to string buffer sBuf

Parameters:
iName - of the image to read (e.g., "I1", or "I2")
sBuf - is the string buffer to write to.

getStateStr

java.lang.String getStateStr()
getStateStr() - get this landmark state as a string

Parameters:
iData - is the image data to use
fileName - associated with the iData
Returns:
state string

addDemoLandmarks

public static boolean addDemoLandmarks(int nPairs)
addDemoLandmarks() - add 3 or 6 demo landmark pairs but only for

Parameters:
nPairs - # of landmark pairs to add if the I1,I2 images are the demo plasmaH/L gels 3 landmarks