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

## jm.jigl
Class GrayImage

    java.lang.Object
      |
      +--jm.jigl.GrayImage

All Implemented Interfaces:
  Image

public class GrayImage
extends java.lang.Object
implements Image

GrayImage is a 2-d array of shorts

See Also:
  `jigl.image.GrayImage`

Field Summary
`protected short[][]` | `data` Two dimensional integer array
`protected int` | `X` Cartesian width
`protected int` | `Y` Cartesian height

Constructor Summary
`GrayImage()` Creates an empty two dimensional GrayImage with a height and width of zero
`GrayImage(GrayImage img)` Creates a two dimensional GrayImage (shallow copy) from GrayImage img
`GrayImage(java.awt.Image img)` Creates an two dimensional GrayImage from the standard java.awt.Image
`GrayImage(int x, int y)` Creates a two dimensional GrayImage with a height and width of x and y repectively
`GrayImage(int x, int y, short[] dat)` Creates a two dimensional GrayImage with a height and width of x and y repectively
`GrayImage(short[][] dat)` Creates a two dimensional GrayImage from a two dimensional array

Method Summary
`int` | `absSum()` Adds absolute value of all the values together
`GrayImage` | `add(GrayImage im)` Adds another GrayImage to this image
`GrayImage` | `add(GrayImage im, ROI sourceImage, ROI destImage)` Adds a Region of Interest in another GrayImage to a Region of Interest of this image
`GrayImage` | `add(int v)` Adds a value to all the pixels in this image
`void` | `add(int x, int y, int value)` Adds a value to a single pixel
`void` | `add(int x, int y, int value, ROI r)` Adds a value to a single pixel in a Region of Interest
`GrayImage` | `add(int v, ROI r)` Adds a value to all the pixels in a Region of Interest
`GrayImage` | `addbuffer(int w, int h, int color)` Makes a copy of this image with a buffer so the resulting image has a width x and height y
`GrayImage` | `addbuffer(int w, int h, int xoff, int yoff, int color)` Makes a copy of this image with a buffer so the resulting image has a width x and height y
`int` | `addSum()` Adds all the values together
`void` | `byteSize()` Scales the range of this image to byte (0..255)
`GrayImage` | `clear()` Clears the image to zero
`GrayImage` | `clear(int val)` Clears to constant value
`void` | `clip(int min, int max)` Clips the range of this image to an arbitrary min/max
`void` | `clip(int min, int max, ROI r)` Clips the range of this image to an arbitrary min/max in a Region of Interest
`Image` | `copy()` Makes a deep copy of this image
`Image` | `copy(ROI r)` Makes a deep copy of a Region of Interest
`GrayImage` | `diff(GrayImage im)` Subtracts the second image from the first and returns the absolute value
`GrayImage` | `divide(GrayImage im)` Divides this image by a GrayImage
`GrayImage` | `divide(GrayImage im, ROI sourceImage, ROI destImage)` Divides by a Region of Interest in this image by a Region of Interest of another GrayImage
`GrayImage` | `divide(int v)` Divides all the pixels in this image by a value
`void` | `divide(int x, int y, int value)` Divides a single pixel by a value
`void` | `divide(int x, int y, int value, ROI r)` Divides a single pixel by a value in a Region of Interest
`GrayImage` | `divide(int v, ROI r)` Divides all the pixels by a value in a Region of Interest
`int` | `get(int x, int y)` Returns the pixel value at the given x, y value
`java.awt.image.ImageProducer` | `getJavaImage()` Turns this image into a Java Image (java.awt.Image).
`static void` | `main(java.lang.String[] args)` Method declaration
`int` | `max()` Finds the maximum value of this image
`int` | `max(ROI r)` Finds the maximum value in a Region of Interest
`void` | `median(int size)` Performs median filter on this image
`void` | `median(int size, ROI r)` Performs median filter in a Region of Interest
`int` | `min()` Finds the minimum value of this image
`int` | `min(ROI r)` Finds the minimum value in a Region of Interest
`GrayImage` | `multiply(GrayImage im)` Multiplies a GrayImage by this image
`GrayImage` | `multiply(GrayImage im, ROI sourceImage, ROI destImage)` Multiplies a Region of Interest of another GrayImage by a Region of Interest of this image
`GrayImage` | `multiply(int v)` Multiplies all the pixels in this image by a value
`void` | `multiply(int x, int y, int value)` Mutiplies a single pixel by a value
`void` | `multiply(int x, int y, int value, ROI r)` Mutiplies a single pixel by a value in a Region of Interest
`GrayImage` | `multiply(int v, ROI r)` Multiplies all the pixels in a Region of Interest by a value
`void` | `set(int x, int y, int value)` Sets the pixel value at x, y to a given value
`void` | `set(int x, int y, int value, ROI r)` Sets the pixel value at x, y to a given value in a Region of Interest
`long` | `sqrSum()` Adds the square of all the values together
`GrayImage` | `subtract(GrayImage im)` Subtracts a GrayImage from this image
`GrayImage` | `subtract(GrayImage im, ROI sourceImage, ROI destImage)` Subtracts a Region of Interest in another GrayImage from a Region of Interest of this image
`GrayImage` | `subtract(int v)` Subtracts a value from all the pixels in this image
`void` | `subtract(int x, int y, int value)` Subtracts a value from a single pixel
`void` | `subtract(int x, int y, int value, ROI r)` Subtracts a value from a single pixel in a Region of Interest
`GrayImage` | `subtract(int v, ROI r)` Subtracts a value from all the pixels in a Region of Interest
`java.lang.String` | `toString()` Prints this image in integer format.
`java.lang.String` | `toString(ROI r)` Prints a Region of Interest in integer format.
`int` | `X()` Returns the width (maximum X value)
`int` | `Y()` Returns the height (maximum Y value)

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

