bunwarpj
Class Mask

java.lang.Object
  extended by bunwarpj.Mask

public class Mask
extends java.lang.Object

This class is responsible for the mask preprocessing that takes place concurrently with user-interface events. It contains methods to compute the mask pyramids.


Field Summary
private  int height
          mask height
private  boolean[] mask
          mask flags
private  boolean mask_from_the_stack
          flag to check if the mask comes from the stack of images
private  java.awt.Polygon polygon
          polygon composing the flag
private  int width
          mask width
 
Constructor Summary
Mask(ij.process.ImageProcessor ip, boolean take_mask)
          Empty constructor, the input image is used only to take the image size if take_mask is false, otherwise, it is used as the mask information.
 
Method Summary
 void BoundingBox(int[] corners)
          Bounding box for the mask.
 void clearMask()
          Set to true every pixel of the full-size mask.
 void fillMask(int tool)
          Fill the mask associated to the mask points.
 java.awt.Point getPoint(int i)
          Get a point from the mask.
 boolean getValue(double x, double y)
          Get the value of the mask at a certain pixel.
 boolean isFromStack()
          Check if the mask was taken from the stack.
 int numberOfMaskPoints()
          Get the number of points in the mask.
 void readFile(java.lang.String filename)
          Read mask from file.
 void setMaskPoints(java.util.Vector<java.awt.Point> listMaskPoints)
          Set the mask points.
 void setValue(int u, int v, boolean value)
          Sets the value of the mask at a certain pixel.
 void showMask()
          Show mask.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mask

private boolean[] mask
mask flags


width

private int width
mask width


height

private int height
mask height


polygon

private java.awt.Polygon polygon
polygon composing the flag


mask_from_the_stack

private boolean mask_from_the_stack
flag to check if the mask comes from the stack of images

Constructor Detail

Mask

public Mask(ij.process.ImageProcessor ip,
            boolean take_mask)
Empty constructor, the input image is used only to take the image size if take_mask is false, otherwise, it is used as the mask information.

Parameters:
ip - image
take_mask - flag to take the mask from the stack of images
Method Detail

BoundingBox

public void BoundingBox(int[] corners)
Bounding box for the mask. An array is returned with the convention [x0,y0,xF,yF]. This array is returned in corners. This vector should be already resized.

Parameters:
corners - array of coordinates of the bounding box

clearMask

public void clearMask()
Set to true every pixel of the full-size mask.


fillMask

public void fillMask(int tool)
Fill the mask associated to the mask points.

Parameters:
tool - option to invert or not the mask

getValue

public boolean getValue(double x,
                        double y)
Get the value of the mask at a certain pixel. If the sample is not integer then the closest point is returned.

Parameters:
x - x- coordinate of the pixel
y - y- coordinate of the pixel
Returns:
value of the mask at the pixel in (x,y)

getPoint

public java.awt.Point getPoint(int i)
Get a point from the mask.

Parameters:
i - index of the point in the polygong
Returns:
corresponding point

isFromStack

public boolean isFromStack()
Check if the mask was taken from the stack.

Returns:
True if the mask was taken from the stack

numberOfMaskPoints

public int numberOfMaskPoints()
Get the number of points in the mask.

Returns:
number of point of the polygon that composes the mask

readFile

public void readFile(java.lang.String filename)
Read mask from file. An error is shown if the file read is not of the same size as the previous mask.

Parameters:
filename - name of the mask file

showMask

public void showMask()
Show mask.


setMaskPoints

public void setMaskPoints(java.util.Vector<java.awt.Point> listMaskPoints)
Set the mask points.

Parameters:
listMaskPoints - list of points composing the mask

setValue

public void setValue(int u,
                     int v,
                     boolean value)
Sets the value of the mask at a certain pixel.

Parameters:
u - x- coordinate of the pixel
v - y- coordinate of the pixel
value - mask value to be set