uk.ac.ed.ph.signal
Class Image

java.lang.Object
  extended by javax.vecmath.Tuple2d
      extended by javax.vecmath.Point2d
          extended by uk.ac.ed.ph.signal.Grid2d
              extended by uk.ac.ed.ph.signal.Image
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
ComplexImage, RealImage

public class Image
extends Grid2d

General class to handle images, always called via the extending classes of RealImage and ComplexImage

See Also:
Serialized Form

Field Summary
protected  DataArray data
          The data array that hold the actual data
protected  Statistics statistics
          The Image statistics
 
Fields inherited from class uk.ac.ed.ph.signal.Grid2d
height, width
 
Fields inherited from class javax.vecmath.Tuple2d
x, y
 
Constructor Summary
protected Image()
          Default constructor to do nothing but setup the underlying class
protected Image(Image s)
          Setup image size and sample parameters from speficied image, but do not allocate array.
protected Image(int w, int h)
          Setup image of size w by h, but do not allocated DataArray.
 
Method Summary
 void add(Image s)
          Method to add a specified Image to the current Image, both must be the same size.
 void add(int i, int j, double a)
          Add a value to a pixel
 void add(javax.vecmath.Point2i p, double a)
          Add a value to a pixel
 void centreFourier()
          Method to take the Centre Fourier tranform of the data and also set the underlying sampling
 void conjugate()
          Method to take conjugate of the whole Image If data is real this call is ignored.
 void conjugate(int i, int j)
          Method to form the Complex conjugate of an element.
 void conjugate(javax.vecmath.Point2i p)
          Method to form the Complex conjugate of an element.
 void fill(Surface s)
          Method to fill the image with a Surface
 void fourier()
          Method to take the Fourier tranform of the data and also set the underlying sampling
 Complex getComplex(int i, int j)
          Method to get a Complex data point
 Complex getComplex(javax.vecmath.Point2i p)
          Method to get a Complex data point
 int getConversion()
          Method to get the current complex to real conversion flag
 double[] getDataBuffer()
          Method to get the underlying data buffer as a one-dimensional array of double[]
 double getDouble(int i, int j)
          Method to get a double pixel value
 double getDoubleValue(int i, int j, int flag)
          Method to get a from Complex data type with conversion to a double given by the control flag
 int getSpace()
          Methdo to get the Space
 String getTitle()
          Method Get the title
 String getType()
          Method to get the type
 void mult(Complex c)
          Method to multiply the whole Image by a Complex.
 void mult(double a)
          Method to muliply the whole Image by a scalar
 void mult(double a, double b)
          Method to multiply the whole Image by a complex specifed as two doubles.
 void mult(Image s)
          Method to multiply the current Image by a specified Image which must be of the same size, the result overwriting the contents of the current Image.
 void mult(int i, int j, Complex c)
          Multiply a pixel by a Complex
 void mult(int i, int j, double a)
          Multiply a pixel by a double
 void mult(javax.vecmath.Point2i p, Complex c)
          Multiply a pixel by a Complex
 void mult(javax.vecmath.Point2i p, double a)
          Multiply a pixel by a double
 void multConjugate(Image s)
          Method to multiply the current Image by the Complex Conjugate of specified Image which must be of the same size the result overwriting the contents of the current Image.
 void setComplex(int i, int j, Complex c)
          Method to set a pixel value with a complex.
 void setComplex(int i, int j, double a, double b)
          Method to set a pixel value with a complex given at two doubles
 void setComplex(javax.vecmath.Point2i p, Complex c)
          Method to set a pixel value with a complex
 void setComplex(javax.vecmath.Point2i p, double a, double b)
          Method to set a pixel value with a complex given at two doubles
 void setConversion(int flag)
          Method to set the default conversion flag
 void setDouble(int i, int j, double value)
          Method to set a pixel value with a double
 void setDouble(javax.vecmath.Point2i p, double value)
          Method to set a pixel value with a double
 void setStatisticsInvalid()
          Method to set the statiscics invalid to force re-caalculation
 void setTitle(String t)
          Method to set the title
 String toString()
          Method to format the image information as a String
 boolean validStatistics()
          Method to report if the statistic are valis
 
Methods inherited from class uk.ac.ed.ph.signal.Grid2d
clone, getCentre, getDeltaX, getDeltaY, getHeight, getPoint, getPoint, getSample, getSamplePoint, getWidth, getXCentre, getXRange, getYCentre, getYRange, setCentre, setCentre, setHeight, setRange, setRange, setSampleGrid, setSampleGrid, setWidth
 
Methods inherited from class javax.vecmath.Point2d
distance, distanceL1, distanceLinf, distanceSquared
 
Methods inherited from class javax.vecmath.Tuple2d
absolute, absolute, add, add, clamp, clamp, clampMax, clampMax, clampMin, clampMin, epsilonEquals, equals, equals, get, getX, getY, hashCode, interpolate, interpolate, negate, negate, scale, scale, scaleAdd, scaleAdd, set, set, set, set, setX, setY, sub, sub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

statistics

protected Statistics statistics
The Image statistics


data

protected DataArray data
The data array that hold the actual data

Constructor Detail

Image

protected Image()
Default constructor to do nothing but setup the underlying class


Image

protected Image(int w,
                int h)
Setup image of size w by h, but do not allocated DataArray.


Image

protected Image(Image s)
Setup image size and sample parameters from speficied image, but do not allocate array.

Method Detail

setTitle

public void setTitle(String t)
Method to set the title

Parameters:
t - the title

getTitle

public String getTitle()
Method Get the title

Returns:
String the title

getSpace