Field Detail

### data

    protected short[][] data

  Two dimensional integer array

### X

    protected int X

  Cartesian width

### Y

    protected int Y

  Cartesian height

Constructor Detail

### GrayImage

    public GrayImage()

  Creates an empty two dimensional GrayImage with a height and width of zero

### GrayImage

    public GrayImage(int x,
                     int y)

  Creates a two dimensional GrayImage with a height and width of x and y repectively

### GrayImage

    public GrayImage(int x,
                     int y,
                     short[] dat)

  Creates a two dimensional GrayImage with a height and width of x and y repectively

Parameters:
  `x` - width of image
  `y` - height of image
  `dat` - one dimensional array of short. The array is length x*y.

### GrayImage

    public GrayImage(short[][] dat)

  Creates a two dimensional GrayImage from a two dimensional array

Parameters:
  `dat` - two dimensional array of short

### GrayImage

    public GrayImage(GrayImage img)

  Creates a two dimensional GrayImage (shallow copy) from GrayImage img

### GrayImage

    public GrayImage(java.awt.Image img)

  Creates an two dimensional GrayImage from the standard java.awt.Image

Method Detail

### copy

    public Image copy()

  Makes a deep copy of this image

  Specified by:
    `copy` in interface `Image`
  Returns:
    a deep copy of GrayImage

### addbuffer

    public GrayImage addbuffer(int w,
                               int h,
                               int color)

  Makes a copy of this image with a buffer so the resulting image has a width x and height y

  Returns:
    a deep copy of GrayImage

### addbuffer

    public GrayImage addbuffer(int w,
                               int h,
                               int xoff,
                               int yoff,
                               int color)

  Makes a copy of this image with a buffer so the resulting image has a width x and height y

  Returns:
    a deep copy of GrayImage

### X

    public final int X()

  Returns the width (maximum X value)

  Specified by:
    `X` in interface `Image`

### Y

    public final int Y()

  Returns the height (maximum Y value)

  Specified by:
    `Y` in interface `Image`

### get

    public final int get(int x,
                         int y)

  Returns the pixel value at the given x, y value

  Parameters:
    `x` - the X coordinant
    `y` - the Y coordinant

### set

    public final void set(int x,
                          int y,
                          int value)

  Sets the pixel value at x, y to a given value

  Parameters:
    `x` - the X coordinant
    `y` - the Y coordinant
    `value` - the value to set the pixel to

### clear

    public final GrayImage clear()

  Clears the image to zero

### clear

    public final GrayImage clear(int val)

  Clears to constant value

  Parameters:
    `val` - the value to "clear" the image to

### add

    public final void add(int x,
                          int y,
                          int value)

  Adds a value to a single pixel

  Parameters:
    `x` - X-coordinant
    `y` - Y-coordinant
    `value` - the value to add to the pixel

### subtract

    public final void subtract(int x,
                               int y,
                               int value)

  Subtracts a value from a single pixel

  Parameters:
    `x` - X-coordinant
    `y` - Y-coordinant
    `value` - the value to subtract from the pixel

