jm.jigl
Class RealGrayImage

java.lang.Object
  |
  +--jm.jigl.RealGrayImage
All Implemented Interfaces:
Image

public class RealGrayImage
extends java.lang.Object
implements Image

RealGrayImage is a 2-d array of floats

See Also:
jigl.image.RealGrayImage

Field Summary
protected  float[][] data
          Two dimensional float array
protected  int X
          Cartesian width
protected  int Y
          Cartesian height
 
Constructor Summary
RealGrayImage()
          Creates an empty two dimensional RealGrayImage with a height and width of zero
RealGrayImage(float[][] dat)
          Creates a two dimensional GrayImage from a two dimensional array
RealGrayImage(java.awt.Image img)
          Creates a two dimensional RealGrayImage from the standard java.awt.Image
RealGrayImage(int x, int y)
          Creates a two dimensional RealGrayImage with a height and width of x and y repectively
RealGrayImage(int x, int y, float[] dat)
          Creates a two dimensional GrayImage with a height and width of x and y repectively
RealGrayImage(RealGrayImage img)
          Creates an two dimensional RealGrayImage (shallow copy) from RealGrayImage img
 
Method Summary
 float absSum()
          Adds absolute value of all the values together
 RealGrayImage add(float v)
          Adds a value to all the pixels in this image
 RealGrayImage add(float v, ROI r)
          Adds a value to all the pixels in a Region of Interest
 void add(int x, int y, float value)
          Adds a value to a single pixel
 void add(int x, int y, float value, ROI r)
          Adds a value to a single pixel in a Region of Interest
 RealGrayImage add(RealGrayImage im)
          Adds another RealGrayImage to this image
 RealGrayImage add(RealGrayImage im, ROI sourceImage, ROI destImage)
          Adds a Region of Interest in another RealGrayImage to a Region of Interest of this image
 float addSum()
          Adds all the values together
 void byteSize()
          Scales the range of this image to byte (0..255)
 RealGrayImage clear()
          Clears the image to zero
 RealGrayImage clear(float 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
 RealGrayImage diff(RealGrayImage im)
          Subtracts the second image from the first and returns the absolute value
 RealGrayImage divide(float v)
          Divides all the pixels in this image by a value
 RealGrayImage divide(float v, ROI r)
          Divides all the pixels by a value in a Region of Interest
 void divide(int x, int y, float value)
          Divides a single pixel by a value
 void divide(int x, int y, float value, ROI r)
          Divides a single pixel by a value in a Region of Interest
 RealGrayImage divide(RealGrayImage im)
          Divides this image by a RealGrayImage
 RealGrayImage divide(RealGrayImage im, ROI sourceImage, ROI destImage)
          Divides by a Region of Interest in this image by a Region of Interest of another RealGrayImage
 float 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).
 float max()
          Finds the maximum value of this image
 float 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
 float min()
          Finds the minimum value of this image
 float min(ROI r)
          Finds the minimum value in a Region of Interest
 RealGrayImage multiply(float v)
          Multiplies all the pixels in this image by a value
 RealGrayImage multiply(float v, ROI r)
          Multiplies all the pixels in a Region of Interest by a value
 void multiply(int x, int y, float value)
          Mutiplies a single pixel by a value
 void multiply(int x, int y, float value, ROI r)
          Mutiplies a single pixel by a value in a Region of Interest
 RealGrayImage multiply(RealGrayImage im)
          Multiplies a RealGrayImage by this image
 RealGrayImage multiply(RealGrayImage im, ROI sourceImage, ROI destImage)
          Multiplies a Region of Interest of another RealGrayImage by a Region of Interest of this image
 void set(int x, int y, float value)
          Sets the pixel value at x, y to a given value
 void set(int x, int y, float value, ROI r)
          Sets the pixel value at x, y to a given value in a Region of Interest
 double sqrSum()
          Adds the square of all the values together
 RealGrayImage subtract(float v)
          Subtracts a value from all the pixels in this image
 RealGrayImage subtract(float v, ROI r)
          Subtracts a value from all the pixels in a Region of Interest
 void subtract(int x, int y, float value)
          Subtracts a value from a single pixel
 void subtract(int x, int y, float value, ROI r)
          Subtracts a value from a single pixel in a Region of Interest
 RealGrayImage subtract(RealGrayImage im)
          Subtracts a RealGrayImage from this image
 RealGrayImage subtract(RealGrayImage im, ROI sourceImage, ROI destImage)
          Subtracts a Region of Interest in another RealGrayImage from a Region of Interest of this image
 java.lang.String toString()
          Prints the string in integer format.
 java.lang.String toString(ROI r)
          Prints the string in integer format in a Region of Interest.
 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 float[][] data
