mpicbg.trakem2.align
Class Align

java.lang.Object
  extended by mpicbg.trakem2.align.Align

public class Align
extends java.lang.Object

A collection of methods regarding SIFT-based alignment TODO Bring the methods and tasks into a class for each method and clean up this mess.


Nested Class Summary
protected static class Align.ExtractFeaturesThread
          Extracts SIFT-features from a List of Tiles and saves them to disk.
protected static class Align.MatchFeaturesAndFindModelThread
           
static class Align.Param
           
static class Align.ParamOptimize
           
 
Field Summary
static Align.Param param
           
static Align.ParamOptimize paramOptimize
           
 
Constructor Summary
Align()
           
 
Method Summary
static void alignLayer(Layer layer, int numThreads)
          Align all patches in a Layer.
static void alignLayersLinearly(java.util.List<Layer> layers, int numThreads)
           
static void alignSelectedPatches(Selection selection, int numThreads)
          Align a selection of patches in a Layer.
static void alignTileCollections(Align.Param p, java.util.Collection<AbstractAffineTile2D<?>> a, java.util.Collection<AbstractAffineTile2D<?>> b)
          Align two collections of tiles
static void alignTiles(Align.ParamOptimize p, java.util.List<AbstractAffineTile2D<?>> tiles, java.util.List<AbstractAffineTile2D<?>> fixedTiles, int numThreads)
          Align a set of overlapping tiles using the following procedure: Extract SIFT-features from all tiles. Establish point-correspondences from consistent sets of feature matches among overlapping tiles. Globally align the tile configuration. Both feature extraction and matching are executed in multiple Threads, with the number of Threads being a parameter of the method.
static void connectTilePairs(Align.Param p, java.util.List<AbstractAffineTile2D<?>> tiles, java.util.List<AbstractAffineTile2D<?>[]> tilePairs, int numThreads)
          Connect a List of Tiles by geometrically consistent SIFT-feature correspondences.
static MovingLeastSquaresTransform createMLST(java.util.Collection<mpicbg.models.PointMatch> matches, float alpha)
          Temporary helper method that creates
protected static java.util.Collection<mpicbg.imagefeatures.Feature> deserializeFeatures(Align.Param p, AbstractAffineTile2D<?> t)
          Retrieve the features only if saved with the exact same relevant SIFT parameters.
protected static java.util.Collection<mpicbg.models.PointMatch> deserializePointMatches(Align.Param p, AbstractAffineTile2D<?> t1, AbstractAffineTile2D<?> t2)
           
protected static java.util.Collection<mpicbg.imagefeatures.Feature> fetchFeatures(Align.Param p, AbstractAffineTile2D<?> t)
           
protected static java.util.Collection<mpicbg.models.PointMatch> fetchPointMatches(Align.Param p, AbstractAffineTile2D<?> t1, AbstractAffineTile2D<?> t2)
          Fetch a Collection of corresponding SIFT-features.
static void optimizeTileConfiguration(Align.ParamOptimize p, java.util.List<AbstractAffineTile2D<?>> tiles, java.util.List<AbstractAffineTile2D<?>> fixedTiles)
          Align a set of tiles that are interconnected by point-correspondences.
protected static void pairwiseAlign(AbstractAffineTile2D<?> tile, java.util.Set<AbstractAffineTile2D<?>> visited)
           
static void pairwiseAlignTileConfiguration(java.util.List<AbstractAffineTile2D<?>> tiles)
           
protected static boolean serializeFeatures(Align.Param p, AbstractAffineTile2D<?> t, java.util.Collection<mpicbg.imagefeatures.Feature> f)
           
protected static boolean serializePointMatches(Align.Param p, AbstractAffineTile2D<?> t1, AbstractAffineTile2D<?> t2, java.util.Collection<mpicbg.models.PointMatch> m)
          Save a Collection of PointMatches two-sided.
static void tilesFromPatches(Align.Param p, java.util.List<? extends Patch> patches, java.util.Collection<? extends Patch> fixedPatches, java.util.List<AbstractAffineTile2D<?>> tiles, java.util.Collection<AbstractAffineTile2D<?>> fixedTiles)
          If a Patch is locked or in fixedPatches, its corresponding Tile is added to fixedTiles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

param

public static final Align.Param param

paramOptimize

public static final Align.ParamOptimize paramOptimize
Constructor Detail

Align

public Align()
Method Detail

serializeFeatures

protected static final boolean serializeFeatures(Align.Param p,
                                                 AbstractAffineTile2D<?> t,
                                                 java.util.Collection<mpicbg.imagefeatures.Feature> f)

deserializeFeatures

protected static final java.util.Collection<mpicbg.imagefeatures.Feature> deserializeFeatures(Align.Param p,
                                                                                              AbstractAffineTile2D<?> t)
