Alineamiento de stacks en ImageJ:

Se puede hacer con 2 plugins separados:

1.  Template matching:

http://sites.google.com/site/qingzongtseng/template-matching-ij-plugin

You can download this plugin here.

And the java source code: cvMatch_Template.java and Align slices.java

You will also need OpenCV shared library( 32-bit windows, 64-bit windows or 64-bit Mac ) , javacv and JNA library.

Please see Installation for more details.

Sample images are here

Description

This ImageJ plugin contains two functions. The first one is the cvMatch_Template. It implements the template matching function from the OpenCV library. The java interface of OpenCV was done through the javacv and JNA(java nativce access). It is quite similar as the existing template matching plugin but runs much faster and users could choose among six matching methods:

1.Squared difference

2.Normalized squared difference

3.Cross correlation

4.Normalized cross correlation

5.Correlation coefficient

6.Normalized correlation coefficient

The detailed algorithms could be found here.

The cvMatch_Template will search an specific object (image pattern) over an image of interest by the user specified method.

The second function Align_slices in stack utilized the previous matching function to do slice registration(alignment) based on a selected landmark. This function will try to find the landmark or the most similar image pattern in every slice and translate each slice so that the landmark pattern will be the same position through out the whole stack. It could be used to fix the drift of a time-lapse image stacks, as shown in the following example:

#New feature: subpixel registration, updated 2011/5/13. Please see here for details.

System Requirement

ImageJ 1.44 or later, running on Java 1.6
I have only tested on the following systems.

§  64-bit ImageJ on Mac OS 10.5 and 10.6

or

§  32-bit ImageJ on windows XP

For other system architectures, you need to install the OpenCV to get the shared libraries corresponding to your system.

Installation

This plugin requires the OpenCV, javacv, and JNA (java native access) library. Javacv and JNA are provided as jar archives. We just need to put them along with the Template_Matching.jar into ImageJ plugins folder. For the OpenCV, you have two choices. Either you do a full installation of opencv on your machine (please see instructions here), or you can just download the pre-compiled library files.

Detailed steps:

(If you choose to full install OpenCV, only step one is required)


0. Close ImageJ

1. Download Template_Matching.jar , javacv.jar and jna.jar and put them into your ImageJ plugins folder (ex: C:\Program Files\ImageJ\plugins).
2. Download the opencv library files according to your system. Library for 32-bit ImageJ on windows / Library for 64-bit windows / Library for 64-bit ImageJ on Mac
3. Extract the library files.

For Windows

