JIGL
v1.6

jigl.signal
Class ComplexSignal

java.lang.Object
  |
  +--jigl.signal.ComplexSignal
All Implemented Interfaces:
Signal

public class ComplexSignal
extends Object
implements Signal

A complex signal is a set of two RealSignal planes: real plane and imagenary plane.


Field Summary
protected  RealSignal imag
          The Imaginary part of the signal
protected  int length
          Cartesian length of the signal
protected  RealSignal real
          The Real plane of the signal
 
Constructor Summary
ComplexSignal()
          Creates a ComplexSignal with length of zero and the real and imaginary planes set to null
ComplexSignal(ComplexSignal s)
          Creates a ComplexSignal as a shallow copy of a complex signal
ComplexSignal(int x)
          Creates a ComplexSignal with length of x
 
Method Summary
 void add(ComplexSignal s)
          Adds another ComplexSignal to this signal
 void add(ComplexSignal s, ROI sourceROI, ROI destROI)
          Adds a Region of Interest in another GraySignal from a Region of Interest of this signal
 ComplexSignal add(float r, float i)
          Adds a value to all the pixels in this signal.
 ComplexSignal add(float r, float i, ROI roi)
          Adds a value to all the pixels in a Region of Interest
 void add(int x, float r, float i)
          Adds a value to a single pixel
 void add(int x, float r, float i, ROI roi)
          Adds a value to a single pixel in a Region of Interest
 Signal copy()
          Makes a deep copy of this signal
 Signal copy(ROI roi)
          Makes a deep copy of a Region of Interest
 ComplexSignal diff(ComplexSignal s)
          Subtracts the second signal from the first and returns the absolute value
 void divide(ComplexSignal s)
          Divides this signal by another ComplexSignal
 void divide(ComplexSignal s, ROI sourceROI, ROI destROI)
          Divides by a Region of Interest in this signal by a Region of Interest of another ComplexSignal
 ComplexSignal divide(float r, float i)
          Divides all the pixels by a value in this signal.
 ComplexSignal divide(float r, float i, ROI roi)
          Divides all the pixels by a value in a Region of Interest
 void divide(int x, float r, float i)
          Divide a single pixel by a Complex number (r,i)
 void divide(int x, float r, float i, ROI roi)
          Divide a single pixel by a value in a Region of Interest
 float getImag(int x)
          Returns the pixel value at the given x value of the imaginary plane
 float getImag(int x, ROI roi)
          Returns the pixel value at the given x value of a Region of Interest in the imaginary plane
 float getReal(int x)
          Returns the pixel value at the given x value of the real plane
 float getReal(int x, ROI roi)
          Returns the pixel value at the given x value of a Region of Interest in the real plane
 RealSignal imag()
          Makes a shallow copy of the imaginary plane
 int length()
          Returns the length of the signal
 Complex max()
          Returns the maximum magnitude in this signal
 Complex max(ROI roi)
          Returns the maximum magnitude in a Region of Interest
 Complex min()
          Returns the minimum magnitude in this signal
 Complex min(ROI roi)
          Returns the minimum magnitude in a Region of Interest
 void multiply(ComplexSignal s)
          Multiplies this signal by another ComplexSignal
 void multiply(ComplexSignal s, ROI sourceROI, ROI destROI)
          Multiplies a Region of Interest of another GraySignal by a Region of Interest of this signal
 ComplexSignal multiply(float r, float i)
          Multiplies all the pixels in this signal by a value.
 ComplexSignal multiply(float r, float i, ROI roi)
          Multiplies all the pixels by a value in a Region of Interest
 void multiply(int x, float r, float i)
          Multiply a single pixel by a Complex number (r,i)
 void multiply(int x, float r, float i, ROI roi)
          Multiply a single pixel by a value in a Region of Interest
 RealSignal real()
          Makes a shallow copy of the real plane
 void set(int x, float r, float i)
          Sets the pixel value at x to a given value of this signal
 void set(int x, float r, float i, ROI roi)
          Sets the pixel value at x to a given value in a Region of Interest
 void setImag(int x, float v)
          Sets the pixel value at x to a given value of the imaginary
 void setImag(int x, float v, ROI roi)
          Sets the pixel value at the given x value of a Region of Interest in the imaginary plane
 void setImag(RealSignal pl)
          Set the imaginary plane of this signal
 void setReal(int x, float v)
          Sets the pixel value at x to a given value of the real plane
 void setReal(int x, float v, ROI roi)
          Sets tthe pixel value at the given x value of a Region of Interest in the real plane
 void setReal(RealSignal pl)
          Set the real plane of this signal
 void subtract(ComplexSignal s)
          Subtracts another ComplexSignal from this signal.
 void subtract(ComplexSignal s, ROI sourceROI, ROI destROI)
          Subtracts a Region of Interest in another GraySignal from a Region of Interest of this signal
 ComplexSignal subtract(float r, float i)
          Subtracts a value from all the pixels in this signal.
 ComplexSignal subtract(float r, float i, ROI roi)
          Subtracts a value from all the pixels in a Region of Interest
 void subtract(int x, float r, float i)
          Subtracts a value from a single pixel
 void subtract(int x, float r, float i, ROI roi)
          Subtracts a value from a single pixel in a Region of Interest
 String toString()
          Prints the string in integer format.
 String toString(ROI roi)
          Prints the string in integer format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

