mpicbg.models
Class MovingLeastSquaresMesh<M extends AbstractModel<M>>

java.lang.Object
  extended by mpicbg.models.TransformMesh
      extended by mpicbg.models.MovingLeastSquaresMesh<M>
All Implemented Interfaces:
Serializable, CoordinateTransform, InverseCoordinateTransform, InvertibleCoordinateTransform
Direct Known Subclasses:
ElasticMovingLeastSquaresMesh

public class MovingLeastSquaresMesh<M extends AbstractModel<M>>
extends TransformMesh

A transformation mesh that implements a landmark based deformation by means of Moving Least Squares as described by \citet{SchaeferAl06} inspired by the implementation of Johannes Schindelin. BibTeX:

Author:
Stephan Saalfeld
See Also:
Serialized Form

Field Summary
protected  double error
           
protected  Class<M> modelClass
           
protected  HashMap<PointMatch,Tile<M>> pt
          Tiles are a collection of PointMatches that share a common transformation model.
 
Fields inherited from class mpicbg.models.TransformMesh
av, defaultPointFactory, defaultPointMatchFactory, height, va, width
 
Constructor Summary
MovingLeastSquaresMesh(Class<M> modelClass, int numX, double width, double height)
           
MovingLeastSquaresMesh(Class<M> modelClass, int numX, int numY, double width, double height)
           
 
Method Summary
 void addMatchWeightedByDistance(PointMatch pm, double alpha)
          Add a PointMatch to all Tiles weighted by its distance to the corresponding vertex.
 void apply(CoordinateTransform t)
          Apply an arbitrary coordinate transformation to each Tile's PointMatches.
 Tile<M> findClosest(double[] there)
          What to use this method for: If you want to add a PointMatch between two Tiles t and o do the following.
 double getError()
           
 Class<M> getModelClass()
           
 HashMap<PointMatch,Tile<M>> getVerticeModelMap()
           
 Set<PointMatch> getVertices()
           
 int numVertices()
           
 void updateModels()
          Updates each vertex' transformation model by means of moving least squares.
protected  double weigh(double d, double alpha)
           
 
Methods inherited from class mpicbg.models.TransformMesh
addTriangle, apply, applyInPlace, applyInverse, applyInverseInPlace, bounds, createInverse, findClosestSourcePoint, findClosestTargetPoint, getAV, getHeight, getVA, getWidth, illustrateBestRigidSVG, illustrateMesh, illustrateMeshSVG, illustrateTriangle, init, isInConvexTargetPolygon, isInSourcePolygon, numY, scale, updateAffine, updateAffines
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pt

protected final HashMap<PointMatch,Tile<M extends AbstractModel<M>>> pt
Tiles are a collection of PointMatches that share a common transformation model. In this implementation, each tile has the size of the whole mesh. By this means, all tiles initially share the same reference frame/ coordinate system. PointMatches are used for two completely different things: 1. Being the vertices which span the mesh and are thus required to find the affine transform inside each of the triangles. The PointMatches in a, l and pt are meant to be these vertices of the mesh. 2. Being actual point correspondences that define the local rigid transformations of each "tile".


error

protected double error

modelClass

protected final Class<M extends AbstractModel<M>> modelClass
Constructor Detail

MovingLeastSquaresMesh

public MovingLeastSquaresMesh(Class<M> modelClass,
                              int numX,
                              int numY,
                              double width,
                              double height)

MovingLeastSquaresMesh

public MovingLeastSquaresMesh(Class<M> modelClass,
                              int numX,
                              double width,
                              double height)
Method Detail

getVerticeModelMap

public final HashMap<PointMatch,Tile<M>> getVerticeModelMap()

getVertices

public final Set<PointMatch> getVertices()

numVertices

public final int numVertices()

getError

public final double getError()

getModelClass

public final Class<M> getModelClass()

weigh

protected final double weigh(double d,
                             double alpha)

findClosest

public final Tile<M> findClosest(double[] there)
What to use this method for: If you want to add a PointMatch between two Tiles t and o do the following. Tile t is a tile in pt, Tile o is whatever you want it to be. The PointMatch has p1 in Tile t and p2 in Tile o. To find Tile t being closest to some world coordinate double[] (x,y) search pt with findClosest(double[]). Then say t.addMatch(PointMatch) and o.add(PointMatch.flip())


addMatchWeightedByDistance

public final void addMatchWeightedByDistance(PointMatch pm,
                                             double alpha)
Add a PointMatch to all Tiles weighted by its distance to the corresponding vertex. The distance weight is defined by 1/(|m.p1.l - vertex.p1.l|^2*alpha)

Parameters:
pm -
alpha -

updateModels

public final void updateModels()
                        throws NotEnoughDataPointsException,
                               IllDefinedDataPointsException
Updates each vertex' transformation model by means of moving least squares.

Throws:
NotEnoughDataPointsException
IllDefinedDataPointsException

apply

public final void apply(CoordinateTransform t)
Apply an arbitrary coordinate transformation to each Tile's PointMatches. This coordinate transformation is not supposed to be compatible to modelClass. This method is intended to be used for initializing the mesh in case that further operations estimate a refined configuration.

Parameters:
t -


Copyright © 2007-2016 Fiji. All Rights Reserved.