4a. Put the library files (libcxcore200.dll, libcv200.dll, Download as zip archive or cv100.dll cxcore100.dll for the 64-bit window system.Download as zip archive) into your ImageJ folder (ex: C:\Program Files\ImageJ)
(Note: Putting them in ImageJ\plugins and use "set path" doesn't work . Modified 2011/2/18)

For Mac

4b. Put the library files (libcxcore.2.1.0.dylib, libcxcore.2.1.dylib, libcxcore.dylib, libcv.2.1.0.dylib, libcv.2.1.dylib, libcv.dylib, Download as zip archive) into /usr/lib

( Finder>Go>Go to folder...; or cmd+shift+G. In the dialog, type /usr/lib. Click "go". Then copy the library files into it. You will need administrator privilege to put files into /usr/lib)

After installing the Template Matching plugin, you can find "cvMatch_Template..." and "Align slices in stack" functions appeared in the Template Matching subfolder within the ImageJ plugin folder.

Tutorials

Tutorial for cvMatch_Template

Tutorial for Align slices in stack

Updates

# 2012/2/29: Added the pre-compiled opencv library file for the 64-bit window system. (Thanks Yevhen Katrukha for providing the library files)

# 2011/5/30: Fixed the memory leak issue caused by the OpenCV interface.

# 2011/5/13: Boundary area for searching landmark.

# 2011/5/13: Subpixel registration.

Troubleshooting

#Q: I got a error message right after launching the plugin saying "java.lang.UnsupportedClassVersionError: Bad version number in .class file...... ".
A: It occurs when the Java version used for ImageJ (Java 1.5.xxx for ImageJ-32bit in MacOS X, Java 1.6.xxx for ImageJ-64bit in MacOS X and all the window-versions) is not compatible with the Java version used for compiling this plugin (Java 1.6.xxxx). To avoid this use the 64-bit ImageJ in Mac.

#Q: The plugin launched correctly, but after entering the parameters in the dialog window or after selecting the ROI, I got a error message saying "Plugin or class not found:"Align_slices"
(java.lang.NoClassDefFoundError: name/audet/samuel/javacv/jna/cxcore$".
A: It happens because ImageJ failed to find the javacv and jna interface. You probably forgot to put the javacv.jar and jna.jar along with the Template_Matching.jar into ImageJ's plugins folder. Please follow the steps written in the Installation part.

#Q: The plugin launched correctly, but after entering the parameters in the dialog window or after selecting the ROI, I got a error message saying "java.lang.UnsatisfiedLinkError: Unable to load library 'cxcore': ...... "
A: It happens because the system failed to load the opencv library. You probably forgot to download and put the library files (32-bit on windows or 64-bit on Mac) into correct place (ex: C:\Program Files\ImageJ or /usr/lib). Please follow the steps written in the Installation part.

Publications

1. Tseng, Q. et al. A new micropatterning method of soft substrates reveals that different tumorigenic signals can promote or reduce cell contraction levels. Lab on a Chip 11, 2231 (2011).
2. Tseng, Q. et al. Spatial Organization of the Extracellular Matrix Regulates Cell–cell Junction Positioning. PNAS (2012).doi:10.1073/pnas.1106377109

Contact

Any question or comment, please contact Qingzong TSENG (qztseng at gmail.com).

ESTE FUNCIONA BIEN PARA BEADS Y CÉLULAS

2.  StackReg

An ImageJ plugin for the recursive alignment of a stack of images.

Philippe Thévenaz, Biomedical Imaging Group, Swiss Federal Institute of Technology Lausanne

General Description

The purpose of this plugin is to register—in other words, to align or to match—a stack of image slices. In turn, each slice is used as the template with respect to which the next slice is aligned, so that the alignment proceeds by propagation. When the plugin is launched, the current slice acts as a global anchor.

The StackReg plugin requires that a second plugin, named TurboReg, is installed. This ancillary plugin is available here.

After completion of the registration process, the original stack is destroyed and replaced by the result of the registration. The name and the type of the stack is left unchanged; all data types are admissible, except RGB-stack and HSB-stack. (Please note that an RGB-stack is a stack of three color components; it should not be confounded with a stack of RGB-color images: the latter is indeed admissible, while the former is not. In case of doubt, just try; no harm will ensue.)

I. Download

This distribution is dated July 7, 2011. It includes the complete set of source files, along with the precompiled classes.

·  UNIX distribution [97,792 bytes]

·  Macintosh distribution [89,822 bytes]

·  PC distribution [39,055 bytes]

II. Related Work

The StackReg plugin requires that a second plugin, named TurboReg, is installed. This ancillary plugin is available here.

This set of Java classes is based on the following paper:
P. Thévenaz, U.E. Ruttimann, M. Unser, "A Pyramid Approach to Subpixel Registration Based on Intensity," IEEE Transactions on Image Processing, vol. 7, no. 1, pp. 27-41, January 1998. Other relevant on-line publications are available at http://bigwww.epfl.ch/publications/.

It is written as a plugin for ImageJ. Please read the ImageJ documentation to learn how to install plugins.

III. Technical Explanations

Four types of transformation are considered:

1.  Translation. The mapping of coordinates takes the form x = u + Δu. There, the input coordinate u is mapped to the output coordinate x, and the constant vector Δu gives the amount of translation.

2.  Rigid Body. The mapping of coordinates takes the form x = { {cosθ, −sinθ}, {sinθ, cosθ} } ⋅ u + Δu. Because of the presence of the term Δu, translation is considered too, in addition to the rotation by an angle θ.

3.  Scaled rotation. The mapping of coordinates takes the form x = λ { {cosθ, −sinθ}, {sinθ, cosθ} } ⋅ u + Δu. The difference with respect to a rigid-body transformation is the presence of the scalar resizing factor λ.

4.  Affine. The mapping of coordinates takes the form x = { {a11, a12}, {a21, a22} } ⋅ u + Δu. As the four coefficients a11, a12, a21, and a22 are independent, an affine transformation has even more degrees of freedom than a scaled rotation.

Those four types of transformation are available from the scroll list that should appear when the StackReg plugin is launched. The fifth transformation type (bilinear transformation), available in TurboReg, does not appear in StackReg because a combination of bilinear transformations does not generally result in a bilinear transformation. It is therefore not possible to propagate such transformations from slice to slice.

Often, performing a geometric transformation requires access to data beyond the image frame. As such data are not available, they are replaced in the output image by zeroes wherever necessary. Taking the example of a rotation, this would typically result in triangular black borders framing the output image.

IV. User Manual

Dialog box

Figure 2. Dialog box.

The dialog box of Figure 2 will appear upon launching StackReg, provided at least one image or stack is available, and provided the type of the current image is admissible. An explicit error message should appear otherwise. Clicking the [Cancel] button aborts the plugin. Setting a tickmark on the [Credits] checkbox and clicking the [OK] results in the information panel of Figure 3. Simply clicking the [OK] button applies the plugin to the current image or stack. The applied transformation is that which is selected in the [Transformation] scroll list.

The current slice will not be transformed and is used to anchor the registration. During the registration process, the slice being registered is displayed; after the registration process is completed, the display returns to the slice that was the current one at launch time.

Figure 3. Credits.

When a stack of color images is provided, the registration proceeds on a grayscale version that is built as a weighted sum of the red, green, and blue components—even when the stack is pseudo-color. The weights depend on the whole stack and are determined by a principal-component analysis in such a way as to provide the maximum possible contrast. Once the geometry has been determined on the basis of the intermediate grayscale representation, a true color image is reconstructed, and is re-quantized if it is desired to produce pseudo-colors.

The present plugin (StackReg) is used as a front-end to another plugin named TurboReg. Several mechanisms are at work to exchange data between these plugins. One of them involves temporary files which are written into the temporary directory that ImageJ defines. The location of this directory can be examined by issuing the macro command 'print(getDirectory("temp"));'. The names of the written files are

·  StackRegSource

·  StackRegSourceR

·  StackRegSourceG

·  StackRegSourceB

·  StackRegTarget

Warning: existing files of the same name in the temporary directory may be silently overwritten.

V. Macro

StackReg is scriptable and recordable. Here is an example of a call to StackReg from a macro:
run("StackReg ", "transformation=[Rigid Body]");

VI. Conditions of Use

You'll be free to use this software for research purposes, but you must not transmit and distribute it without our consent. In addition, you undertake to include a citation or acknowledgment whenever you present or publish results that are based on it. EPFL makes no warranties of any kind on this software and shall in no event be liable for damages of any kind in connection with the use and exploitation of this technology.