### multiply

    public final void multiply(int x,
                               int y,
                               int value)

  Mutiplies a single pixel by a value

  Parameters:
    `x` - X-coordinant
    `y` - Y-coordinant
    `value` - - the value to mutiply to the pixel

### divide

    public final void divide(int x,
                             int y,
                             int value)

  Divides a single pixel by a value

  Parameters:
    `x` - X-coordinant
    `y` - Y-coordinant
    `value` - - the value to mutiply to the pixel

### min

    public final int min()

  Finds the minimum value of this image

  Returns:
    an integer containing the minimum value

### max

    public final int max()

  Finds the maximum value of this image

  Returns:
    an integer containing the maximum value

### add

    public final GrayImage add(int v)

  Adds a value to all the pixels in this image

  Parameters:
    `v` - value to be added to the pixels
  Returns:
    this

### subtract

    public final GrayImage subtract(int v)

  Subtracts a value from all the pixels in this image

  Parameters:
    `v` - value to be added to the pixels
  Returns:
    this

### multiply

    public final GrayImage multiply(int v)

  Multiplies all the pixels in this image by a value

  Parameters:
    `v` - value to be added to the pixels
  Returns:
    this

### divide

    public final GrayImage divide(int v)

  Divides all the pixels in this image by a value

  Parameters:
    `v` - value to be added to the pixels
  Returns:
    this

### addSum

    public final int addSum()

  Adds all the values together

### absSum

    public final int absSum()

  Adds absolute value of all the values together

### sqrSum

    public final long sqrSum()

  Adds the square of all the values together

### add

    public final GrayImage add(GrayImage im)

  Adds another GrayImage to this image

  Parameters:
    `im` - the GrayImage to add
  Returns:
    this

### subtract

    public final GrayImage subtract(GrayImage im)

  Subtracts a GrayImage from this image

  Parameters:
    `im` - the GrayImage to subtract
  Returns:
    this

### diff

    public final GrayImage diff(GrayImage im)

  Subtracts the second image from the first and returns the absolute value

### multiply

    public final GrayImage multiply(GrayImage im)

  Multiplies a GrayImage by this image

  Parameters:
    `im` - the GrayImage to multiply
  Returns:
    this

### divide

    public final GrayImage divide(GrayImage im)

  Divides this image by a GrayImage

  Parameters:
    `im` - the GrayImage to divide
  Returns:
    this

### toString

    public java.lang.String toString()

  Prints this image in integer format.

-Example of output on an image with width 100 and height 120:

100 : 120
10 20 32 12 32 56 40 59 42 39 43 ...

  Specified by:
    `toString` in interface `Image`
  Overrides:
    `toString` in class `java.lang.Object`

### getJavaImage

    public java.awt.image.ImageProducer getJavaImage()

  Turns this image into a Java Image (java.awt.Image). Note: This method also scales the image so all the values are between 0 and 255.

  Specified by:
    `getJavaImage` in interface `Image`
  See Also:
    `java.awt.ImageProducer`

### byteSize

    public void byteSize()

  Scales the range of this image to byte (0..255)

### clip

    public void clip(int min,
                     int max)

  Clips the range of this image to an arbitrary min/max

  Parameters:
    `min` - minimum value
    `max` - maximum value

### median

    public void median(int size)

  Performs median filter on this image

  Parameters:
    `size` - the size of the median filter

### copy

    public Image copy(ROI r)

  Makes a deep copy of a Region of Interest

  Specified by:
    `copy` in interface `Image`
  Parameters:
    `r` - Region of Interest
  Returns:
    a deep copy of GrayImage
  See Also:

### set

    public final void set(int x,
                          int y,
                          int value,
                          ROI r)

  Sets the pixel value at x, y to a given value in a Region of Interest

  Parameters:
    `x` - the X coordinant
    `y` - the Y coordinant
    `value` - the value to set the pixel to
    `r` - Region of Interest

### add

    public final void add(int x,
                          int y,
                          int value,
                          ROI r)

  Adds a value to a single pixel in a Region of Interest

  Parameters:
    `x` - X-coordinant
    `y` - Y-coordinant
    `value` - the value to add to the pixel
    `r` - Region of Interest

