java.lang.Objectholoj.HoloJUtils
Class HoloJUtils contains static methods to perform useful task such as FFT and other mathematics.
Constructor Summary | |
HoloJUtils()
|
Method Summary | |
static ij.process.FloatProcessor |
add(ij.process.ImageProcessor op1,
ij.process.ImageProcessor op2)
Add each pixel ImageProcessor to pixels of another ImageProcessor one-by-one. |
static HoloJProcessor |
addPhase(HoloJProcessor processor,
double angle)
Add to the source HoloJProcessor the specified phase in radians. |
HoloJProcessor |
addPhasePlate(HoloJProcessor processor,
double[] plateArray)
Add to the specified HoloJProcessor a phase plate stored in a double array. |
static double[] |
arrangeToComplexArray(double[] real,
double[] complex)
Arranges the two double array in a single double array with the sequence: re1,im1,re2,im2,...,reN,imN. |
static double[][][] |
arrangeToComplexMatrix(double[] real,
double[] complex,
int rowWidth)
|
static double[] |
butterworthMask(int width,
int height,
int radius,
double c)
Creates a Butterworth filter mask and store it as double array. |
static ij.ImagePlus |
butterworthMaskImage(int width,
int height,
int radius,
double c,
java.lang.String title)
Creates an ImagePlus containing a Butterworth filter mask. |
static void |
c2cfft(double[] data,
int[] nn,
int isign)
Computes the Fast Fourier Transform of data passed as argument. |
static double[] |
circularMask(int width,
int height,
int radius)
Creates a circular mask and store it as double array. |
static HoloJProcessor |
divide(HoloJProcessor operand,
double value)
Divide by scalar value the real and complex pixels of HoloJProcessor operand and returns the result in a new HoloJProcessor. |
static HoloJProcessor |
divide(HoloJProcessor operand1,
HoloJProcessor operand2)
Returns the HoloJProcessor result of the complex division of operand1 by operand2. |
static ij.process.FloatProcessor |
divide(ij.process.ImageProcessor op1,
ij.process.ImageProcessor op2)
Divide pixels of ImageProcessor by pixels of another ImageProcessor one-by-one. |
static double[] |
extractComplexPixels(double[] input)
Extract the complex part of the complex array arranged with arrangeToComplexArray. |
static double[] |
extractRealPixels(double[] input)
Extract the real part of the complex array arranged with arrangeToComplexArray. |
static java.awt.Point |
getMaximumPosition(HoloJProcessor processor)
Finds the maximum of the modulus of pixels of HoloJProcessor. |
static java.awt.Point |
getMaximumPosition(HoloJProcessor processor,
ij.gui.Roi selection)
Finds the maximum of the modulus of HoloJProcessor pixels in the region specified by the selection. |
static ij.process.ImageProcessor |
getPhaseRenormalizedProcessor(ij.process.ImageProcessor source)
Renormalize the dynamic range of the source ImageProcessor to the range 2Pi. |
static java.awt.Point |
getSidebandCenter(HoloJProcessor processor,
int side)
Finds the position of the maximum lateral peak of the spectrum of HoloJProcessor. |
static ij.process.FloatProcessor |
makeCosProcessor(ij.process.ImageProcessor source)
Calculates the cosine of pixels in source. |
static ij.process.ImageProcessor |
makeInverseParabolicMask(int width,
int height)
Creates an inverse parabolic mask (intensity=1/(x^2+x^y)). |
static ij.process.ImageProcessor |
makeParabolicMask(int width,
int height)
Creates a parabolic mask (intensity=x^2+x^y). |
static ij.process.ImageProcessor |
makeSimmetricProcessor(ij.process.ImageProcessor source)
Makes a new ImageProcessor by mirroring the source processor. |
static ij.process.FloatProcessor |
makeSinProcessor(ij.process.ImageProcessor source)
Calculates the sine of pixels in source. |
static double |
modulus(double real,
double imaginary)
Calculates the modulus of complex number with real and imaginary parts passed as arguments. |
static ij.process.FloatProcessor |
multiply(double factor,
ij.process.ImageProcessor op1)
Multiply each pixel of ImageProcessor for the specified scalar factor. |
static HoloJProcessor |
multiply(HoloJProcessor operand,
double value)
Multiplies thbye scalar value the real and complex pixels of HoloJProcessor operand ad return the result in a new HoloJProcessor. |
static HoloJProcessor |
multiply(HoloJProcessor operand1,
HoloJProcessor operand2)
Returns an HoloJProcessor result from the complex multiplication of operand1 pixels for operand2 pixels. |
static ij.process.FloatProcessor |
multiply(ij.process.ImageProcessor op1,
ij.process.ImageProcessor op2)
Multiply each pixel ImageProcessor for pixels of another ImageProcessor one-by-one. |
static HoloJProcessor |
reconstruct(int radius,
int scaleFactor,
java.awt.Point sideCenter,
HoloJProcessor hologram,
boolean useButterworth)
Returns an HoloJProcessor containing reconstructed data. |
static HoloJProcessor |
reconstruct(int radius,
int scaleFactor,
java.awt.Point sideCenter,
HoloJProcessor hologram,
HoloJProcessor reference,
boolean useButterworth)
Returns an HoloJProcessor containing reconstructed data from hologram and reference. |
static void |
resetMin(ij.process.FloatProcessor ip)
Reset the minimum of FloatProcessor to zero. |
static void |
round(ij.process.FloatProcessor ip)
Round each pixel to nearby integer value. |
static HoloJProcessor |
subtract(HoloJProcessor operand,
double realValue,
double complexValue)
Subtract the complex number represented by (realValue, complexValue) from real and complex pixels of HoloJProcessor operand. |
static HoloJProcessor |
subtract(HoloJProcessor operand1,
HoloJProcessor operand2)
Subtracts the complex pixels of operand HoloJProcessor to real and complex pixels. |
static ij.process.FloatProcessor |
subtract(ij.process.ImageProcessor op1,
ij.process.ImageProcessor op2)
Subtract each pixel ImageProcessor to pixels of another ImageProcessor one-by-one. |
static HoloJProcessor |
sum(HoloJProcessor operand,
double realValue,
double complexValue)
Adds the complex number represented by (realValue, complexValue) to real and complex pixels of HoloJProcessor operand. |
static HoloJProcessor |
sum(HoloJProcessor operand1,
HoloJProcessor operand2)
Adds the complex pixels of operand1 HoloJProcessor to real and complex pixels of operand2 and returns the resulting HoloJProcessor. |
static void |
swap(double[] data,
int nx)
Swap the quadrants of data. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HoloJUtils()
Method Detail |
public static double modulus(double real, double imaginary)
real
- real part.imaginary
- complex part.
public static double[] arrangeToComplexArray(double[] real, double[] complex)
real
- real double array.complex
- complex double array.
public static double[] extractRealPixels(double[] input)
input
- the input complex array.
public static double[] extractComplexPixels(double[] input)
input
- the input complex array.
public static double[][][] arrangeToComplexMatrix(double[] real, double[] complex, int rowWidth)
public static void c2cfft(double[] data, int[] nn, int isign)
data
- data to be transformed in row-major mode and RE1,CO1,RE2,CO2... sequence.nn
- array containing dimensions os data array.isign
- forward or reverse direction.public static void swap(double[] data, int nx)
data
- array of data to be swapped.nx
- length of a row.public static double[] butterworthMask(int width, int height, int radius, double c)
width
- width of the mask.height
- height of the mask.radius
- radius of the aperture.c
- value of aperture half-width.
public static ij.ImagePlus butterworthMaskImage(int width, int height, int radius, double c, java.lang.String title)
width
- width of the mask.height
- height of the mask.radius
- radius of the aperture.c
- value of aperture half-width.
public static double[] circularMask(int width, int height, int radius)
width
- width of the mask.height
- height of the mask.radius
- radius of the aperture.
public static java.awt.Point getMaximumPosition(HoloJProcessor processor)
processor
- the HoloJProcessor.
public static java.awt.Point getMaximumPosition(HoloJProcessor processor, ij.gui.Roi selection)
processor
- HoloJProcessor to use.selection
- selected area of the pixels.
public static java.awt.Point getSidebandCenter(HoloJProcessor processor, int side)
processor
- the HoloJProcessor.side
- the selected side of spectrum.
public static HoloJProcessor sum(HoloJProcessor operand, double realValue, double complexValue)
operand
- HoloJProcessor.realValue
- real part of operand.complexValue
- complex part of operand.
public static HoloJProcessor subtract(HoloJProcessor operand, double realValue, double complexValue)
operand
- HoloJProcessor.realValue
- real part of operand.complexValue
- complex part of operand.
public static HoloJProcessor multiply(HoloJProcessor operand, double value)
operand
- HoloJProcessor.value
- scalar value multiplier.
public static HoloJProcessor divide(HoloJProcessor operand, double value)
operand
- HoloJProcessor.value
- scalar value multiplier.
public static HoloJProcessor sum(HoloJProcessor operand1, HoloJProcessor operand2)
operand1
- the first HoloJProcessor operand.operand2
- the second HoloJProcessor operand.
public static HoloJProcessor subtract(HoloJProcessor operand1, HoloJProcessor operand2)
operand1
- the HoloJProcessor first operand.operand2
- the HoloJProcessor second operand.
public static HoloJProcessor multiply(HoloJProcessor operand1, HoloJProcessor operand2)
operand1
- the HoloJProcessor first operand.operand2
- the HoloJProcessor second operand.
public static HoloJProcessor divide(HoloJProcessor operand1, HoloJProcessor operand2)
operand1
- the HoloJProcessor first operand.operand2
- the HoloJProcessor second operand.
public static HoloJProcessor reconstruct(int radius, int scaleFactor, java.awt.Point sideCenter, HoloJProcessor hologram, boolean useButterworth)
radius
- radius of reconstructed frequency region.scaleFactor
- scale factor of final reconstructed image.hologram
- hologram to be reconstructed.useButterworth
- flag for using soft aperture.
public static HoloJProcessor reconstruct(int radius, int scaleFactor, java.awt.Point sideCenter, HoloJProcessor hologram, HoloJProcessor reference, boolean useButterworth)
radius
- radius of reconstructed frequency region.scaleFactor
- scale factor of final reconstructed image.hologram
- hologram to be reconstructed.reference
- hologram used as reference in void.useButterworth
- flag for using soft aperture.
public static ij.process.FloatProcessor makeCosProcessor(ij.process.ImageProcessor source)
source
- the source ImaeProcessor.
public static ij.process.FloatProcessor makeSinProcessor(ij.process.ImageProcessor source)
source
- the source ImaeProcessor.
public static ij.process.ImageProcessor makeSimmetricProcessor(ij.process.ImageProcessor source)
source
- source ImageProcessor.
public static ij.process.ImageProcessor getPhaseRenormalizedProcessor(ij.process.ImageProcessor source)
source
- source ImageProcessor.
public static ij.process.ImageProcessor makeParabolicMask(int width, int height)
width
- width of the mask.height
- height of the mask.
public static ij.process.ImageProcessor makeInverseParabolicMask(int width, int height)
width
- width of the mask.height
- height of the mask.
public static ij.process.FloatProcessor multiply(ij.process.ImageProcessor op1, ij.process.ImageProcessor op2)
op1
- ImageProcessor 1.op2
- ImageProcessor 2.
public static ij.process.FloatProcessor multiply(double factor, ij.process.ImageProcessor op1)
factor
- scalar factor.op1
- ImageProcessor.
public static ij.process.FloatProcessor divide(ij.process.ImageProcessor op1, ij.process.ImageProcessor op2)
op1
- ImageProcessor 1.op2
- ImageProcessor 2.
public static ij.process.FloatProcessor add(ij.process.ImageProcessor op1, ij.process.ImageProcessor op2)
op1
- ImageProcessor 1.op2
- ImageProcessor 2.
public static ij.process.FloatProcessor subtract(ij.process.ImageProcessor op1, ij.process.ImageProcessor op2)
op1
- ImageProcessor 1.op2
- ImageProcessor 2.
public static void resetMin(ij.process.FloatProcessor ip)
ip
- source FloatProcessor.public static void round(ij.process.FloatProcessor ip)
ip
- source FloatProcessor.public static HoloJProcessor addPhase(HoloJProcessor processor, double angle)
processor
- an HoloJProcessor.angle
- radians to add.
public HoloJProcessor addPhasePlate(HoloJProcessor processor, double[] plateArray)
processor
- the HoloJProcessor.plateArray
- a phase plate.
Copyright 2007 © Luca Ortolani and Pier Francesco Fazzini
Permission to use the software and accompanying documentation provided on these pages for educational, research, and not-for-profit purposes, without fee and without a signed licensing agreement, is hereby granted, provided that the above copyright notice, this paragraph and the following two paragraphs appear in all copies. The copyright holder is free to make upgraded or improved versions of the software available for a fee or commercially only. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OF ANY KIND WHATSOEVER, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF HE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION IS PROVIDED "AS IS". THE COPYRIGHT HOLDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.