Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.pearsoneduc.ip.op
Class StructElement

    java.lang.Object
      |
      +--com.pearsoneduc.ip.op.StructElement

Direct Known Subclasses:
  BinaryStructElement, GreyStructElement

public abstract class StructElement
extends java.lang.Object

Abstract base class for structuring elements used in morphological image processing.

Version:
  1.2 [1999/08/31]
Author:
  Nick Efford

Field Summary
`protected int` | `height` Height of structuring element.
`protected java.awt.Point` | `origin` Origin of structuring element, relative to upper-left corner.
`protected int[][]` | `pixel` Structuring element data (1 or 0 for binary SE, arbitrary integers for grey SE).
`protected int` | `width` Width of structuring element.

Constructor Summary
`StructElement()`
`StructElement(int w, int h)` Creates an SE with the specified dimensions.
`StructElement(int w, int h, java.awt.Point p)` Creates an SE with the specified dimensions and origin.

Method Summary
`boolean` | `equals(java.lang.Object obj)` Tests for equality with another StructElement object.
`int` | `getHeight()`
`java.awt.Point` | `getOrigin(java.awt.Point p)`
`int` | `getPixel(int x, int y)` Retrieves a value from the specified pixel in the SE.
`int` | `getWidth()`
`protected int` | `readInt(java.io.BufferedReader source, java.lang.String key)` Reads the value of an SE parameter from the specified source.
`void` | `setOrigin(java.awt.Point p)` Changes the origin of the SE.
`abstract void` | `setPixels(int[] value)` Initialises SE pixels using values in a one-dimensional array.
`abstract void` | `setPixels(int[][] value)` Initialises SE pixels using values in a two-dimensional array.
`abstract void` | `setPixels(java.lang.String valueString)` Initialises SE pixels using values in a String.
`java.lang.String` | `toString()` Creates a string indicating the type of structuring element, its dimensions and its origin.
`abstract void` | `write(java.io.Writer destination)` Writes SE data, including a header, to the specified destination.
`abstract void` | `writePixels(java.io.Writer destination)` Writes SE pixel values to the specified destination.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### width

    protected int width

  Width of structuring element.

### height

    protected int height

  Height of structuring element.

### origin

    protected java.awt.Point origin

  Origin of structuring element, relative to upper-left corner.

### pixel

    protected int[][] pixel

  Structuring element data (1 or 0 for binary SE, arbitrary integers for grey SE).

Constructor Detail

### StructElement

    public StructElement()

### StructElement

    public StructElement(int w,
                         int h)
                  throws StructElementException

  Creates an SE with the specified dimensions.
  Parameters:
    `w` - desired width of SE
    `h` - desired height of SE
  Throws:
    StructElementException - if dimensions are invalid.

### StructElement

    public StructElement(int w,
                         int h,
                         java.awt.Point p)
                  throws StructElementException

  Creates an SE with the specified dimensions and origin.
  Parameters:
    `w` - desired width of SE
    `h` - desired height of SE
    `p` - position of SE's origin
  Throws:
    StructElementException - if dimensions are invalid.

Method Detail

### equals

    public boolean equals(java.lang.Object obj)

  Tests for equality with another StructElement object.
  Returns:
    true if this StructElement is equal to the specified StructElement, false otherwise.
  Overrides:
    equals in class java.lang.Object

### toString

    public java.lang.String toString()

  Creates a string indicating the type of structuring element, its dimensions and its origin.
  Returns:
    a String containing information on the SE.
  Overrides:
    toString in class java.lang.Object

### getWidth

    public int getWidth()

  Returns:
    the width of the SE.

### getHeight

    public int getHeight()

  Returns:
    the height of the SE.

### getOrigin

    public java.awt.Point getOrigin(java.awt.Point p)

  Returns:
    the SE's origin.

### setOrigin

    public void setOrigin(java.awt.Point p)

  Changes the origin of the SE.
  Parameters:
    `p` - a java.awt.Point object representing the new origin.

### getPixel

    public int getPixel(int x,
                        int y)

  Retrieves a value from the specified pixel in the SE.
  Parameters:
    `x` - x coordinate of SE pixel
    `y` - y coordinate of SE pixel
  Returns:
    value at specified SE pixel.

### setPixels

    public abstract void setPixels(int[] value)
                            throws StructElementException

  Initialises SE pixels using values in a one-dimensional array.
  Parameters:
    `value` - array of SE pixel values
  Throws:
    StructElementException. -

### setPixels

    public abstract void setPixels(int[][] value)
                            throws StructElementException

  Initialises SE pixels using values in a two-dimensional array.
  Parameters:
    `value` - array of SE pixel values
  Throws:
    StructElementException. -

### setPixels

    public abstract void setPixels(java.lang.String valueString)
                            throws StructElementException

  Initialises SE pixels using values in a String.
  Parameters:
    `valueString` - a string of values for SE pixels, given row-by-row
  Throws:
    StructElementException. -

### writePixels

    public abstract void writePixels(java.io.Writer destination)

  Writes SE pixel values to the specified destination.
  Parameters:
    `destination` - Writer acting as destination for SE data

### write

    public abstract void write(java.io.Writer destination)
                        throws java.io.IOException

  Writes SE data, including a header, to the specified destination.
  Parameters:
    `destination` - Writer acting as destination for SE data

### readInt

    protected int readInt(java.io.BufferedReader source,
                          java.lang.String key)
                   throws java.io.IOException,
                          StructElementException

  Reads the value of an SE parameter from the specified source.
  Parameters:
    `source` - Reader acting as the source of SE data
    `key` - String of the form "# param=", to match with what is read from the input
  Returns:
    integer value for the named parameter.
  Throws:
    java.io.IOException - if an I/O error occurs.
    StructElementException - if the string read from the input does not begin with the specified key.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD