ij3d.align
Class Align2D

java.lang.Object
  extended by ij3d.align.Align2D

public class Align2D
extends java.lang.Object

Description of the Class

Author:
cedric

Field Summary
static int FILL_AVG
          Description of the Field
static int FILL_NOISE
          Description of the Field
static int FILL_NONE
          Description of the Field
protected  ij.gui.Roi selection
          Description of the Field
protected  ij3d.align.Align2DData[] serie
          Description of the Field
protected  boolean show
          Description of the Field
protected  int sizex
          Description of the Field
protected  int sizey
          Description of the Field
protected  int sizez
          Description of the Field
 
Constructor Summary
Align2D(Align2D original)
          Constructor for the Align2D object
Align2D(ij.ImageStack stack)
          Constructor for the Align2D object
 
Method Summary
 void addRotation(int img, double angleDeg)
          Adds a feature to the Rotation attribute of the Align2D object
 void addTranslation(int img, int tx, int ty)
          Adds a feature to the Translation attribute of the Align2D object
 void align2D(ij.process.ImageProcessor img1, int index2, double rangeangle, double incrementangle)
          Description of the Method
 ij.process.ImageProcessor average(boolean[] using)
          average images using a selection
 double average(int nbimg)
          Description of the Method
 TabUtil[] basicTranslation(TabUtil[] points)
          Description of the Method
 TabUtil[] centerFeatures(TabUtil[] points)
          Description of the Method
 void changeImage(int img, ij.process.ImageProcessor ip)
          Description of the Method
 void changeStack(ij.ImageStack pile)
          changes the ImageStack on which alignment is performed
 void computeRotation(boolean polar, double range, double angleprecision)
          compute the rotation for the images. the rotations will be computed between 2 consecutive images
 void computeRotation(double range, double angleprecision)
          compute the rotation for the images. the rotations will be computed between 2 consecutive images in Fourier Space
static double computeRotation2Images(ij.process.ImageProcessor img1, ij.process.ImageProcessor img2, double range, double angleprecision)
          compute the rotation between 2 images in space domain
the second image is rotated in the allowed range and the rotation obtaining the best correlation coefficient is returned
static double computeRotation2ImagesFHT(ij.process.ImageProcessor image1, ij.process.ImageProcessor image2, double range, double angleprecision)
          compute the rotation between 2 images using the Fourier Transform.
 void computeRotationOld(double range, double angleprecision)
          Description of the Method
static double correlation(ij.process.ImageProcessor img1, ij.process.ImageProcessor img2, double rayonmaxx, double rayonmaxy)
          compute the correlation between 2 images
static Pixel3D crossCorrelation(ij.process.ImageProcessor img1, ij.process.ImageProcessor img2)
          computes the crosscorrelation between 2 images using FFT
static Pixel3D crossCorrelation(ij.process.ImageProcessor img1, ij.process.ImageProcessor img2, int maxX, int maxY)
          compute the crosscorrelation between 2 images with a maximum translation of (maxX,maxY)
 void deleteImage(int image)
          Description of the Method
 ij.process.ImageProcessor doRFA(double rangeangle, double incrementangle)
          align all images using RFA procedure (Penczek 1992)
 ij.process.ImageProcessor getImage(int img)
          Gets the image attribute of the Align2D object
 ij.process.ImageProcessor getImage(int img, boolean applytransform)
          Gets the image attribute of the Align2D object
 ij.process.ImageProcessor getImage(int img, boolean applytransform, int fill)
          Gets the image attribute of the Align2D object
 ij.ImageStack getInStack(ij.ImageStack stack, boolean applytransform, int fill)
          gets the images on which the alignment is performed in the given stack
the images could be with or without alignement beware there is always a duplication of the images (even if not applying alignment)
 Align2D getPart(int indexstart, int increment, int nbimages)
          Gets the part attribute of the Align2D object
 float getPixelValue(int img, int x, int y)
          Gets the pixelValue attribute of the Align2D object
 ij.gui.Roi getRoi()
          Gets the roi attribute of the Align2D object
 double getRotation(int img)
          Gets the rotation attribute of the Align2D object
 ij.ImageStack getStack(boolean applytransform, int fill)
          gets the images on which the alignment is performed
the images could be with or without alignement beware there is always a duplication of the images (even if not applying alignment)
 int getTx(int img)
          Gets the translation on X Axis for an image
 int getTy(int img)
          Gets the translation on Y Axis for an image
 ij.process.ImageProcessor insert2(ij.process.ImageProcessor G, int rayon, boolean up)
          Description of the Method
 TabUtil[] meanSquare(TabUtil[] points)
          Description of the Method
 void reset()
          Description of the Method
 void setRoi(ij.gui.Roi sel)
          Sets the roi attribute of the Align2D object
 void setRotation(int img, double angleDeg)
          Sets the rotation attribute of the Align2D object
 void setStack(ij.ImageStack pile)
          Sets the images to work with
 void setTranslation(int img, int tx, int ty)
          Sets the translation attribute of the Align2D object
 void setTx(int img, int value)
          Gets the translation on X Axis for an image
 void setTy(int img, int value)
          Gets the translation on Y Axis for an image
 void showInIJ(boolean value)
          shows progress of computing in the status bar of ImageJ
 double sigma(int img, double avg)
          Description of the Method
static ij.process.ImageProcessor toPolar(ij.process.ImageProcessor img, double range, double angleprecision)
          convert image to the polar coordinate system
all angles are not taken, only those between +/- range
 void XCorr()
          crosscorrelation of all images
 TabUtil[] XCorr(TabUtil[] points)
          Description of the Method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serie

protected ij3d.align.Align2DData[] serie
Description of the Field


show

protected boolean show
Description of the Field


sizex

protected int sizex
Description of the Field


sizey

protected int sizey
Description of the Field


sizez

protected int sizez
Description of the Field


selection

protected ij.gui.Roi selection
Description of the Field


FILL_NONE

public static int FILL_NONE
Description of the Field


FILL_AVG

public static int FILL_AVG
Description of the Field


FILL_NOISE

public static int FILL_NOISE
Description of the Field

Constructor Detail

Align2D

public Align2D(ij.ImageStack stack)
Constructor for the Align2D object

Parameters:
stack - the stack to register

Align2D

public Align2D(Align2D original)
Constructor for the Align2D object

Parameters:
original - the object to copy beware the images are the same for the 2 objects there is no duplication
Method Detail

showInIJ

public void showInIJ(boolean value)
shows progress of computing in the status bar of ImageJ

Parameters:
value - true for showing (by default in constructor) false otherwise

setStack

public void setStack(ij.ImageStack pile)
Sets the images to work with

Parameters:
pile - The new ImageStack on which perform alignment

changeStack

public void changeStack(ij.ImageStack pile)
changes the ImageStack on which alignment is performed

Parameters:
pile - the new ImageStack on which the alignment is computed beware the previous alignment is not deleted

getStack

public ij.ImageStack getStack(boolean applytransform,
                              int fill)
gets the images on which the alignment is performed
the images could be with or without alignement beware there is always a duplication of the images (even if not applying alignment)

Parameters:
applytransform - true for registered version
fill - Description of the Parameter
Returns:
the images aligned or not.

getInStack

public ij.ImageStack getInStack(ij.ImageStack stack,
                                boolean applytransform,
                                int fill)
gets the images on which the alignment is performed in the given stack
the images could be with or without alignement beware there is always a duplication of the images (even if not applying alignment)

Parameters:
stack - stack in which inserting the aligned images
applytransform - true for registered version
fill - Description of the Parameter
Returns:
the images aligned or not.

getImage

public ij.process.ImageProcessor getImage(int img,
                                          boolean applytransform)
Gets the image attribute of the Align2D object

Parameters:
img - Description of the Parameter
applytransform - Description of the Parameter
Returns:
The image value

getImage

public ij.process.ImageProcessor getImage(int img,
                                          boolean applytransform,
                                          int fill)
Gets the image attribute of the Align2D object

Parameters:
img - Description of the Parameter
applytransform - Description of the Parameter
fill - Description of the Parameter
Returns:
The image value

getImage

public ij.process.ImageProcessor getImage(int img)
Gets the image attribute of the Align2D object

Parameters:
img - Description of the Parameter
Returns:
The image value

changeImage

public void changeImage(int img,
                        ij.process.ImageProcessor ip)
Description of the Method

Parameters:
img - Description of the Parameter
ip - Description of the Parameter

getPixelValue

public float getPixelValue(int img,
                           int x,
                           int y)
Gets the pixelValue attribute of the Align2D object

Parameters:
img - Description of the Parameter
x - Description of the Parameter
y - Description of the Parameter
Returns:
The pixelValue value

getPart

public Align2D getPart(int indexstart,
                       int increment,
                       int nbimages)
Gets the part attribute of the Align2D object

Parameters:
indexstart - Description of the Parameter
nbimages - Description of the Parameter
increment - Description of the Parameter
Returns:
The part value

setRoi

public void setRoi(ij.gui.Roi sel)
Sets the roi attribute of the Align2D object

Parameters:
sel - The new roi value

getRoi

public ij.gui.Roi getRoi()
Gets the roi attribute of the Align2D object

Returns:
The roi value

reset

public void reset()
Description of the Method


deleteImage

public void deleteImage(int image)
Description of the Method

Parameters:
image - Description of the Parameter

getTx

public int getTx(int img)
Gets the translation on X Axis for an image

Parameters:
img - image number in the serie ... be careful start at 0 not 1
Returns:
the Translations on X

getTy

public int getTy(int img)
Gets the translation on Y Axis for an image

Parameters:
img - image number in the serie ... be careful start at 0 not 1
Returns:
the Translations on Y

getRotation

public double getRotation(int img)
Gets the rotation attribute of the Align2D object

Parameters:
img - Description of the Parameter
Returns:
The rotation value

setTx

public void setTx(int img,
                  int value)
Gets the translation on X Axis for an image

Parameters:
img - image number in the serie ... be careful start at 0 not 1
value - The new tx value

setTy

public void setTy(int img,
                  int value)
Gets the translation on Y Axis for an image

Parameters:
img - image number in the serie ... be careful start at 0 not 1
value - The new ty value

setTranslation

public void setTranslation(int img,
                           int tx,
                           int ty)
Sets the translation attribute of the Align2D object

Parameters:
img - The new translation value
tx - The new translation value
ty - The new translation value

addTranslation

public void addTranslation(int img,
                           int tx,
                           int ty)
Adds a feature to the Translation attribute of the Align2D object

Parameters:
img - The feature to be added to the Translation attribute
tx - The feature to be added to the Translation attribute
ty - The feature to be added to the Translation attribute

setRotation

public void setRotation(int img,
                        double angleDeg)
Sets the rotation attribute of the Align2D object

Parameters:
img - The new rotation value
angleDeg - The new rotation value

addRotation

public void addRotation(int img,
                        double angleDeg)
Adds a feature to the Rotation attribute of the Align2D object

Parameters:
img - The feature to be added to the Rotation attribute
angleDeg - The feature to be added to the Rotation attribute

XCorr

public TabUtil[] XCorr(TabUtil[] points)
Description of the Method

Parameters:
points - Description of the Parameter
Returns:
Description of the Return Value

XCorr

public void XCorr()
crosscorrelation of all images


insert2

public ij.process.ImageProcessor insert2(ij.process.ImageProcessor G,
                                         int rayon,
                                         boolean up)
Description of the Method

Parameters:
G - Description of the Parameter
rayon - Description of the Parameter
up - Description of the Parameter
Returns:
Description of the Return Value

meanSquare

public TabUtil[] meanSquare(TabUtil[] points)
Description of the Method

Parameters:
points - Description of the Parameter
Returns:
Description of the Return Value

basicTranslation

public TabUtil[] basicTranslation(TabUtil[] points)
Description of the Method

Parameters:
points - Description of the Parameter
Returns:
Description of the Return Value

centerFeatures

public TabUtil[] centerFeatures(TabUtil[] points)
Description of the Method

Parameters:
points - Description of the Parameter
Returns:
Description of the Return Value

average

public double average(int nbimg)
Description of the Method

Parameters:
nbimg - Description of the Parameter
Returns:
Description of the Return Value

sigma

public double sigma(int img,
                    double avg)
Description of the Method

Parameters:
avg - Description of the Parameter
img - Description of the Parameter
Returns:
Description of the Return Value

crossCorrelation

public static Pixel3D crossCorrelation(ij.process.ImageProcessor img1,
                                       ij.process.ImageProcessor img2)
computes the crosscorrelation between 2 images using FFT

