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 NeighbourhoodOp

    java.lang.Object
      |
      +--com.pearsoneduc.ip.op.StandardGreyOp
            |
            +--com.pearsoneduc.ip.op.NeighbourhoodOp

Direct Known Subclasses:
  ConvolutionOp, MMSEFilterOp, RankFilterOp

public class NeighbourhoodOp
extends StandardGreyOp

Adds support for neighbourhood operations to StandardGreyOp.

This class supplies instance variables to represent neighbourhood dimensions and provides support for processing at the borders of an image. No actual processing is carried out. Subclasses must override the filter() method inherited from StandardGreyOp in order to do anything useful.

Four possible strategies are supported for border processing:

- No operation (resulting in a black border of unprocessed pixels)
- Copying of data from source image
- Reflected indexing
- Circular indexing

Copying of data is supported by the protected

Version:
  1.0 [1999/07/23]
Author:
  Nick Efford

Field Summary
`protected int` | `borderStrategy` Strategy to use when dealing with image borders.
`static int` | `CIRCULAR_INDEXING` Indicates that invalid coordinates wrap around the image.
`static int` | `COPY_BORDER_PIXELS` Indicates that border pixels are to be copied from source image.
`protected int` | `height` Height of neighbourhood.
`static int` | `NO_BORDER_OP` Indicates that no processing of borders is to be done.
`static int` | `REFLECTED_INDEXING` Indicates that invalid coordinates are reflected into the image.
`protected int` | `size` Number of pixels in neighbourhood.
`protected int` | `width` Width of neighbourhood.

Constructor Summary
`NeighbourhoodOp(int w, int h, int strategy)` Constructs a NeighbourhoodOp with the given dimensions and border processing strategy.

Method Summary
`static int` | `circIndex(int i, int n)` Wraps an invalid coordinate around to the other side of an image.
`protected void` | `copyBorders(java.awt.image.Raster src, java.awt.image.WritableRaster dest)` Copies border pixels that cannot normally be processed by a neighbourhood operation from one raster to another.
`int` | `getBorderStrategy()`
`int` | `getHeight()`
`int` | `getNumPixels()`
`int` | `getWidth()`
`static int` | `refIndex(int i, int n)` Reflects an invalid coordinate back into an image.

Methods inherited from class com.pearsoneduc.ip.op.StandardGreyOp
`checkImage, createCompatibleDestImage, filter, getBounds2D, getPoint2D, getRenderingHints`

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

Field Detail

### NO_BORDER_OP

    public static final int NO_BORDER_OP

  Indicates that no processing of borders is to be done.

### COPY_BORDER_PIXELS

    public static final int COPY_BORDER_PIXELS

  Indicates that border pixels are to be copied from source image.

### REFLECTED_INDEXING

    public static final int REFLECTED_INDEXING

  Indicates that invalid coordinates are reflected into the image.

### CIRCULAR_INDEXING

    public static final int CIRCULAR_INDEXING

  Indicates that invalid coordinates wrap around the image.

### width

    protected int width

  Width of neighbourhood.

### height

    protected int height

  Height of neighbourhood.

### size

    protected int size

  Number of pixels in neighbourhood.

### borderStrategy

    protected int borderStrategy

  Strategy to use when dealing with image borders.

Constructor Detail

### NeighbourhoodOp

    public NeighbourhoodOp(int w,
                           int h,
                           int strategy)

  Constructs a NeighbourhoodOp with the given dimensions and border processing strategy.
  Parameters:
    `w` - width of neighbourhood
    `h` - height of neighbourhood
    `strategy` - border processing strategy

Method Detail

### getWidth

    public int getWidth()

  Returns:
    width of neighbourhood.

### getHeight

    public int getHeight()

  Returns:
    height of neighbourhood.

### getNumPixels

    public int getNumPixels()

  Returns:
    number of pixels in neighbourhood.

### getBorderStrategy

    public int getBorderStrategy()

  Returns:
    strategy used to deal with image borders.

### refIndex

    public static final int refIndex(int i,
                                     int n)

  Reflects an invalid coordinate back into an image.
  Parameters:
    `i` - coordinate, possibly out of bounds
    `n` - appropriate dimension of image (width or height)
  Returns:
    coordinate, now valid if it was out of bounds

### circIndex

    public static final int circIndex(int i,
                                      int n)

  Wraps an invalid coordinate around to the other side of an image.
  Parameters:
    `i` - coordinate, possibly out of bounds.
    `n` - appropriate dimension of image (width or height)
  Returns:
    coordinate, now valid if it was out of bounds

### copyBorders

    protected void copyBorders(java.awt.image.Raster src,
                               java.awt.image.WritableRaster dest)

  Copies border pixels that cannot normally be processed by a neighbourhood operation from one raster to another.
  Parameters:
    `src` - source of pixel data
    `dest` - destination for pixel data

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