Retrieve the features only if saved with the exact same relevant SIFT parameters.


fetchFeatures

protected static final java.util.Collection<mpicbg.imagefeatures.Feature> fetchFeatures(Align.Param p,
                                                                                        AbstractAffineTile2D<?> t)

serializePointMatches

protected static final boolean serializePointMatches(Align.Param p,
                                                     AbstractAffineTile2D<?> t1,
                                                     AbstractAffineTile2D<?> t2,
                                                     java.util.Collection<mpicbg.models.PointMatch> m)
Save a Collection of PointMatches two-sided. Creates two serialization files which is desperately required to clean up properly invalid serializations on change of a Patch.

Parameters:
p -
t1 -
t2 -
m -
Returns:

deserializePointMatches

protected static final java.util.Collection<mpicbg.models.PointMatch> deserializePointMatches(Align.Param p,
                                                                                              AbstractAffineTile2D<?> t1,
                                                                                              AbstractAffineTile2D<?> t2)

fetchPointMatches

protected static final java.util.Collection<mpicbg.models.PointMatch> fetchPointMatches(Align.Param p,
                                                                                        AbstractAffineTile2D<?> t1,
                                                                                        AbstractAffineTile2D<?> t2)
Fetch a Collection of corresponding SIFT-features. Both SIFT-features and corresponding points are cached to disk.

Parameters:
p -
t1 -
t2 -
Returns:
null
if matching failed for some reasons
empty Collection
if there was no consistent set of matches
Collection of PointMatches
if there was a consistent set of PointMatches

alignTiles

public static final void alignTiles(Align.ParamOptimize p,
                                    java.util.List<AbstractAffineTile2D<?>> tiles,
                                    java.util.List<AbstractAffineTile2D<?>> fixedTiles,
                                    int numThreads)
Align a set of overlapping tiles using the following procedure:
  1. Extract SIFT-features from all tiles.
  2. Establish point-correspondences from consistent sets of feature matches among overlapping tiles.
  3. Globally align the tile configuration.
Both feature extraction and matching are executed in multiple Threads, with the number of Threads being a parameter of the method.

Parameters:
p -
tiles -
numThreads -

optimizeTileConfiguration

public static final void optimizeTileConfiguration(Align.ParamOptimize p,
                                                   java.util.List<AbstractAffineTile2D<?>> tiles,
                                                   java.util.List<AbstractAffineTile2D<?>> fixedTiles)
Align a set of tiles that are interconnected by point-correspondences.


pairwiseAlign

protected static final void pairwiseAlign(AbstractAffineTile2D<?> tile,
                                          java.util.Set<AbstractAffineTile2D<?>> visited)

pairwiseAlignTileConfiguration

public static final void pairwiseAlignTileConfiguration(java.util.List<AbstractAffineTile2D<?>> tiles)

connectTilePairs

public static final void connectTilePairs(Align.Param p,
                                          java.util.List<AbstractAffineTile2D<?>> tiles,
                                          java.util.List<AbstractAffineTile2D<?>[]> tilePairs,
                                          int numThreads)
Connect a List of Tiles by geometrically consistent SIFT-feature correspondences.

Parameters:
p -
tiles -
numThreads -

tilesFromPatches

public static final void tilesFromPatches(Align.Param p,
                                          java.util.List<? extends Patch> patches,
                                          java.util.Collection<? extends Patch> fixedPatches,
                                          java.util.List<AbstractAffineTile2D<?>> tiles,
                                          java.util.Collection<AbstractAffineTile2D<?>> fixedTiles)
If a Patch is locked or in fixedPatches, its corresponding Tile is added to fixedTiles.

Parameters:
p -
patches -
fixedPatches -
tiles - will contain the generated Tiles
fixedTiles - will contain the Tiles corresponding to the Patches in fixedPatches

alignSelectedPatches

public static final void alignSelectedPatches(Selection selection,
                                              int numThreads)
Align a selection of patches in a Layer.

Parameters:
layer -

alignLayer

public static final void alignLayer(Layer layer,
                                    int numThreads)
Align all patches in a Layer.

Parameters:
layer -

alignLayersLinearly

public static final void alignLayersLinearly(java.util.List<Layer> layers,
                                             int numThreads)

createMLST

public static final MovingLeastSquaresTransform createMLST(java.util.Collection<mpicbg.models.PointMatch> matches,
                                                           float alpha)
                                                    throws java.lang.Exception
Temporary helper method that creates

Parameters:
matches -
alpha -
Returns:
Throws:
java.lang.Exception

alignTileCollections

public static final void alignTileCollections(Align.Param p,
                                              java.util.Collection<AbstractAffineTile2D<?>> a,
                                              java.util.Collection<AbstractAffineTile2D<?>> b)
Align two collections of tiles

Parameters:
p -
a -
b -