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 GreyStructElement

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

public class GreyStructElement
extends StructElement
implements java.lang.Cloneable

A structuring element for the morphological processing of greyscale images.

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

Fields inherited from class com.pearsoneduc.ip.op.StructElement
`height, origin, pixel, width`

Constructor Summary
`GreyStructElement(int value)` Creates a 3x3 square SE with pixels set to the specified value.
`GreyStructElement(int w, int h, int value)` Creates a rectangular GreyStructElement with the specified dimensions and pixel value.
`GreyStructElement(int w, int h, java.awt.Point p, int value)` Creates an instance of a GreyStructElement with the specified dimensions, origin and pixel value.
`GreyStructElement(java.io.Reader source)` Creates an instance of a GreyStructElement by reading data.

Method Summary
`int` | `above(java.awt.image.Raster raster, int x, int y)` Calculates the minimum distance that a rotated SE would need to be pushed up so as to be above the image.
`int` | `below(java.awt.image.Raster raster, int x, int y)` Calculates the maximum distance that the SE can be pushed up whilst remaining beneath an image.
`java.lang.Object` | `clone()`
`boolean` | `equals(java.lang.Object obj)` Tests for equality with another GreyStructElement.
`GreyStructElement` | `getRotatedVersion()`
`void` | `setPixel(int x, int y, int value)` Sets a pixel in the structuring element to the specified value.
`void` | `setPixels(int value)` Sets all pixels of the SE to the specified value.
`void` | `setPixels(int[] value)` Copies values from a one-dimensional array into the SE.
`void` | `setPixels(int[][] value)` Copies values from a two-dimensional array into the SE.
`void` | `setPixels(java.lang.String valueString)` Copies values from a String into the SE.
`void` | `write(java.io.Writer destination)` Writes SE data, including a header, to the specified destination.
`void` | `writePixels(java.io.Writer destination)` Writes SE pixel values to the specified destination.

Methods inherited from class com.pearsoneduc.ip.op.StructElement
`getHeight, getOrigin, getPixel, getWidth, readInt, setOrigin, toString`

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

Constructor Detail

### GreyStructElement

    public GreyStructElement(int value)
                      throws StructElementException

  Creates a 3x3 square SE with pixels set to the specified value.
  Parameters:
    `value` - SE pixel value

### GreyStructElement

    public GreyStructElement(int w,
                             int h,
                             int value)
                      throws StructElementException

  Creates a rectangular GreyStructElement with the specified dimensions and pixel value.
  Parameters:
    `w` - desired SE width (greater than 0)
    `h` - desired SE height (greater than 0)
    `value` - SE pixel value
  Throws:
    StructElementException - if dimensions are invalid.

### GreyStructElement

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

  Creates an instance of a GreyStructElement with the specified dimensions, origin and pixel value.
  Parameters:
    `w` - desired SE width (greater than 0)
    `h` - desired SE height (greater than 0)
    `p` - java.awt.Point object representing origin of SE
    `value` - SE pixel value
  Throws:
    StructElementException - if dimensions are invalid.

### GreyStructElement

    public GreyStructElement(java.io.Reader source)
                      throws java.io.IOException,
                             StructElementException

  Creates an instance of a GreyStructElement by reading data.
  Parameters:
    `source` - Reader representing source of SE data
  Throws:
    java.io.IOException - if there was an I/O error.
    StructElementException - if the data do not conform to the required format or the dimensions, origin or SE values are not valid.

Method Detail

### clone

    public java.lang.Object clone()

  Returns:
    a copy of this GreyStructElement.
  Overrides:
    clone in class java.lang.Object

### equals

    public boolean equals(java.lang.Object obj)

  Tests for equality with another GreyStructElement.
  Parameters:
    `obj` - a GreyStructElement object
  Returns:
    true if the SEs are equal, false otherwise.
  Overrides:
    equals in class StructElement

### setPixel

    public void setPixel(int x,
                         int y,
                         int value)

  Sets a pixel in the structuring element to the specified value.
  Parameters:
    `x` - x coordinate of SE pixel
    `y` - y coordinate of SE pixel
    `value` - new value for SE pixel

### setPixels

    public void setPixels(int value)

  Sets all pixels of the SE to the specified value.
  Parameters:
    `value` - new value for SE pixels

### setPixels

    public void setPixels(int[] value)
                   throws StructElementException

  Copies values from a one-dimensional array into the SE.
  Parameters:
    `value` - array of values to be copied into the SE
  Overrides:
    setPixels in class StructElement

### setPixels

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

  Copies values from a two-dimensional array into the SE.
  Parameters:
    `value` - array of values to be copied into SE
  Overrides:
    setPixels in class StructElement

### setPixels

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

  Copies values from a String into the SE.
  Parameters:
    `valueString` - String of values to be copied into SE
  Throws:
    StructElementException - if string does not contain enough values.
  Overrides:
    setPixels in class StructElement

### writePixels

    public void writePixels(java.io.Writer destination)

  Writes SE pixel values to the specified destination.
  Parameters:
    `destination` - Writer acting as destination for the SE data
  Overrides:
    writePixels in class StructElement

### write

    public 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 a destination for the SE
  Throws:
    java.io.IOException - if there was some kind of error when writing the header.
  Overrides:
    write in class StructElement

### below

    public int below(java.awt.image.Raster raster,
                     int x,
                     int y)

  Calculates the maximum distance that the SE can be pushed up whilst remaining beneath an image. This is equivalent to the minimum distance between image pixel values and SE pixel values over the domain of the SE.

  Note: this method does not check whether SE pixels lie beyond the bounds of the image!

  Parameters:
    `raster` - Raster of the image on which the SE will operate
    `x` - x coordinate of pixel where SE will be placed
    `y` - y coordinate of pixel where SE will be placed
  Returns:
    maximum distance that the SE can be pushed up.

### above

    public int above(java.awt.image.Raster raster,
                     int x,
                     int y)

  Calculates the minimum distance that a rotated SE would need to be pushed up so as to be above the image.

  Note: this method does not check whether SE pixels lie beyond the bounds of the image!

  Parameters:
    `raster` - Raster of the image on which the SE will operate
    `x` - x coordinate of pixel where SE will be placed
    `y` - y coordinate of pixel where SE will be placed
  Returns:
    minimum 'push-up' distance.

### getRotatedVersion

    public GreyStructElement getRotatedVersion()

  Returns:
    a version of this GreyStructElement that has been rotated through 180 degrees.

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