Parameters:
img1 - first image (reference)
img2 - second image
Returns:
Pixel3D containing the shifts in X,Y and Z(should be zero!) and the pixel value is the correlation value

crossCorrelation

public static Pixel3D crossCorrelation(ij.process.ImageProcessor img1,
                                       ij.process.ImageProcessor img2,
                                       int maxX,
                                       int maxY)
compute the crosscorrelation between 2 images with a maximum translation of (maxX,maxY)

Parameters:
img1 - reference image
img2 - image to translate
maxX - maximum translation on X axis
maxY - maximum translation on Y axis
Returns:
translation obtaining best correlation score

computeRotation2ImagesFHT

public static double computeRotation2ImagesFHT(ij.process.ImageProcessor image1,
                                               ij.process.ImageProcessor image2,
                                               double range,
                                               double angleprecision)
compute the rotation between 2 images using the Fourier Transform.
use the power spectrum to be free of translation
then convert to polar coordinate to compute rotation with cross-correlation

Parameters:
image1 - reference image
image2 - image to rotate
range - the rotation computed will be between [-range,+range[
angleprecision - the precision wanted (1 for degrees precision, 0.1 for decidegrees precision)
Returns:
angle in degrees to rotate the second image for it to coincide with the first

toPolar

public static ij.process.ImageProcessor toPolar(ij.process.ImageProcessor img,
                                                double range,
                                                double angleprecision)
convert image to the polar coordinate system
all angles are not taken, only those between +/- range

Parameters:
img - image to convert (not modified)
range - the rotation taken for new image will be between [-range,+range[
angleprecision - the precision wanted (1 for degrees precision, 0.1 for decidegrees precision)
Returns:
converted image

computeRotation2Images

public static double computeRotation2Images(ij.process.ImageProcessor img1,
                                            ij.process.ImageProcessor img2,
                                            double range,
                                            double angleprecision)
compute the rotation between 2 images in space domain
the second image is rotated in the allowed range and the rotation obtaining the best correlation coefficient is returned

Parameters:
img1 - Description of the Parameter
img2 - Description of the Parameter
range - the rotation computed will be between [-range,+range[
angleprecision - the precision wanted (1 for degrees precision, 0.1 for decidegrees precision)
Returns:
angle in degrees to rotate the second image for it to coincide with the first

computeRotation

public void computeRotation(double range,
                            double angleprecision)
compute the rotation for the images. the rotations will be computed between 2 consecutive images in Fourier Space

Parameters:
range - the rotations computed will be between [-range,+range[
angleprecision - the precision wanted (1 for degrees precision, 0.1 for decidegrees precision)

computeRotation

public void computeRotation(boolean polar,
                            double range,
                            double angleprecision)
compute the rotation for the images. the rotations will be computed between 2 consecutive images

Parameters:
polar - true if computation in fourier space false for computation in real space
range - the rotations computed will be between [-range,+range[
angleprecision - the precision wanted (1 for degrees precision, 0.1 for decidegrees precision)

computeRotationOld

public void computeRotationOld(double range,
                               double angleprecision)
Description of the Method

Parameters:
range - Description of the Parameter
angleprecision - Description of the Parameter

correlation

public static double correlation(ij.process.ImageProcessor img1,
                                 ij.process.ImageProcessor img2,
                                 double rayonmaxx,
                                 double rayonmaxy)
compute the correlation between 2 images

Parameters:
img1 - first image
img2 - second image
rayonmaxx - maximum radius on X axis to take pixels into account
rayonmaxy - maximum radius on Y axis to take pixels into account
Returns:
correlation score

average

public ij.process.ImageProcessor average(boolean[] using)
average images using a selection

Parameters:
using - array containing true for all images that are added to the average
Returns:
average image

doRFA

public ij.process.ImageProcessor doRFA(double rangeangle,
                                       double incrementangle)
align all images using RFA procedure (Penczek 1992)

Parameters:
rangeangle - Description of the Parameter
incrementangle - Description of the Parameter
Returns:
Description of the Return Value

align2D

public void align2D(ij.process.ImageProcessor img1,
                    int index2,
                    double rangeangle,
                    double incrementangle)
Description of the Method

Parameters:
img1 - Description of the Parameter
index2 - Description of the Parameter
rangeangle - Description of the Parameter
incrementangle - Description of the Parameter