real

protected RealSignal real
The Real plane of the signal


imag

protected RealSignal imag
The Imaginary part of the signal


length

protected int length
Cartesian length of the signal

Constructor Detail

ComplexSignal

public ComplexSignal()
Creates a ComplexSignal with length of zero and the real and imaginary planes set to null


ComplexSignal

public ComplexSignal(int x)
Creates a ComplexSignal with length of x


ComplexSignal

public ComplexSignal(ComplexSignal s)
Creates a ComplexSignal as a shallow copy of a complex signal

Method Detail

length

public final int length()
Returns the length of the signal

Specified by:
length in interface Signal

real

public final RealSignal real()
Makes a shallow copy of the real plane


imag

public final RealSignal imag()
Makes a shallow copy of the imaginary plane


copy

public Signal copy()
Makes a deep copy of this signal

Specified by:
copy in interface Signal
Returns:
a deep copy of ComplexSignal

setReal

public final void setReal(RealSignal pl)
Set the real plane of this signal

Parameters:
pl - the RealSignal to set the real plane to

setImag

public final void setImag(RealSignal pl)
Set the imaginary plane of this signal

Parameters:
pl - the RealSignal to set the imaginary plane to

getReal

public final float getReal(int x)
Returns the pixel value at the given x value of the real plane

Parameters:
x - the length coordinate

getImag

public final float getImag(int x)
Returns the pixel value at the given x value of the imaginary plane

Parameters:
x - the length coordinate

setReal

public final void setReal(int x,
                          float v)
Sets the pixel value at x to a given value of the real plane

Parameters:
x - the length coordinate
v - the value to set the pixel to

setImag

public final void setImag(int x,
                          float v)
Sets the pixel value at x to a given value of the imaginary

Parameters:
x - the length coordinate
v - the value to set the pixel to

set

public final void set(int x,
                      float r,
                      float i)
Sets the pixel value at x to a given value of this signal

Parameters:
x - the length coordinate
r - the value to set the pixel to in the real plane
i - the value to set the pixel to in the imaginary plane

min

public final Complex min()
Returns the minimum magnitude in this signal


max

public final Complex max()
Returns the maximum magnitude in this signal


add

public final void add(int x,
                      float r,
                      float i)
Adds a value to a single pixel

Parameters:
x - length-coordinate
r - the value to add to the pixel in the real plane
i - the value to add to the pixel in the imaginary plane

subtract

public final void subtract(int x,
                           float r,
                           float i)
Subtracts a value from a single pixel

Parameters:
x - length-coordinate
r - the value to subtract to the pixel in the real plane
i - the value to subtract to the pixel in the imaginary plane

multiply

public final void multiply(int x,
                           float r,
                           float i)
Multiply a single pixel by a Complex number (r,i)

Parameters:
x - length-coordinate
r - the value to multiply to the pixel in the real plane
i - the value to multiply to the pixel in the imaginary plane

divide

public final void divide(int x,
                         float r,
                         float i)
Divide a single pixel by a Complex number (r,i)

