Register Virtual Stack Slices

Register Virtual Stack Slices (Fiji)
Author Albert Cardona (acardona@ini.phys.ethz.ch)
Maintainer Albert Cardona (acardona@ini.phys.ethz.ch)
Source on gitweb (276 lines)
Initial release 2008
Latest version  ?
Development status stable, not active
Category Category:Registration, Category:Plugins



This plugin takes a list of image slices stored in a folder, and delivers a list of registered image slices (with enlarged canvas).

This howto describes the uses of the "Register Virtual Stack Slices" plugin in Fiji for the purpose of registering the slices of a stack. The plugin uses any translation, rigid (translation+rotation), similarity (translation+rotation+isotropic scaling), affine, elastic (via bUnwarpJ with B-splines) or moving least squares transformation model, aided by automatically extracted SIFT features.

Premises:

  • You have a folder with an ordered list of image files in it that ImageJ can open.
  • Each image represents a slice in a sequence.

Images may have different dimensions and be of different type.

Step 0: <a href="http://pacific.mpi-cbg.de">Install Fiji,</a> and launch it.

Step 1: launch the "Plugins - Registration - Register Virtual Stack Slices" plugin

Step 2: choose the appropriate options:

  • The expected transformation model finding inliers (i.e. correspondences between images) in the feature extraction: translation, rigid, similarity or affine.
  • The image transformation model: translation, rigid, similarity, affine, elastic or moving least squares.
  • The advanced checkbox: whether to see the feature extraction parameters setup dialog, and if elastic, the bUnwarpJ dialog. Otherwise the plugin operates on reasonable, default parameters.

Step 3: choose the source and target folders:

  • Select a source folder containing the slices, at one slice per image file.
  • Select the target folder where resulting registered slices are automatically stored as tif files.

On success, a virtual stack will open showing all the registered images contained in the target folder. The virtual stack can be closed with no ill effect: images are saved in the target folder.

Notes:

  1. The plugin is multithreaded: more CPU cores means faster execution.
  2. The two most relevant parameters in the SIFT feature extraction are:
    • maximum image size, which limits the low-end size of the features (i.e. decrease maximum image size to increase the size of the smallest features to extract.)
    • inlier ratio, which determines when to reject the intersection set of feature correspondences between two images (ratio between correspondent features vs. all extracted features.)
  3. All types of images are accepted (8-bit, 16-bit, 32-bit and RGB), and output images are of the same type as input.


Example

Even this sequence of rather noisy transmission electron microscopy images, with considerable variations from slice to slice, get registered properly:


Raw:Registered:
Stack4.gifStack4-2.gif

Scripting / PlugIn

You can call the plugin in a non-interactive fashion from java code:

import ini.trakem2.imaging.Registration;
import register_virtual_stack.Register_Virtual_Stack_Slices;

[...]

String source_dir = "/path/to/source/";
String target_dir = "/path/to/target/";
// can be PHASE_CORRELATION or SIFT
int registration_type = Register_Virtual_Stack_Slices.PHASE_CORRELATION;
// Can be null if using PHASE_CORRELATION
Registration.SIFTParameters sp = new Registration.SIFTParameters();
// image scale at which phase-correlation works, for performance
float scale = 0.5f;
// minimum cross-correlation score to accept phase-correlation results, otherwise try pure cross-correlation
// (use as low as 0.4 if images are noisy, or at your discretion)
float min_R = 0.7;

Register_Virtual_Stack_Slices.exec(source_dir, target_dir, registration_type, sp, scale, min_R);

The above can of course be called from any scripting language, such as Jython:

from ini.trakem2.imaging import Registration
from register_virtual_stack import Register_Virtual_Stack_Slices
source_dir = "/path/to/source/"
target_dir = "/path/to/target/"
registration_type = Register_Virtual_Stack_Slices.PHASE_CORRELATION
sp = new Registration.SIFTParameters()
scale = 0.5
min_R = 0.7
Register_Virtual_Stack_Slices.exec(source_dir, target_dir, registration_type, sp, scale, min_R);

See also