Two dimensional float array


X

protected int X
Cartesian width


Y

protected int Y
Cartesian height

Constructor Detail

RealGrayImage

public RealGrayImage()
Creates an empty two dimensional RealGrayImage with a height and width of zero


RealGrayImage

public RealGrayImage(int x,
                     int y)
Creates a two dimensional RealGrayImage with a height and width of x and y repectively


RealGrayImage

public RealGrayImage(int x,
                     int y,
                     float[] 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 float. The array is length x*y.

RealGrayImage

public RealGrayImage(float[][] dat)
Creates a two dimensional GrayImage from a two dimensional array

Parameters:
dat - two dimensional array of short

RealGrayImage

public RealGrayImage(RealGrayImage img)
Creates an two dimensional RealGrayImage (shallow copy) from RealGrayImage img


RealGrayImage

public RealGrayImage(java.awt.Image img)
Creates a two dimensional RealGrayImage 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 RealGrayImage

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 float 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,
                      float 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 RealGrayImage clear()
Clears the image to zero


clear

public final RealGrayImage clear(float val)
Clears to constant value

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

add

public final void add(int x,
                      int y,
                      float 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,
                           float 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,
                           float 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,
                         float 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 float min()
Finds the minimum value of this image

Returns:
an float containing the minimum value

max

public final float max()
Finds the maximum value of this image

Returns:
an integer containing the maximum value

addSum

public final float addSum()
Adds all the values together


absSum

public final float absSum()
Adds absolute value of all the values together


sqrSum

public final double sqrSum()
Adds the square of all the values together


add

public final RealGrayImage add(float 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 RealGrayImage subtract(float 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 RealGrayImage multiply(float 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 RealGrayImage divide(float v)
Divides all the pixels in this image by a value

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

add

public final RealGrayImage add(RealGrayImage im)
Adds another RealGrayImage to this image

Parameters:
im - the RealGrayImage to add
Returns:
this

subtract

public final RealGrayImage subtract(RealGrayImage im)
Subtracts a RealGrayImage from this image

Parameters:
im - the RealGrayImage to subtract
Returns:
this

diff

public final RealGrayImage diff(RealGrayImage im)
Subtracts the second image from the first and returns the absolute value


multiply

public final RealGrayImage multiply(RealGrayImage im)
Multiplies a RealGrayImage by this image

Parameters:
im - the RealGrayImage to multiply
Returns:
this

divide

public final RealGrayImage divide(RealGrayImage im)
Divides this image by a RealGrayImage

Parameters:
im - the RealGrayImage to divide
Returns:
this

toString

public java.lang.String toString()
Prints the string 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 RealGrayImage
See Also:

set

public final void set(int x,
                      int y,
                      float 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,
                      float 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,
                           float 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,
                           float 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,
                         float 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 float 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 float 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 RealGrayImage add(float 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 RealGrayImage subtract(float 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 RealGrayImage multiply(float 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 RealGrayImage divide(float 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 RealGrayImage add(RealGrayImage im,
                               ROI sourceImage,
                               ROI destImage)
Adds a Region of Interest in another RealGrayImage to a Region of Interest of this image

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

subtract

public final RealGrayImage subtract(RealGrayImage im,
                                    ROI sourceImage,
                                    ROI destImage)
Subtracts a Region of Interest in another RealGrayImage from a Region of Interest of this image

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

multiply

public final RealGrayImage multiply(RealGrayImage im,
                                    ROI sourceImage,
                                    ROI destImage)
Multiplies a Region of Interest of another RealGrayImage by a Region of Interest of this image

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

divide

public final RealGrayImage divide(RealGrayImage im,
                                  ROI sourceImage,
                                  ROI destImage)
Divides by a Region of Interest in this image by a Region of Interest of another RealGrayImage

Parameters:
im - the RealGrayImage 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 the string in integer format in a Region of Interest.

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