Parameters:
x - length-coordinate
r - the value to divide to the pixel in the real plane
i - the value to divide to the pixel in the imaginary plane

add

public final void add(ComplexSignal s)
Adds another ComplexSignal to this signal

Parameters:
s - the ComplexSignal to add
Returns:
this

subtract

public final void subtract(ComplexSignal s)
Subtracts another ComplexSignal from this signal.

Parameters:
s - the ComplexSignal to subtract
Returns:
this

diff

public final ComplexSignal diff(ComplexSignal s)
Subtracts the second signal from the first and returns the absolute value


multiply

public final void multiply(ComplexSignal s)
Multiplies this signal by another ComplexSignal

Parameters:
s - the ComplexSignal to multiply
Returns:
this

divide

public final void divide(ComplexSignal s)
Divides this signal by another ComplexSignal

Parameters:
s - the ComplexSignal to divide
Returns:
this

add

public final ComplexSignal add(float r,
                               float i)
Adds a value to all the pixels in this signal. this is changed.

Parameters:
r - value to be added to the pixels in the real plane
i - value to be added to the pixels in the imaginary plane
Returns:
this

subtract

public final ComplexSignal subtract(float r,
                                    float i)
Subtracts a value from all the pixels in this signal. this is changed.

Parameters:
r - value to be subtract from the pixels in the real plane
i - value to be subtracted from pixels in the imaginary plane
Returns:
this

multiply

public final ComplexSignal multiply(float r,
                                    float i)
Multiplies all the pixels in this signal by a value. this is changed.

Parameters:
r - value to be multiplied by the pixels in the real plane
i - value to be multiplied by the pixels in the imaginary plane
Returns:
this

divide

public final ComplexSignal divide(float r,
                                  float i)
Divides all the pixels by a value in this signal. this is changed.

Parameters:
r - value to be divided into the pixels in the real plane
i - value to be divided into the pixels in the imaginary plane
Returns:
this

toString

public String toString()
Prints the string in integer format. The first half is for real plane, the second part is for image plane.
-Example of output on an signal with width 100 and height 120:
100 : 120
5 23 54 7 3 23 46 253 23 53 65 34 ...
100 : 120
10 20 32 12 32 56 40 59 42 39 43 ...

Specified by:
toString in interface Signal
Overrides:
toString in class Object

copy

public Signal copy(ROI roi)
Makes a deep copy of a Region of Interest

Parameters:
roi - Region of Interest
Returns:
a deep copy of ComplexSignal

getReal

public final float getReal(int x,
                           ROI roi)
Returns the pixel value at the given x value of a Region of Interest in the real plane

Parameters:
x - the length coordinate (starting from roi.lbound())
roi - Region of Interest

getImag

public final float getImag(int x,
                           ROI roi)
Returns the pixel value at the given x value of a Region of Interest in the imaginary plane

Parameters:
x - the length coordinate (starting from roi.lbound())
roi - Region of Interest

setReal

public final void setReal(int x,
                          float v,
                          ROI roi)
Sets tthe pixel value at the given x value of a Region of Interest in the real plane

Parameters:
x - the length coordinate (starting from roi.lbound())
v - the value to set
roi - Region of Interest

setImag

public final void setImag(int x,
                          float v,
                          ROI roi)
Sets the pixel value at the given x value of a Region of Interest in the imaginary plane

Parameters:
x - the length coordinate (starting from roi.lbound())
v - the value to set
roi - Region of Interest

set

public final void set(int x,
                      float r,
                      float i,
                      ROI roi)
Sets the pixel value at x to a given value in a Region of Interest

Parameters:
x - the length coordinate (starting from roi.lbound())
r - the value to set the pixel to in the real plane
i - the value to set the pixel to in the imaginary plane
roi - Region of Interest

min

public final Complex min(ROI roi)
Returns the minimum magnitude in a Region of Interest

Parameters:
roi - Region of Interest

max

public final Complex max(ROI roi)
Returns the maximum magnitude in a Region of Interest

Parameters:
roi - Region of Interest

add

public final void add(int x,
                      float r,
                      float i,
                      ROI roi)
Adds a value to a single pixel in a Region of Interest