### subtract

    public final void subtract(int x,
                               int y,
                               int value,
                               ROI r)

  Subtracts a value from a single pixel in a Region of Interest

  Parameters:
    `x` - X-coordinant
    `y` - Y-coordinant
    `value` - the value to subtract from the pixel
    `r` - Region of Interest

### multiply

    public final void multiply(int x,
                               int y,
                               int value,
                               ROI r)

  Mutiplies a single pixel by a value in a Region of Interest

  Parameters:
    `x` - X-coordinant
    `y` - Y-coordinant
    `value` - - the value to mutiply to the pixel
    `r` - Region of Interest

### divide

    public final void divide(int x,
                             int y,
                             int value,
                             ROI r)

  Divides a single pixel by a value in a Region of Interest

  Parameters:
    `x` - X-coordinant
    `y` - Y-coordinant
    `value` - - the value to mutiply to the pixel
    `r` - Region of Interest

### min

    public final int min(ROI r)

  Finds the minimum value in a Region of Interest

  Parameters:
    `r` - Region of Interest
  Returns:
    an integer containing the minimum value

### max

    public final int max(ROI r)

  Finds the maximum value in a Region of Interest

  Parameters:
    `r` - Region of Interest
  Returns:
    an integer containing the maximum value

### add

    public final GrayImage add(int v,
                               ROI r)

  Adds a value to all the pixels in a Region of Interest

  Parameters:
    `v` - value to be added to the pixels
    `r` - Region of Interest
  Returns:
    this

### subtract

    public final GrayImage subtract(int v,
                                    ROI r)

  Subtracts a value from all the pixels in a Region of Interest

  Parameters:
    `v` - value to be added to the pixels
    `r` - Region of Interest
  Returns:
    this

### multiply

    public final GrayImage multiply(int v,
                                    ROI r)

  Multiplies all the pixels in a Region of Interest by a value

  Parameters:
    `v` - value to be added to the pixels
    `r` - Region of Interest
  Returns:
    this

### divide

    public final GrayImage divide(int v,
                                  ROI r)

  Divides all the pixels by a value in a Region of Interest

  Parameters:
    `v` - value to be added to the pixels
    `r` - Region of Interest
  Returns:
    this

### add

    public final GrayImage add(GrayImage im,
                               ROI sourceImage,
                               ROI destImage)

  Adds a Region of Interest in another GrayImage to a Region of Interest of this image

  Parameters:
    `im` - the GrayImage to add
    `sourceImage` - Region of Interest for the Source Image
    `destImage` - Region of Interest for the Destination Image
  Returns:
    this

### subtract

    public final GrayImage subtract(GrayImage im,
                                    ROI sourceImage,
                                    ROI destImage)

  Subtracts a Region of Interest in another GrayImage from a Region of Interest of this image

  Parameters:
    `im` - the GrayImage to subtract
    `sourceImage` - Region of Interest for the Source Image
    `destImage` - Region of Interest for the Destination Image
  Returns:
    this

### multiply

    public final GrayImage multiply(GrayImage im,
                                    ROI sourceImage,
                                    ROI destImage)

  Multiplies a Region of Interest of another GrayImage by a Region of Interest of this image

  Parameters:
    `im` - the GrayImage to multiply
    `sourceImage` - Region of Interest for the Source Image
    `destImage` - Region of Interest for the Destination Image
  Returns:
    this

### divide

    public final GrayImage divide(GrayImage im,
                                  ROI sourceImage,
                                  ROI destImage)

  Divides by a Region of Interest in this image by a Region of Interest of another GrayImage

  Parameters:
    `im` - the GrayImage to divide
    `sourceImage` - Region of Interest for the Source Image
    `destImage` - Region of Interest for the Destination Image
  Returns:
    this

### toString

    public java.lang.String toString(ROI r)

  Prints a Region of Interest in integer format.

  Parameters:
    `r` - Region of Interest
  -Example of output on an image with width 100 and height 120:
  100 : 120
  10 20 32 12 32 56 40 59 42 39 43 ...

### clip

    public void clip(int min,
                     int max,
                     ROI r)

  Clips the range of this image to an arbitrary min/max in a Region of Interest

  Parameters:
    `min` - minimum value
    `max` - maximum value
    `r` - Region of Interest

### median

    public void median(int size,
                       ROI r)

  Performs median filter in a Region of Interest

  Parameters:
    `size` - the size of the median filter
    `r` - Region of Interest

### main

    public static void main(java.lang.String[] args)

  Method declaration

  Parameters:
    `args` -
  See Also:

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