public int getSpace()
Methdo to get the Space

Returns:
int the space flag

getType

public String getType()
Method to get the type

Returns:
String the type

getDataBuffer

public double[] getDataBuffer()
Method to get the underlying data buffer as a one-dimensional array of double[]


getConversion

public int getConversion()
Method to get the current complex to real conversion flag


setConversion

public void setConversion(int flag)
Method to set the default conversion flag

Parameters:
flag - the conversion flag

setDouble

public void setDouble(int i,
                      int j,
                      double value)
Method to set a pixel value with a double

Parameters:
i - primary location
j - secondary location
value - the pixel value

setDouble

public void setDouble(javax.vecmath.Point2i p,
                      double value)
Method to set a pixel value with a double

Parameters:
p - pixel location
value - the pixel value

getDouble

public double getDouble(int i,
                        int j)
Method to get a double pixel value

Parameters:
i - primary location
j - secondary location
Returns:
double the pixel value

getDoubleValue

public double getDoubleValue(int i,
                             int j,
                             int flag)
Method to get a from Complex data type with conversion to a double given by the control flag

Parameters:
i - primary location
j - secondary location
flag - conversion flag

setComplex

public void setComplex(int i,
                       int j,
                       double a,
                       double b)
Method to set a pixel value with a complex given at two doubles

Parameters:
i - primary location
j - secondary location
a - the real value
b - the imaginary value

setComplex

public void setComplex(int i,
                       int j,
                       Complex c)
Method to set a pixel value with a complex.

Parameters:
i - primary location
j - secondary location
c - the Complex value

setComplex

public void setComplex(javax.vecmath.Point2i p,
                       double a,
                       double b)
Method to set a pixel value with a complex given at two doubles

Parameters:
p - pixel location
a - the real value
b - the imaginary value

setComplex

public void setComplex(javax.vecmath.Point2i p,
                       Complex c)
Method to set a pixel value with a complex

Parameters:
p - pixel location
c - the Complex value

getComplex

public Complex getComplex(int i,
                          int j)
Method to get a Complex data point

Parameters:
i - primary index
j - seconary index
Returns:
Complex Complex pixel value

getComplex

public Complex getComplex(javax.vecmath.Point2i p)
Method to get a Complex data point

Parameters:
p - pixel location
Returns:
Complex Complex pixel value

add

public void add(int i,
                int j,
                double a)
Add a value to a pixel

Parameters:
i - the i location.
j - the j location.
a - the value to be added

add

public void add(javax.vecmath.Point2i p,
                double a)
Add a value to a pixel

Parameters:
p - the pixel point.
a - the value to be added

mult

public void mult(int i,
                 int j,
                 double a)
Multiply a pixel by a double

Parameters:
i - primary index
j - seconary index
a - the multiplier

mult

public void mult(javax.vecmath.Point2i p,
                 double a)
Multiply a pixel by a double

Parameters:
p - pixel location
a - the multiplier

mult

public void mult(int i,
                 int j,
                 Complex c)
Multiply a pixel by a Complex

Parameters:
i - primary index
j - seconary index
c - the multiplier

mult

public void mult(javax.vecmath.Point2i p,
                 Complex c)
Multiply a pixel by a Complex

Parameters:
p - pixel location
c - the multiplier

conjugate

public void conjugate(int i,
                      int j)
Method to form the Complex conjugate of an element.

Parameters:
i - the element index
j - the eleemnt index

conjugate

public void conjugate(javax.vecmath.Point2i p)
Method to form the Complex conjugate of an element.

Parameters:
i - the element index
j - the eleemnt index

conjugate

public void conjugate()
Method to take conjugate of the whole Image If data is real this call is ignored.


mult

public void mult(double a)
Method to muliply the whole Image by a scalar

Parameters:
a - the scalar

mult

public void mult(double a,
                 double b)
Method to multiply the whole Image by a complex specifed as two doubles. This is only valid if the data is Complex.

Parameters:
a - the real part
b - the imaginary.

mult

public void mult(Complex c)
Method to multiply the whole Image by a Complex. This is only valid if the data is Complex.

Parameters:
c - the Complex multiplier.

add

public void add(Image s)
Method to add a specified Image to the current Image, both must be the same size.

This will work for all conbinations expect for current Signal being Real and specifed Image being Complex.

Internally this uses direct array access so it much more efficient than loops with setter/getters.

Parameters:
s - the Signal to be added.

mult

public void mult(Image s)
Method to multiply the current Image by a specified Image which must be of the same size, the result overwriting the contents of the current Image.

This will work for all conbinations expect for current Signal being Real and specifed Image being Complex.

Internal this uses uses direct array access so it much more efficient than loops with setter/getters.

Parameters:
s - the specified Signal

multConjugate

public void multConjugate(Image s)
Method to multiply the current Image by the Complex Conjugate of specified Image which must be of the same size the result overwriting the contents of the current Image.

If the current or specifed DataArray(s) are real, then this method is identical to mult(Signal)

Parameters:
s - the Signal
See Also:
#mult(Signal)

fill

public void fill(Surface s)
Method to fill the image with a Surface


validStatistics

public boolean validStatistics()
Method to report if the statistic are valis


setStatisticsInvalid

public void setStatisticsInvalid()
Method to set the statiscics invalid to force re-caalculation


fourier

public void fourier()
Method to take the Fourier tranform of the data and also set the underlying sampling


centreFourier

public void centreFourier()
Method to take the Centre Fourier tranform of the data and also set the underlying sampling


toString

public String toString()
Method to format the image information as a String

Overrides:
toString in class javax.vecmath.Tuple2d
Returns:
String image imformation String