Parameters:
x - length-coordinate (starting from roi.lbound())
r - the value to add to the pixel in the real plane
i - the value to add to the pixel in the imaginary plane
roi - Region of Interest

subtract

public final void subtract(int x,
                           float r,
                           float i,
                           ROI roi)
Subtracts a value from a single pixel in a Region of Interest

Parameters:
x - length-coordinate (starting from roi.lbound())
r - the value to add to the pixel in the real plane
i - the value to add to the pixel in the imaginary plane
roi - Region of Interest

multiply

public final void multiply(int x,
                           float r,
                           float i,
                           ROI roi)
Multiply a single pixel by a value in a Region of Interest

Parameters:
x - length-coordinate (starting from roi.lbound())
r - the value to add to the pixel in the real plane
i - the value to add to the pixel in the imaginary plane
roi - Region of Interest

divide

public final void divide(int x,
                         float r,
                         float i,
                         ROI roi)
Divide a single pixel by a value in a Region of Interest

Parameters:
x - length-coordinate (starting from roi.lbound())
r - the value to add to the pixel in the real plane
i - the value to add to the pixel in the imaginary plane
roi - Region of Interest

add

public final ComplexSignal add(float r,
                               float i,
                               ROI roi)
Adds a value to all the pixels in a Region of Interest

Parameters:
r - value to be added to the pixels in the real plane
i - value to be added to the pixels in the imaginary plane
roi - Region of Interest
Returns:
this

subtract

public final ComplexSignal subtract(float r,
                                    float i,
                                    ROI roi)
Subtracts a value from all the pixels in a Region of Interest

Parameters:
r - value to be subtract from the pixels in the real plane
i - value to be subtracted from pixels in the imaginary plane
roi - Region of Interest
Returns:
this

multiply

public final ComplexSignal multiply(float r,
                                    float i,
                                    ROI roi)
Multiplies all the pixels by a value in a Region of Interest

Parameters:
r - value to be multiplied by the pixels in the real plane
i - value to be multiplied by the pixels in the imaginary plane
roi - Region of Interest
Returns:
this

divide

public final ComplexSignal divide(float r,
                                  float i,
                                  ROI roi)
Divides all the pixels by a value in a Region of Interest

Parameters:
r - value to be divided into the pixels in the real plane
i - value to be divided into the pixels in the imaginary plane
roi - Region of Interest
Returns:
this

toString

public String toString(ROI roi)
Prints the string in integer format.
-Example of output on an signal with width 100 and height 120:
100 : 120
5 23 54 7 3 23 46 253 23 53 65 34 ...
100 : 120
10 20 32 12 32 56 40 59 42 39 43 ...

Parameters:
roi - Region of Interest

add

public final void add(ComplexSignal s,
                      ROI sourceROI,
                      ROI destROI)
Adds a Region of Interest in another GraySignal from a Region of Interest of this signal

Parameters:
s - the ComplexSignal to add
sourceROI - Region of Interest for the Source Signal
destROI - Region of Interest for the Destination Signal
Returns:
this

subtract

public final void subtract(ComplexSignal s,
                           ROI sourceROI,
                           ROI destROI)
Subtracts a Region of Interest in another GraySignal from a Region of Interest of this signal

Parameters:
s - the ComplexSignal to subtract
sourceROI - Region of Interest for the Source Signal
destROI - Region of Interest for the Destination Signal
Returns:
this

multiply

public final void multiply(ComplexSignal s,
                           ROI sourceROI,
                           ROI destROI)
Multiplies a Region of Interest of another GraySignal by a Region of Interest of this signal

Parameters:
s - the ComplexSignal to multiply
sourceROI - Region of Interest for the Source Signal
destROI - Region of Interest for the Destination Signal
Returns:
this

divide

public final void divide(ComplexSignal s,
                         ROI sourceROI,
                         ROI destROI)
Divides by a Region of Interest in this signal by a Region of Interest of another ComplexSignal

Parameters:
s - the ComplexSignal to divide
sourceROI - Region of Interest for the Source Signal
destROI - Region of Interest for the Destination Signal
Returns:
this

JIGL
v1.6

Submit a bug or feature
Revised in May 2002 by Weiming Liu