public class Register_Virtual_Stack_MT extends Object implements ij.plugin.PlugIn
Requires: a directory with images, of any size and type (8, 16, 32-bit gray-scale or RGB color)
Performs: registration of a sequence of images, by 6 different registration models:
Outputs: the list of new images, one for slice, into a target directory as .tif files.
For a detailed documentation, please visit the plugin website at:
Modifier and Type | Class and Description |
---|---|
static class |
Register_Virtual_Stack_MT.Param
Registration parameters class.
|
Modifier and Type | Field and Description |
---|---|
static boolean |
advanced
advance options flag
|
static int |
AFFINE
affine registration model id
|
static String |
currentDirectory
working directory path
|
static boolean |
displayRelaxGraph
display relaxation graph flag
|
static int |
ELASTIC
elastic registration model id
|
static String |
exts
possible extensions of files to be registered/transformed
|
static int |
featuresModelIndex
index of the features model check-box
|
static String[] |
featuresModelStrings
feature model string labels
|
static int |
MAX_ITER
maximum number of iterations in the relaxation loop
|
static int |
MOVING_LEAST_SQUARES
maximal warping registration model id
|
static boolean |
non_shrinkage
shrinkage constraint flag
|
static String |
outputDirectory
output directory
|
static boolean |
postprocess
post-processing flag
|
static int |
registrationModelIndex
index of the registration model check-box
|
static String[] |
registrationModelStrings
registration model string labels
|
static int |
RIGID
rigid-body registration model id
|
static boolean |
save_transforms
save transformation flag
|
static int |
SIMILARITY
rigid-body + isotropic scaling registration model id
|
static String |
sourceDirectory
source directory
|
static float |
STOP_THRESHOLD
relaxation threshold (if the difference between last two iterations is below this threshold, the relaxation stops
|
static int |
TRANSLATION
translation registration model id
|
static double |
tweakIso
isotropy (aspect ratio) regularization parameter [0.0-1.0]
|
static double |
tweakScale
scaling regularization parameter [0.0-1.0]
|
static double |
tweakShear
shear regularization parameter [0.0-1.0]
|
Constructor and Description |
---|
Register_Virtual_Stack_MT() |
Modifier and Type | Method and Description |
---|---|
static List<PointMatch> |
applyTransformReverse(List<PointMatch> list,
CoordinateTransform t)
Apply a transformation to the second point (P2) of a list of Point matches
|
static boolean |
createResults(String source_dir,
String[] sorted_file_names,
String target_dir,
String save_dir,
CoordinateTransform[] transform,
boolean interpolate)
Create final target images
|
static void |
exec(String source_dir,
String[] sorted_file_names,
int referenceIndex,
String target_dir,
String save_dir,
Register_Virtual_Stack_MT.Param p)
Execution method.
|
static void |
exec(String source_dir,
String[] sorted_file_names,
String target_dir,
String save_dir,
Register_Virtual_Stack_MT.Param p)
Execute registration with non-shrinking constrain
|
static void |
exec(String source_dir,
String target_dir,
String save_dir,
String referenceName,
int featuresModelIndex,
int registrationModelIndex,
boolean advanced,
boolean non_shrink)
Execution method.
|
static void |
exec(String source_dir,
String target_dir,
String save_dir,
String referenceName,
Register_Virtual_Stack_MT.Param p,
boolean non_shrink)
Execute registration when all parameters are set.
|
static void |
fitInliers(Register_Virtual_Stack_MT.Param p,
CoordinateTransform t,
List<PointMatch> inliers)
Fit inliers given a registration model
|
static void |
flush(ij.ImagePlus imp) |
static CoordinateTransform |
getCoordinateTransform(Register_Virtual_Stack_MT.Param p)
Get a new coordinate transform given a registration model
|
static AffineTransform |
makeAffineMatrix(double scalex,
double scaley,
double shearx,
double sheary,
double rotang,
double transx,
double transy)
Makes an affine transformation matrix from the given scale, shear,
rotation and translation values
if you want a uniquely retrievable matrix, give sheary=0
|
static void |
postProcessTransforms(CoordinateTransform[] transform)
Correct transforms from global scaling or rotation
|
static void |
randomize(int[] array)
Randomize array of integers
|
static ij.ImagePlus |
readImage(String path)
Read image files
|
static boolean |
register(ij.ImagePlus imp1,
ij.ImagePlus imp2,
ij.ImagePlus imp1mask,
ij.ImagePlus imp2mask,
int i,
String[] sorted_file_names,
String source_dir,
String target_dir,
ExecutorService exe,
Register_Virtual_Stack_MT.Param p,
CoordinateTransform t,
Rectangle commonBounds,
List<Rectangle> bounds,
int referenceIndex)
Register two images with corresponding masks and
following the features and registration models.
|
static void |
regularize(CoordinateTransform t,
int index)
Regularize coordinate transform
|
static boolean |
relax(List<PointMatch>[] inliers,
CoordinateTransform[] transform,
Register_Virtual_Stack_MT.Param p)
Relax inliers
|
void |
run(String arg)
Plug-in run method
|
static boolean |
showRegularizationDialog(Register_Virtual_Stack_MT.Param p)
Shows regularization dialog when "Shrinkage constrain" is checked.
|
public static final int TRANSLATION
public static final int RIGID
public static final int SIMILARITY
public static final int AFFINE
public static final int ELASTIC
public static final int MOVING_LEAST_SQUARES
public static int featuresModelIndex
public static int registrationModelIndex
public static String currentDirectory
public static boolean advanced
public static boolean non_shrinkage
public static boolean save_transforms
public static String sourceDirectory
public static String outputDirectory
public static double tweakScale
public static double tweakShear
public static double tweakIso
public static boolean displayRelaxGraph
public static boolean postprocess
public static final String[] registrationModelStrings
public static final String[] featuresModelStrings
public static final float STOP_THRESHOLD
public static final int MAX_ITER
public static final String exts
public void run(String arg)
run
in interface ij.plugin.PlugIn
arg
- plug-in argumentspublic static void exec(String source_dir, String target_dir, String save_dir, String referenceName, int featuresModelIndex, int registrationModelIndex, boolean advanced, boolean non_shrink)
source_dir
- Directory to read all images from, where each image is a slice in a sequence. Their names must be bit-sortable, i.e. if numbered, they must be padded with zeros.target_dir
- Directory to store registered slices into.save_dir
- Directory to store transform files into.referenceName
- File name of the reference image.featuresModelIndex
- Index of the features extraction model (0=TRANSLATION, 1=RIGID, 2=SIMILARITY, 3=AFFINE)registrationModelIndex
- Index of the registration model (0=TRANSLATION, 1=RIGID, 2=SIMILARITY, 3=AFFINE, 4=ELASTIC, 5=MOVING_LEAST_SQUARES)advanced
- Triggers showing parameters setup dialogsnon_shrink
- Triggers showing non-shrinking dialog (if advanced options are selected as well) and executionpublic static void exec(String source_dir, String target_dir, String save_dir, String referenceName, Register_Virtual_Stack_MT.Param p, boolean non_shrink)
source_dir
- Directory to read all images from, where each image is a slice in a sequence. Their names must be bit-sortable, i.e. if numbered, they must be padded with zeros.target_dir
- Directory to store registered slices into.save_dir
- Directory to store transform files into.referenceName
- File name of the reference image (if necessary, for non-shrinkage mode, it can be null)p
- Registration parametersnon_shrink
- non shrinking mode flagpublic static void exec(String source_dir, String[] sorted_file_names, String target_dir, String save_dir, Register_Virtual_Stack_MT.Param p)
source_dir
- Directory to read all images from, where each image is a slice in a sequence. Their names must be bit-sortable, i.e. if numbered, they must be padded with zeros.sorted_file_names
- Array of sorted source file names.target_dir
- Directory to store registered slices into.save_dir
- Directory to store transform files into.p
- registration parameterspublic static List<PointMatch> applyTransformReverse(List<PointMatch> list, CoordinateTransform t)
list
- list of point matchest
- transformation to be appliedpublic static boolean relax(List<PointMatch>[] inliers, CoordinateTransform[] transform, Register_Virtual_Stack_MT.Param p)
inliers
- array of list of inliers in the sequence (one per pair of slices)transform
- array of relaxed transforms (output)p
- registration parameterspublic static void randomize(int[] array)
array
- array of integers to randomizepublic static boolean createResults(String source_dir, String[] sorted_file_names, String target_dir, String save_dir, CoordinateTransform[] transform, boolean interpolate)
source_dir
- Directory to read all images from, where each image is a slice in a sequence. Their names must be bit-sortable, i.e. if numbered, they must be padded with zeros.sorted_file_names
- Array of sorted source file names.target_dir
- Directory to store registered slices into.save_dir
- Directory to store transform files into (null if transformations are not saved).transform
- array of transforms for every source image (including the first one).public static void exec(String source_dir, String[] sorted_file_names, int referenceIndex, String target_dir, String save_dir, Register_Virtual_Stack_MT.Param p)
source_dir
- Directory to read all images from, where each image is a slice in a sequence. Their names must be bit-sortable, i.e. if numbered, they must be padded with zeros.sorted_file_names
- Array of sorted source file names.referenceIndex
- index of the reference image in the array of sorted source images.target_dir
- Directory to store registered slices into.save_dir
- Directory to store transform files into.p
- registration parameters.public static ij.ImagePlus readImage(String path)
path
- full path to imagepublic static boolean register(ij.ImagePlus imp1, ij.ImagePlus imp2, ij.ImagePlus imp1mask, ij.ImagePlus imp2mask, int i, String[] sorted_file_names, String source_dir, String target_dir, ExecutorService exe, Register_Virtual_Stack_MT.Param p, CoordinateTransform t, Rectangle commonBounds, List<Rectangle> bounds, int referenceIndex) throws Exception
imp1
- target imageimp2
- source image (input and output)imp1mask
- target maskimp2mask
- source mask (input and output)i
- index in the loop of images (just to show information)sorted_file_names
- array of sorted source file namessource_dir
- source directorytarget_dir
- target (output) directoryexe
- executor service to save the imagesp
- registration parameterst
- coordinate transformcommonBounds
- current common bounds of the registration spacebounds
- list of bounds for the already registered imagesreferenceIndex
- index of the reference imageException
- if something failspublic static CoordinateTransform getCoordinateTransform(Register_Virtual_Stack_MT.Param p)
p
- registration parameterspublic static void fitInliers(Register_Virtual_Stack_MT.Param p, CoordinateTransform t, List<PointMatch> inliers) throws Exception
p
- registration parameterst
- coordinate transforminliers
- point matchesException
- if something failspublic static void regularize(CoordinateTransform t, int index)
t
- coordinate transformindex
- slice indexpublic static AffineTransform makeAffineMatrix(double scalex, double scaley, double shearx, double sheary, double rotang, double transx, double transy)
scalex
- scaling in xscaley
- scaling in yshearx
- shearing in xsheary
- shearing in yrotang
- angle of rotation (in radians)transx
- translation in xtransy
- translation in ypublic static boolean showRegularizationDialog(Register_Virtual_Stack_MT.Param p)
p
- registration parameterspublic static void postProcessTransforms(CoordinateTransform[] transform)
transform
- array of transformspublic static void flush(ij.ImagePlus imp)
Copyright © 2015–2021 Fiji. All rights reserved.