Class PointStack

java.lang.Object
gov.nih.mipav.model.structures.PointStack

public class PointStack extends Object
PointStack is a structure used specifically in ViewComponentEditImage for use in the active level set generation and was built for speed. However, I have included it in the model package in the hope that it can be used elsewhere.
Version:
0.1 April 7, 1998
Author:
Matthew J. McAuliffe
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int
    DOCUMENT ME!
    private int
    DOCUMENT ME!
    protected int[]
    DOCUMENT ME!
    protected int[]
    DOCUMENT ME!
  • Constructor Summary

    Constructors
    Constructor
    Description
    PointStack(int capacity)
    PointStack.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addPoint(int x, int y)
    Adds a point to the arrays.
    Repackages arrays into a java polygon returns points in polygon form.
    void
    getPoint(int index, int[] x, int[] y)
    Get a point and stores it in the two input arrays.
    int
    getPointX(int index)
    Gets the x coordinate of a point.
    int
    getPointY(int index)
    Gets the y coordinate of a point.
    void
    Removes all elements in array by setting data pointer to zero.
    int
    setIndex(int index)
    Sets the pointer to specific location return -1 if index exceeds location of valid data.
    int
    Returns the number of points.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • xBuffer

      protected int[] xBuffer
      DOCUMENT ME!
    • yBuffer

      protected int[] yBuffer
      DOCUMENT ME!
    • chunk

      private int chunk
      DOCUMENT ME!
    • ptr

      private int ptr
      DOCUMENT ME!
  • Constructor Details

    • PointStack

      public PointStack(int capacity)
      PointStack.
      Parameters:
      capacity - initial size of the arrays
  • Method Details

    • addPoint

      public void addPoint(int x, int y)
      Adds a point to the arrays. Allocates more memory if necessary.
      Parameters:
      x - x coordinate
      y - y coordinate
    • exportPolygon

      public Polygon exportPolygon()
      Repackages arrays into a java polygon returns points in polygon form.
      Returns:
      DOCUMENT ME!
    • getPoint

      public void getPoint(int index, int[] x, int[] y)
      Get a point and stores it in the two input arrays.
      Parameters:
      index - pointer into array
      x - x coordinate
      y - y coordinate
    • getPointX

      public int getPointX(int index)
      Gets the x coordinate of a point.
      Parameters:
      index - pointer into array
      Returns:
      x coordinate of point
    • getPointY

      public int getPointY(int index)
      Gets the y coordinate of a point.
      Parameters:
      index - pointer into array
      Returns:
      y coordinate of point
    • reset

      public void reset()
      Removes all elements in array by setting data pointer to zero.
    • setIndex

      public int setIndex(int index)
      Sets the pointer to specific location return -1 if index exceeds location of valid data.
      Parameters:
      index - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • size

      public int size()
      Returns the number of points.
      Returns:
      the size of the array (i.e., the number of points)