| <<O>> Difference Topic LandmarkWarpUserGuide1x0 (r1.14 - 12 Aug 2008 - RyanCabeen) |
| ||||||||
| Changed: | ||||||||
| < < |
Landmark Warp Framework Programmer's Guide Version 1.0 | |||||||
| > > |
Landmark Warp Tools Library User Guide | |||||||
| TOC: No TOC in "CCB.LandmarkWarpUserGuide1x0" | ||||||||
| Added: | ||||||||
| > > |
| |||||||
OverviewThis is a library for estimating and applying transformations that are defined by landmark input/output pairs; that is, a warp defined by homologous sets of points. This framework allows the user to find a mapping that best maps the landmarks in one space to landmarks in another space. There are several types of warps that differ in how the mapping is estimated. This provides tools for computing, applying and implementing the warps in an extensible way. Currently there are the following types of functions: Euclidean, Similarity, Affine and non-linear spline with basis functions. There are the following function estimation methods: Procrustes, Generalized Procrustes, Dual Quaternion and linear least squares best fit. These differ in the constraints on the mapping that is estimated. For example, there are rigid transforms that do not necessarily map landmarks exactly and minimize the error of the mapping between landmarks and non-linear splines that map landmarks exactly and maximize the smoothness between landmarks. | ||||||||
| Added: | ||||||||
| > > |
| |||||||
ImplementationThis library has an object oriented design that is supported by elements of the ShapeTools library. | ||||||||
| Line: 24 to 28 | ||||||||
|---|---|---|---|---|---|---|---|---|
| There is also a file format for landmarks. This allows LandmarkSet objects to be read and written to disk. The format is ASCII and human readable and writable. Each point has space-delimited coordinates, and points are line-delimited. The order of the points in the stream implies the indices in the LandmarkSet. Comments are allowed after a '#' character, and arbitrary white-space and empty lines are allowed. | ||||||||
| Added: | ||||||||
| > > |
| |||||||
Mathematical BackgroundThis section will address the mathematics of the warps. | ||||||||
| Line: 42 to 48 | ||||||||
| The coefficients are computed by solving a system of K*N+N*(N+1) linear equations which ensure the function maps landmarks to landmarks in addition to some affine transform. | ||||||||
| Added: | ||||||||
| > > |
Warp File FormatThis is a file format that is compatible with all landmark-based warps that are IParameterizable that are recognized by the LandmarkWarpFactory class. All data is written as ascii text. The format allows comments on any line and after data, as long as they are preceded by a '#' character (text after that symbol is not parsed). A valid file can have any number of comments. All arrays of numbers are space-delimited with a newline every 80 characters.FormatThe first line of data contains a magic string, "LandmarkWarpFramework", followed by the version of the framework. Next, there is a line indicating the number of parameter blocks that have been encoded. Each parameter block first encodes a header which is a single line containing a name, version and the number of parameters in the block. Next the parameter block encodes the parameters, adding a new line every 80 characeters. For most warps, only one parameter block is needed, but for spline warps, two are needed, one to specify the basis and one to specify the coefficients of the basis. The meaning of the parameters is very specific to the type of warp. For details about the meaning of the parameters, the javadocs should be referenced. The filenames have the form "*.lmw".Example Warp FileHere is an example warp file:# LandmarkWarpFile 2007-04-03 LandmarkWarpFramework 1.0 ParameterBlock 2 SplineWarp 1.0 28 2.0 5.0 5.0 5.0 -5.0 -5.0 0.0 5.0 -5.0 -5.0 5.0 0.0 0.0060112295 -0.0 0.0060112295 -0.0 0.0060112295 -0.0 0.0060112295 -0.0 -0.024044918 0.0 -8.0349545E-17 -0.0 -1.3226087E-16 -0.0 7.2032137 -0.0 ThinPlateBasis 1.0 1 2.0 Landmark File FormatThis is a file format that is compatible that encodes K (approximately) unique N-dimensional landmarks to a file. All data is written as ascii text. The format allows comments on any line and after data, as long as they are preceded by a '#' character (text after that symbol is not parsed). The format also allows arbitrary white space and empty lines The format is intended to be human readable and compatible with other applications.FormatEach point is line delimited, where the order of the points in the file reflects the point indices in the LandmarkSet. The coordinates are space delimited. The filenames have the form "*.lm".Example Landmark FileHere is an example landmark file:56.0 49.0 203.0 33.0 243.0 69.0 234.0 93.0 147.0 122.0 123.0 96.0 128.0 77.0 85.0 64.0 86.0 55.0which is equivalent to 56.0 49.0 203.0 33.0 # first comment 243.0 69.0 234.0 93.0 # second comment 147.0 122.0 123.0 96.0 128.0 77.0 85.0 64.0 86.0 55.0 Example UseHere is a way to make a simple 2-D spline warp which deforms the center of a square to the right:
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Random;
import edu.ucla.loni.ccb.discretedata.io.ArrayIO;
import edu.ucla.loni.ccb.functions.app.FunctionAppUtil;
import edu.ucla.loni.ccb.functions.basis.BasisElasticBodyHyper;
import edu.ucla.loni.ccb.functions.basis.BasisFunctionType;
import edu.ucla.loni.ccb.functions.estimation.FunctionEstimatorFactory;
import edu.ucla.loni.ccb.functions.estimation.LandmarkOperations;
import edu.ucla.loni.ccb.functions.estimation.LandmarkSet;
import edu.ucla.loni.ccb.functions.estimation.LandmarkSetPair;
import edu.ucla.loni.ccb.functions.estimation.SplineBasisEstimator;
import edu.ucla.loni.ccb.functions.io.FunctionIO;
import edu.ucla.loni.ccb.shape.Shape;
import edu.ucla.loni.ccb.shape.ShapeImpl;
import edu.ucla.loni.ccb.shape.geometry.CGALFaceSet;
import edu.ucla.loni.ccb.shape.geometry.IPoint;
import edu.ucla.loni.ccb.shape.geometry.IPointSet;
import edu.ucla.loni.ccb.shape.geometry.IrregularPointSet;
import edu.ucla.loni.ccb.shape.geometry.Point3D;
import edu.ucla.loni.ccb.shape.geometry.PointND;
import edu.ucla.loni.ccb.shape.math.VectorMath;
import edu.ucla.loni.ccb.shape.math.functions.IFunction;
import edu.ucla.loni.ccb.shape.math.functions.MapLoop;
import edu.ucla.loni.ccb.shapeio.duff.DuffIO;
public class Simple2DLandmarkWarpExample
{
/**
* This demonstrates how to apply a warp to a single two dimensional point.
*
* The program creates a simple warp, applies it to
* a new point and writes the warp to disk.
*/
public static void main(String [] args)
{
try {
// Define example landmarks
int dim = 2;
int num = 5;
float distance = 5;
float[][] refData = new float[dim][num];
float[][] targetData = new float[dim][num];
float[] novelPoint = { .2f, 1.4f };
float[] warpedNovelPoint = new float[dim];
refData[0] = new float[] { distance, distance, -distance, -distance,
0 };
refData[1] = new float[] { distance, -distance, -distance, distance,
0 };
targetData[0] = new float[] { distance, distance, -distance,
-distance, distance / 2 };
targetData[1] = new float[] { distance, -distance, -distance,
distance, 0 };
// Create the landmark objects
LandmarkSet refSet = LandmarkOperations
.constructFromDimNumArray(refData);
LandmarkSet targetSet = LandmarkOperations
.constructFromDimNumArray(targetData);
LandmarkSetPair landmarks = new LandmarkSetPair(refSet, targetSet);
// Compute the warp
IFunction warp = FunctionEstimatorFactory.createNonLinear(
BasisFunctionType.THIN_PLATE, dim).estimate(landmarks);
// Evaluate the warp (these are not used for anything here)
warp.evaluate(novelPoint, warpedNovelPoint);
System.out.println("Original warped novel point = ["
+ warpedNovelPoint[0] + "," + warpedNovelPoint[1] + "].");
// Write out the warp file
String filename = "output/warp" + FunctionIO.SUFFIX;
FileOutputStream stream = new FileOutputStream(new File(filename));
FunctionIO.write(stream, warp);
// Read warp file
BufferedReader reader = new BufferedReader(new FileReader(new File(
filename)));
IFunction readWarp = FunctionIO.read(reader);
// Demonstrate that the read warp produces the same output at the
// novel point
readWarp.evaluate(novelPoint, warpedNovelPoint);
System.out.println("Read and recomputed warped novel point = ["
+ warpedNovelPoint[0] + "," + warpedNovelPoint[1] + "].");
} catch (Exception e) {
System.err.println("Warp write failed.");
e.printStackTrace();
}
}
}
The above code creates two two-dimensional arrays, a set of source landmarks and a set of destination landmarks. The first four points are the same-- they are the corners of a square. The last point is different by distance/2 in the x-coordinate. Then the warp is created from these points. The warp is applied to a new point. This warp should keep points near the corners stationary and move points near the center to the right. Finally the warp is written to disk for later use.
Here is the resulting warp file:
# LandmarkWarpFile 2007-04-03 LandmarkWarpFramework 1.0 ParameterBlock 2 SplineWarp 1.0 28 2.0 5.0 5.0 5.0 -5.0 -5.0 0.0 5.0 -5.0 -5.0 5.0 0.0 0.0060112295 -0.0 0.0060112295 -0.0 0.0060112295 -0.0 0.0060112295 -0.0 -0.024044918 0.0 -8.0349545E-17 -0.0 -1.3226087E-16 -0.0 7.2032137 -0.0 ThinPlateBasis 1.0 1 2.0There is an example package in the library which provides landmarks for testing as well as main routines for applying the warps to existing shapes. | |||||||
| <<O>> Difference Topic LandmarkWarpUserGuide1x0 (r1.13 - 06 Aug 2008 - RyanCabeen) |
Landmark Warp Framework Programmer's Guide Version 1.0 | ||||||||
| Line: 6 to 6 | ||||||||
|---|---|---|---|---|---|---|---|---|
Overview | ||||||||
| Changed: | ||||||||
| < < |
This is a library for estimating and applying transformations that are defined by landmark input/output pairs; that is, a warp defined by homologous sets of points. This framework allows the user to find a mapping that best maps the landmarks in one space to landmarks in another space. There are several types of warp that differ in how that mapping is estimated. This provides tools for computing, applying and implementing the warps in an extensible way. Currently there are the following types of functions: Euclidean, Similarity, Affine and non-linear spline with basis functions. There are the following function estimation methods: Procrustes, Generalized Procrustes, Dual Quaternion and linear least squares best fit. These differ in the constraints on the mapping that is estimated. For example, there are rigid transforms that do not necessarily map landmarks exactly and minimize the error of the mapping between landmarks and non-linear splines that map landmarks exactly and maximize the smoothness between landmarks. | |||||||
| > > |
This is a library for estimating and applying transformations that are defined by landmark input/output pairs; that is, a warp defined by homologous sets of points. This framework allows the user to find a mapping that best maps the landmarks in one space to landmarks in another space. There are several types of warps that differ in how the mapping is estimated. This provides tools for computing, applying and implementing the warps in an extensible way. Currently there are the following types of functions: Euclidean, Similarity, Affine and non-linear spline with basis functions. There are the following function estimation methods: Procrustes, Generalized Procrustes, Dual Quaternion and linear least squares best fit. These differ in the constraints on the mapping that is estimated. For example, there are rigid transforms that do not necessarily map landmarks exactly and minimize the error of the mapping between landmarks and non-linear splines that map landmarks exactly and maximize the smoothness between landmarks. | |||||||
Implementation | ||||||||
| Line: 30 to 30 | ||||||||
| For an affine warp, the transformation is the combination of an arbitrary linear transformation and a translation. This allows for translation, scaling, rotation and skewing. This is estimated by solving the linear least squares problem. Given two sets of landmarks that are related in a non-linear way, this will not map landmarks exactly. For an N-dimensional problem, at least N of the K landmarks must be in general position. | ||||||||
| Changed: | ||||||||
| < < |
There is also a rigid warp, which is a combination of a translation and a rotation. There are multiple ways to estimate the parameters of this transformation. The Procrustes analysis estimates the best orthogonal rotation matrix and Dual Quaternion solves the problem in the domain of quaternions and translates the result to the euclidean domain. In addition, scaling may be considered when computing the warp. The generalized Procrustes warp is an implementation of this warp. For a N-dimensional problem, at least N of the K landmarks must be in general position. | |||||||
| > > |
There is also a rigid warp, which is a combination of a translation and a rotation. There are multiple ways to estimate the parameters of this transformation. The Procrustes analysis estimates the best orthogonal rotation matrix and Dual Quaternion solves the problem in the domain of quaternions and translates the result to the euclidean domain. In addition, scaling may be considered when computing the warp. The generalized Procrustes method estimates the rigid with scaling warp. For a N-dimensional problem, at least N of the K landmarks must be in general position. | |||||||
| Changed: | ||||||||
| < < |
For the non-linear spline case, the function is described as the sum of an affine transform and the weighted sum of basis functions. Each warp of this kind has a basis function of a single form that is modeled by an IBasisFunction. For a N-dimensional problem, at least N of the K landmarks must be in general position. | |||||||
| > > |
For the non-linear spline case, the function is described as the sum of an affine transform and the weighted sum of nonlinear basis functions. Each warp of this kind has a basis function of a single form that is modeled by an IBasisFunction. For a N-dimensional problem, at least N of the K landmarks must be in general position. | |||||||
| Specifically, consider two spaces A and B, and let there be two sets of points pi from A and q.i from B for i = [0,K]. For our purposes, A and B will both be RN. We would like to find a function f:A->B such that f(pi) = qi for all i. This is the mapping we call the warp. Let G be a function G:RN->RNxN which maps a point to a NxN matrix-- this is the basis function. Let d be a function d:RNxRN->RN that is the displacement function d(a,b) = b-a, and f(a) = a + d(a,b). We can define d as a linear combination of basis functions and a linear transformation: | ||||||||
| <<O>> Difference Topic LandmarkWarpUserGuide1x0 (r1.12 - 01 Apr 2008 - RyanCabeen) |
Landmark Warp Framework Programmer's Guide Version 1.0 | ||||||||
| Line: 6 to 6 | ||||||||
|---|---|---|---|---|---|---|---|---|
Overview | ||||||||
| Changed: | ||||||||
| < < |
This is a library for estimating and applying transformations that are defined by landmark input/output pairs; that is, a warp defined by homologous sets of points. This framework allows the user to find a mapping that best maps the landmarks in one space to landmarks in another space. There are several types of warp that differ in how that mapping is estimated. This provides tools for computing, applying and implementing the warps in an extensible way. Currently there are the following types of landmark warps: Procrustes, Generalized Procrustes, non-linear spline and affine transformations. These differ in the constraints on the mapping that is estimated. For example, there are rigid transforms that do not necessarily map landmarks exactly and minimize the error of the mapping between landmarks and non-linear splines that map landmarks exactly and maximize the smoothness between landmarks. | |||||||
| > > |
This is a library for estimating and applying transformations that are defined by landmark input/output pairs; that is, a warp defined by homologous sets of points. This framework allows the user to find a mapping that best maps the landmarks in one space to landmarks in another space. There are several types of warp that differ in how that mapping is estimated. This provides tools for computing, applying and implementing the warps in an extensible way. Currently there are the following types of functions: Euclidean, Similarity, Affine and non-linear spline with basis functions. There are the following function estimation methods: Procrustes, Generalized Procrustes, Dual Quaternion and linear least squares best fit. These differ in the constraints on the mapping that is estimated. For example, there are rigid transforms that do not necessarily map landmarks exactly and minimize the error of the mapping between landmarks and non-linear splines that map landmarks exactly and maximize the smoothness between landmarks. | |||||||
Implementation | ||||||||
| Line: 14 to 14 | ||||||||
| A landmark is a mutable object that contains N-dimensional floating point data. An indexed set of landmarks is a LandmarkSet, which does not allow (approximately) duplicate elements. Furthermore, homologous landmark sets are contained in a LandmarkSetPair object, that requires the sets to have the same size and dimension. A landmark set pair is then used to estimate a warp object. | ||||||||
| Changed: | ||||||||
| < < |
Each warp is an immutable object that can take a point from the input space and compute the output point. By convention, the input space is called the 'reference' space and the output space is called the 'target' space. Warp objects implement an interface ILandmarkWarp, which is an extension of an IFunction. Like an IFunction, ILandmarkWarp classes favor memory reuse by copying output to an argument as opposed to allocating and returning a result. All ILandmarkWarp implementations should have a static (ILandmarkWarp)estimate(LandmarkSetPair) method. | |||||||
| > > |
Each warp is an immutable object that can take a point from the input space and compute the output point. By convention, the input space is called the 'reference' space and the output space is called the 'target' space. Warp objects implement an interface IFunction. Like an IFunction, IFunction objects favor memory reuse by copying output to an argument as opposed to allocating and returning a result. | |||||||
| Changed: | ||||||||
| < < |
Although ILandmarkWarp (and more generally IFunction) classes allow for only point based operations, given structures that contain multiple points, mapping objects can be used to apply the function to all the points in the structure without changing the transformation implementation. An example of a mapping function is one that implements IMap. This allows a minimal amount of implementation for the specific transformation. Furthermore, the process of applying the transformation to multiple points is easily reimplemented, i.e. for multi-threaded or distributed computing. | |||||||
| > > |
Although IFunction objects allow for only point based operations, given structures that contain multiple points, mapping objects can be used to apply the function to all the points in the structure without changing the transformation implementation. An example of a mapping function is one that implements IMap. This allows a minimal amount of implementation for the specific transformation. Furthermore, the process of applying the transformation to multiple points is easily reimplemented, i.e. for multi-threaded or distributed computing. | |||||||
| Changed: | ||||||||
| < < |
To permit simple IO operations, all ILandmarkWarp must also be IParameterizable with static (ILandmarkWarp)construct(ParameterBlock) method. Furthermore, new ILandmarkWarp implementations should be added to the factory class LandmarkWarpFactory. The class WarpIO can be used to write a warp to disk. The file will encode all the parameters necessary to recreate the warp object. This file is ASCII and human readable, although in general it is difficult to interpret the parameters without reading the code. | |||||||
| > > |
Each warp estimation method is an immutable object that takes a pair of landmark sets and returns the IFunction that best maps one to the other. The interface to an estimation method is IFunctionEstimator. There are factories for the estimation routines. The user specifies which estimation method should be returned using an enumeration of the implementing objects.
To allow IO operations, an object must have a parameterization object that implements IParameterization | |||||||
| There is also a file format for landmarks. This allows LandmarkSet objects to be read and written to disk. The format is ASCII and human readable and writable. Each point has space-delimited coordinates, and points are line-delimited. The order of the points in the stream implies the indices in the LandmarkSet. Comments are allowed after a '#' character, and arbitrary white-space and empty lines are allowed. | ||||||||
| <<O>> Difference Topic LandmarkWarpUserGuide1x0 (r1.11 - 14 Dec 2007 - RyanCabeen) |
| Changed: | ||||||||
| < < |
| |||||||
| > > |
| |||||||
Landmark Warp Framework Programmer's Guide Version 1.0TOC: No TOC in "CCB.LandmarkWarpUserGuide1x0" | ||||||||
| <<O>> Difference Topic LandmarkWarpUserGuide1x0 (r1.10 - 13 Dec 2007 - RyanCabeen) |
| ||||||||
| Changed: | ||||||||
| < < |
Landmark Warp Framework User's Guide Version 1.0 | |||||||
| > > |
Landmark Warp Framework Programmer's Guide Version 1.0 | |||||||
Overview | ||||||||
| Changed: | ||||||||
| < < |
This is a framework for estimating and applying transformations that are defined by landmark input/output pairs; that is, a warp defined by homologous sets of points. This framework allows the user to find a mapping that best maps the landmarks in one space to landmarks in another space. There are several types of warp that differ in how that mapping is estimated. This provides tools for computing, applying and implementing the warps in an extensible way. Currently there are the following types of landmark warps: Procrustes, Generalized Procrustes, non-linear spline and affine transformations. These differ in the contraints on the mapping that is estimated. For example, there are rigid transforms that do not necessarily map landmarks exactly and minimize the error of the mapping between landmarks and non-linear splines that map landmarks exactly and maximize the smoothness between landmarks. | |||||||
| > > |
This is a library for estimating and applying transformations that are defined by landmark input/output pairs; that is, a warp defined by homologous sets of points. This framework allows the user to find a mapping that best maps the landmarks in one space to landmarks in another space. There are several types of warp that differ in how that mapping is estimated. This provides tools for computing, applying and implementing the warps in an extensible way. Currently there are the following types of landmark warps: Procrustes, Generalized Procrustes, non-linear spline and affine transformations. These differ in the constraints on the mapping that is estimated. For example, there are rigid transforms that do not necessarily map landmarks exactly and minimize the error of the mapping between landmarks and non-linear splines that map landmarks exactly and maximize the smoothness between landmarks. | |||||||
Implementation | ||||||||
| Line: 30 to 30 | ||||||||
|---|---|---|---|---|---|---|---|---|
| There is also a rigid warp, which is a combination of a translation and a rotation. There are multiple ways to estimate the parameters of this transformation. The Procrustes analysis estimates the best orthogonal rotation matrix and Dual Quaternion solves the problem in the domain of quaternions and translates the result to the euclidean domain. In addition, scaling may be considered when computing the warp. The generalized Procrustes warp is an implementation of this warp. For a N-dimensional problem, at least N of the K landmarks must be in general position. | ||||||||
| Changed: | ||||||||
| < < |
For the non-linear spline case, the function is described as the sum of an affine transform and the weighted sum of basis functions. Each warp of this kind has a basis function of a single form that is modelled by an IBasisFunction. For a N-dimensional problem, at least N of the K landmarks must be in general position. | |||||||
| > > |
For the non-linear spline case, the function is described as the sum of an affine transform and the weighted sum of basis functions. Each warp of this kind has a basis function of a single form that is modeled by an IBasisFunction. For a N-dimensional problem, at least N of the K landmarks must be in general position. | |||||||
| Changed: | ||||||||
| < < |
Specifically, consider two spaces A and B, and let there be two sets of points p.i from A and q.i from B for i = [0,K]. For our purposes, A and B will both be RN. We would like to find a function f:A->B such that f(p.i) = q.i for all i. This is the mapping we call the warp. Let G be a function G:RN->RNxN which maps a point to a NxN matrix-- this is the basis function. Let d be a function d:RNxRN->RN that is the displacement function d(a,b) = b-a-- we let f(a) = a + d(a,b). We can define d as a linear combination of basis functions and a linear transformation: | |||||||
| > > |
Specifically, consider two spaces A and B, and let there be two sets of points pi from A and q.i from B for i = [0,K]. For our purposes, A and B will both be RN. We would like to find a function f:A->B such that f(pi) = qi for all i. This is the mapping we call the warp. Let G be a function G:RN->RNxN which maps a point to a NxN matrix-- this is the basis function. Let d be a function d:RNxRN->RN that is the displacement function d(a,b) = b-a, and f(a) = a + d(a,b). We can define d as a linear combination of basis functions and a linear transformation: | |||||||
| Changed: | ||||||||
| < < |
d(p) = sum( G(p-p.i) * c.i ) + A * p + b | |||||||
| > > |
d(p) = sum( G(p-pi) * ci ) + A * p + b | |||||||
| Changed: | ||||||||
| < < |
where the sum is from i = 0 to i = K. P is from RN and is the point to be mapped. p.i from RN is the i-th landmark in the domain. c.i is from RN and is the i-th non-linear coefficient. A is from RNxN and contains the affine coefficients. b is from RN and contains the linear shift coefficients. | |||||||
| > > |
where the sum is from i = 0 to i = K. P is from RN and is the point to be mapped. pi from RN is the i-th landmark in the domain. ci is from RN and is the i-th non-linear coefficient. A is from RNxN and contains the affine coefficients. b is from RN and contains the linear shift coefficients. | |||||||
| The coefficients are computed by solving a system of K*N+N*(N+1) linear equations which ensure the function maps landmarks to landmarks in addition to some affine transform. | ||||||||
| <<O>> Difference Topic LandmarkWarpUserGuide1x0 (r1.9 - 25 Apr 2007 - RyanCabeen) |
Landmark Warp Framework User's Guide Version 1.0 | ||||||||
| Line: 28 to 28 | ||||||||
|---|---|---|---|---|---|---|---|---|
| For an affine warp, the transformation is the combination of an arbitrary linear transformation and a translation. This allows for translation, scaling, rotation and skewing. This is estimated by solving the linear least squares problem. Given two sets of landmarks that are related in a non-linear way, this will not map landmarks exactly. For an N-dimensional problem, at least N of the K landmarks must be in general position. | ||||||||
| Changed: | ||||||||
| < < |
In the case of a Procrustes warp, the set of landmarks can be considered a shape which is equivalent under rotation and translation. Given two instances of a shape, the framework can compute the rotation and translation necessary to bring the first shape into a least-squares best-fit alignment with the second shape. In the case of a Generalized Procrustes warp, scaling is also considered when computing the warp. For a N-dimensional problem, at least N of the K landmarks must be in general position. | |||||||
| > > |
There is also a rigid warp, which is a combination of a translation and a rotation. There are multiple ways to estimate the parameters of this transformation. The Procrustes analysis estimates the best orthogonal rotation matrix and Dual Quaternion solves the problem in the domain of quaternions and translates the result to the euclidean domain. In addition, scaling may be considered when computing the warp. The generalized Procrustes warp is an implementation of this warp. For a N-dimensional problem, at least N of the K landmarks must be in general position. | |||||||
| For the non-linear spline case, the function is described as the sum of an affine transform and the weighted sum of basis functions. Each warp of this kind has a basis function of a single form that is modelled by an IBasisFunction. For a N-dimensional problem, at least N of the K landmarks must be in general position. | ||||||||
| <<O>> Difference Topic LandmarkWarpUserGuide1x0 (r1.8 - 19 Apr 2007 - RyanCabeen) |
Landmark Warp Framework User's Guide Version 1.0 | ||||||||
| Line: 6 to 6 | ||||||||
|---|---|---|---|---|---|---|---|---|
Overview | ||||||||
| Changed: | ||||||||
| < < |
This is a framework for estimating and applying transformations that are defined by landmark input/output pairs; that is, a warp defined by homologous sets of points (landmarks) in two different spaces. This framework allows the user to find a mapping that best maps the landmarks in one space to landmarks in another space. This provides tools for computing, applying and implementing the warps in an extensible way. Currently there are the following types of landmark warps: Procrustes, Generalized Procrustes, non-linear spline and affine transformations. The general problem is to compute a function which maps from one set of user-defined points to another set of user-defined points. The behavior of the function at non-landmark points depends on the transform being used. This can range from rigid transforms that minimize the error of the transform to non-linear that maximize the smoothness between landmarks. | |||||||
| > > |
This is a framework for estimating and applying transformations that are defined by landmark input/output pairs; that is, a warp defined by homologous sets of points. This framework allows the user to find a mapping that best maps the landmarks in one space to landmarks in another space. There are several types of warp that differ in how that mapping is estimated. This provides tools for computing, applying and implementing the warps in an extensible way. Currently there are the following types of landmark warps: Procrustes, Generalized Procrustes, non-linear spline and affine transformations. These differ in the contraints on the mapping that is estimated. For example, there are rigid transforms that do not necessarily map landmarks exactly and minimize the error of the mapping between landmarks and non-linear splines that map landmarks exactly and maximize the smoothness between landmarks. | |||||||
Implementation | ||||||||
| Changed: | ||||||||
| < < |
This library has an object oriented design that is supported by some elements of the ShapeTools library. | |||||||
| > > |
This library has an object oriented design that is supported by elements of the ShapeTools library. | |||||||
| Changed: | ||||||||
| < < |
A landmark is a mutable object that contains N-dimensional floating point data. An indexed set of landmarks is a LandmarkSet, which does not allow (approximately) duplicate elements. Furthermore, homologous landmark sets are contained in a LandmarkSetPair object, that requires the sets to have the same size and dimension. | |||||||
| > > |
A landmark is a mutable object that contains N-dimensional floating point data. An indexed set of landmarks is a LandmarkSet, which does not allow (approximately) duplicate elements. Furthermore, homologous landmark sets are contained in a LandmarkSetPair object, that requires the sets to have the same size and dimension. A landmark set pair is then used to estimate a warp object. | |||||||
| Changed: | ||||||||
| < < |
Each transformation is an immutable object that can take a point from the input space and copy the result to an array describing the output. They implement an interface ILandmarkWarp, which is an extension of an IFunction. Like an IFunction, ILandmarkWarp classes favor memory reuse by copying output to the argument as opposed to allocating and returning a result. All ILandmarkWarp implementations should have a static (ILandmarkWarp)estimate(LandmarkSetPair) method. | |||||||
| > > |
Each warp is an immutable object that can take a point from the input space and compute the output point. By convention, the input space is called the 'reference' space and the output space is called the 'target' space. Warp objects implement an interface ILandmarkWarp, which is an extension of an IFunction. Like an IFunction, ILandmarkWarp classes favor memory reuse by copying output to an argument as opposed to allocating and returning a result. All ILandmarkWarp implementations should have a static (ILandmarkWarp)estimate(LandmarkSetPair) method. | |||||||
| Although ILandmarkWarp (and more generally IFunction) classes allow for only point based operations, given structures that contain multiple points, mapping objects can be used to apply the function to all the points in the structure without changing the transformation implementation. An example of a mapping function is one that implements IMap. This allows a minimal amount of implementation for the specific transformation. Furthermore, the process of applying the transformation to multiple points is easily reimplemented, i.e. for multi-threaded or distributed computing. | ||||||||
| Changed: | ||||||||
| < < |
To permit simple IO operations, all ILandmarkWarp must also be IParameterizable with static (ILandmarkWarp)construct(ParameterBlock) method. Furthermore, new ILandmarkWarp implementations should be added to the factory class LandmarkWarpFactory. The class WarpIO can be used to write a warp to disk. The file will encode all the parameters necessary to recreate the warp object. | |||||||
| > > |
To permit simple IO operations, all ILandmarkWarp must also be IParameterizable with static (ILandmarkWarp)construct(ParameterBlock) method. Furthermore, new ILandmarkWarp implementations should be added to the factory class LandmarkWarpFactory. The class WarpIO can be used to write a warp to disk. The file will encode all the parameters necessary to recreate the warp object. This file is ASCII and human readable, although in general it is difficult to interpret the parameters without reading the code. There is also a file format for landmarks. This allows LandmarkSet objects to be read and written to disk. The format is ASCII and human readable and writable. Each point has space-delimited coordinates, and points are line-delimited. The order of the points in the stream implies the indices in the LandmarkSet. Comments are allowed after a '#' character, and arbitrary white-space and empty lines are allowed. | |||||||
Mathematical Background | ||||||||
| <<O>> Difference Topic LandmarkWarpUserGuide1x0 (r1.7 - 11 Apr 2007 - CraigSchwartz) |
Landmark Warp Framework User's Guide Version 1.0 | ||||||||
| Line: 16 to 16 | ||||||||
|---|---|---|---|---|---|---|---|---|
| A landmark is a mutable object that contains N-dimensional floating point data. An indexed set of landmarks is a LandmarkSet, which does not allow (approximately) duplicate elements. Furthermore, homologous landmark sets are contained in a LandmarkSetPair object, that requires the sets to have the same size and dimension. | ||||||||
| Changed: | ||||||||
| < < |
Each transformation is an immutable object that can take a point from the input space and copy the result to an array describing the output. They implement an interface ILandmarkWarp?, which is an extension of an IFunction. Like an IFunction, ILandmarkWarp classes favor memory reuse by copying output to the argument as opposed to allocating and returning a result. All ILandmarkWarp implementations should have a static (ILandmarkWarp)estimate(LandmarkSetPair) method. | |||||||
| > > |
Each transformation is an immutable object that can take a point from the input space and copy the result to an array describing the output. They implement an interface ILandmarkWarp, which is an extension of an IFunction. Like an IFunction, ILandmarkWarp classes favor memory reuse by copying output to the argument as opposed to allocating and returning a result. All ILandmarkWarp implementations should have a static (ILandmarkWarp)estimate(LandmarkSetPair) method. | |||||||
| Although ILandmarkWarp (and more generally IFunction) classes allow for only point based operations, given structures that contain multiple points, mapping objects can be used to apply the function to all the points in the structure without changing the transformation implementation. An example of a mapping function is one that implements IMap. This allows a minimal amount of implementation for the specific transformation. Furthermore, the process of applying the transformation to multiple points is easily reimplemented, i.e. for multi-threaded or distributed computing. | ||||||||
| Changed: | ||||||||
| < < |
To permit simple 1IO operations, all ILandmarkWarp must also be IParameterizable with static (ILandmarkWarp)construct(ParameterBlock) method. Furthermore, new ILandmarkWarp? implementations should be added to the factory class LandmarkWarpFactory. The class WarpIO can be used to write a warp to disk. The file will encode all the parameters necessary to recreate the warp object. | |||||||
| > > |
To permit simple IO operations, all ILandmarkWarp must also be IParameterizable with static (ILandmarkWarp)construct(ParameterBlock) method. Furthermore, new ILandmarkWarp implementations should be added to the factory class LandmarkWarpFactory. The class WarpIO can be used to write a warp to disk. The file will encode all the parameters necessary to recreate the warp object. | |||||||
Mathematical Background | ||||||||
| <<O>> Difference Topic LandmarkWarpUserGuide1x0 (r1.6 - 04 Apr 2007 - RyanCabeen) |
Landmark Warp Framework User's Guide Version 1.0 | ||||||||
| Line: 6 to 6 | ||||||||
|---|---|---|---|---|---|---|---|---|
Overview | ||||||||
| Changed: | ||||||||
| < < |
This is a framework for landmark based warps; that is, a warp defined by homologous sets of points (landmarks) in two different spaces. This framework allows the user to find a mapping that best maps the landmarks in one space to landmarks in another space. This provides tools for computing, applying and implementing the warps. Currently there are the following types of landmark warps: Procrustes, Generalized Procrustes, and non-linear warps. | |||||||
| > > |
This is a framework for estimating and applying transformations that are defined by landmark input/output pairs; that is, a warp defined by homologous sets of points (landmarks) in two different spaces. This framework allows the user to find a mapping that best maps the landmarks in one space to landmarks in another space. This provides tools for computing, applying and implementing the warps in an extensible way. Currently there are the following types of landmark warps: Procrustes, Generalized Procrustes, non-linear spline and affine transformations. | |||||||
| Changed: | ||||||||
| < < |
In a Procrustes warp, the two spaces are related by a rotation and a translation. In a Generalized Procrustes warp, scaling is allowed in addition to the rotation and translation. | |||||||
| > > |
The general problem is to compute a function which maps from one set of user-defined points to another set of user-defined points. The behavior of the function at non-landmark points depends on the transform being used. This can range from rigid transforms that minimize the error of the transform to non-linear that maximize the smoothness between landmarks. | |||||||
| Changed: | ||||||||
| < < |
The non-linear problem is more open-ended. In the non-linear warp, landmarks in the input space are mapped exactly to landmarks in the output space. The behavior at non-landmark points depends on the basis functions used to define the mapping. The framework allows for the user to implement new basis functions. | |||||||
| > > |
Implementation | |||||||
| Changed: | ||||||||
| < < |
Mathematical Background | |||||||
| > > |
This library has an object oriented design that is supported by some elements of the ShapeTools library. | |||||||
| Changed: | ||||||||
| < < |
This section will address the mathematics used to compute the warps. | |||||||
| > > |
A landmark is a mutable object that contains N-dimensional floating point data. An indexed set of landmarks is a LandmarkSet, which does not allow (approximately) duplicate elements. Furthermore, homologous landmark sets are contained in a LandmarkSetPair object, that requires the sets to have the same size and dimension. | |||||||
| Changed: | ||||||||
| < < |
In the case of a Procrustes warp, the set of landmarks can be considered a shape. Given two shapes, the framework can compute the rotation and translation necessary to bring the first shape into a least-squares best-fit alignment with the second shape. In the case of a Generalized Procrustes warp, scaling is also considered when computing the warp. For a N-dimensional Procrustes warp to exist, at least N of the K landmarks must be in general position. | |||||||
| > > |
Each transformation is an immutable object that can take a point from the input space and copy the result to an array describing the output. They implement an interface ILandmarkWarp?, which is an extension of an IFunction. Like an IFunction, ILandmarkWarp classes favor memory reuse by copying output to the argument as opposed to allocating and returning a result. All ILandmarkWarp implementations should have a static (ILandmarkWarp)estimate(LandmarkSetPair) method. | |||||||
| Changed: | ||||||||
| < < |
For the non-linear case, consider two spaces A and B, and let there be two sets of points p.i from A and q.i from B for i = [0,K]. For our purposes, A and B will both be RN. We would like to find a function f:A->B such that f(p.i) = q.i for all i. This is the mapping we call the warp. Let G be a function G:RN->RNxN which maps a point to a NxN matrix-- this is the basis function. Let d be a function d:RNxRN->RN that is the displacement function d(a,b) = b-a-- we let f(a) = a + d(a,b). We can define d as a linear combination of basis functions and a linear transformation: | |||||||
| > > |
Although ILandmarkWarp (and more generally IFunction) classes allow for only point based operations, given structures that contain multiple points, mapping objects can be used to apply the function to all the points in the structure without changing the transformation implementation. An example of a mapping function is one that implements IMap. This allows a minimal amount of implementation for the specific transformation. Furthermore, the process of applying the transformation to multiple points is easily reimplemented, i.e. for multi-threaded or distributed computing. | |||||||
| Changed: | ||||||||
| < < |
d(p) = sum( G(p-p.i) * c.i ) + A * p + b | |||||||
| > > |
To permit simple 1IO operations, all ILandmarkWarp must also be IParameterizable with static (ILandmarkWarp)construct(ParameterBlock) method. Furthermore, new ILandmarkWarp? implementations should be added to the factory class LandmarkWarpFactory. The class WarpIO can be used to write a warp to disk. The file will encode all the parameters necessary to recreate the warp object. | |||||||
| Changed: | ||||||||
| < < |
where the sum is from i = 0 to i = K. P is from RN and is the point to be mapped. p.i from RN is the i-th landmark in the domain. c.i is from RN and is the i-th non-linear coefficient. A is from RNxN and contains the affine coefficients. b is from RN and contains the linear shift coefficients. | |||||||
| > > |
Mathematical Background | |||||||
| Changed: | ||||||||
| < < |
The coefficients are computed by solving a system of K*N+N*(N+1) linear equations which ensure the function maps landmarks to landmarks in addition to some flatness constraints. | |||||||
| > > |
This section will address the mathematics of the warps. | |||||||
| Changed: | ||||||||
| < < |
For the solution to exist, the domain landmarks must span RN and be distinct. For example, you cannot use points that lie on a plane to define a 3D warp, and you cannot make a warp that has two domain landmarks at the origin. | |||||||
| > > |
For an affine warp, the transformation is the combination of an arbitrary linear transformation and a translation. This allows for translation, scaling, rotation and skewing. This is estimated by solving the linear least squares problem. Given two sets of landmarks that are related in a non-linear way, this will not map landmarks exactly. For an N-dimensional problem, at least N of the K landmarks must be in general position. | |||||||
| Changed: | ||||||||
| < < |
Implementation | |||||||
| > > |
In the case of a Procrustes warp, the set of landmarks can be considered a shape which is equivalent under rotation and translation. Given two instances of a shape, the framework can compute the rotation and translation necessary to bring the first shape into a least-squares best-fit alignment with the second shape. In the case of a Generalized Procrustes warp, scaling is also considered when computing the warp. For a N-dimensional problem, at least N of the K landmarks must be in general position. | |||||||
| Changed: | ||||||||
| < < |
To use this, we need to represent sets of points (landmarks) in some way. One way is to store sets of points as a two dimensional array. This framework is integrated with the ShapeTools library, so you can also use PointSets to encode the landmarks. In keeping with the ShapeTools convention, all two dimensional point arrays will have the dimension be the first coordinate and the index the second coordinate. All points are stored as floats; however, the computation of the coefficients is done with doubles. | |||||||
| > > |
For the non-linear spline case, the function is described as the sum of an affine transform and the weighted sum of basis functions. Each warp of this kind has a basis function of a single form that is modelled by an IBasisFunction. For a N-dimensional problem, at least N of the K landmarks must be in general position. | |||||||
| Changed: | ||||||||
| < < |
The basic interface is IWarp. This has several methods: apply(float[]), getName(), and getVersion(). There are implementations GeneralizedProcrustesWarp, ProcrustesWarp and NonLinearWarp. The warp is an extension of IFunction, hence it has the methods getInputDimension() and getOutputDimension(); furthermore, this allows the Map classes apply the warp to other data structures besides a point. | |||||||
| > > |
Specifically, consider two spaces A and B, and let there be two sets of points p.i from A and q.i from B for i = [0,K]. For our purposes, A and B will both be RN. We would like to find a function f:A->B such that f(p.i) = q.i for all i. This is the mapping we call the warp. Let G be a function G:RN->RNxN which maps a point to a NxN matrix-- this is the basis function. Let d be a function d:RNxRN->RN that is the displacement function d(a,b) = b-a-- we let f(a) = a + d(a,b). We can define d as a linear combination of basis functions and a linear transformation: | |||||||
| Changed: | ||||||||
| < < |
Non-linear warps can be instantiated by either specifying the coefficients, basis function and input landmarks explicitly or by providing the basis function, input and output landmarks and computing the coefficients. | |||||||
| > > |
d(p) = sum( G(p-p.i) * c.i ) + A * p + b | |||||||
| Changed: | ||||||||
| < < |
Basis functions are classes that implement the interface IBasisFunction for use with non-linear warps. All basis functions must implement the following methods: getDimension(), apply(float[]), getName() and getVersion(). The user can implement a new basis function using this interface. There are variations among the basis functions depending on the dimension of the warp and parameters of the model used to derive them. | |||||||
| > > |
where the sum is from i = 0 to i = K. P is from RN and is the point to be mapped. p.i from RN is the i-th landmark in the domain. c.i is from RN and is the i-th non-linear coefficient. A is from RNxN and contains the affine coefficients. b is from RN and contains the linear shift coefficients. | |||||||
| Changed: | ||||||||
| < < |
The warps can be encoded and decoded to disk using the class WarpIO. This writes the warp coefficients in an human-readable file for later use. | |||||||
| > > |
The coefficients are computed by solving a system of K*N+N*(N+1) linear equations which ensure the function maps landmarks to landmarks in addition to some affine transform. | |||||||
| <<O>> Difference Topic LandmarkWarpUserGuide1x0 (r1.5 - 08 Jan 2007 - RyanCabeen) |
Landmark Warp Framework User's Guide Version 1.0 | ||||||||
| Line: 24 to 24 | ||||||||
|---|---|---|---|---|---|---|---|---|
| where the sum is from i = 0 to i = K. P is from RN and is the point to be mapped. p.i from RN is the i-th landmark in the domain. c.i is from RN and is the i-th non-linear coefficient. A is from RNxN and contains the affine coefficients. b is from RN and contains the linear shift coefficients. | ||||||||
| Changed: | ||||||||
| < < |
The coefficients are computed by solving a system of K*N+N*(N+1) linear equations that imply that satisfy the conditions on f and computing the output of the basis function at K*K points. | |||||||
| > > |
The coefficients are computed by solving a system of K*N+N*(N+1) linear equations which ensure the function maps landmarks to landmarks in addition to some flatness constraints. | |||||||
| For the solution to exist, the domain landmarks must span RN and be distinct. For example, you cannot use points that lie on a plane to define a 3D warp, and you cannot make a warp that has two domain landmarks at the origin. | ||||||||
| <<O>> Difference Topic LandmarkWarpUserGuide1x0 (r1.4 - 18 Dec 2006 - RyanCabeen) |
Landmark Warp Framework User's Guide Version 1.0 | ||||||||
| Line: 6 to 6 | ||||||||
|---|---|---|---|---|---|---|---|---|
Overview | ||||||||
| Changed: | ||||||||
| < < |
This is a framework for landmark based warps; that is, a warp that is defined by homologous sets of points (landmarks) in two different spaces. This framework allows the user to find a mapping that best maps the landmarks in one space to landmarks in another space. This provides tools for computing, applying and implementing the warps. Currently there are the following types of landmark warps: Procrustes, Generalized Procrustes, non-linear warp. | |||||||
| > > |
This is a framework for landmark based warps; that is, a warp defined by homologous sets of points (landmarks) in two different spaces. This framework allows the user to find a mapping that best maps the landmarks in one space to landmarks in another space. This provides tools for computing, applying and implementing the warps. Currently there are the following types of landmark warps: Procrustes, Generalized Procrustes, and non-linear warps. | |||||||
| In a Procrustes warp, the two spaces are related by a rotation and a translation. In a Generalized Procrustes warp, scaling is allowed in addition to the rotation and translation. | ||||||||
| Line: 32 to 32 | ||||||||
| To use this, we need to represent sets of points (landmarks) in some way. One way is to store sets of points as a two dimensional array. This framework is integrated with the ShapeTools library, so you can also use PointSets to encode the landmarks. In keeping with the ShapeTools convention, all two dimensional point arrays will have the dimension be the first coordinate and the index the second coordinate. All points are stored as floats; however, the computation of the coefficients is done with doubles. | ||||||||
| Changed: | ||||||||
| < < |
The basic interface is IWarp. This has several methods: apply(float[]), getDimension(), getName(), and getVersion(). The abstract class PointSetWarp implements this interface and provides the methods for applying the warp to more complicated structures, but does not compute the warp. There are implementations GeneralizedProcrustesWarp, ProcrustesWarp and NonLinearWarp. | |||||||
| > > |
The basic interface is IWarp. This has several methods: apply(float[]), getName(), and getVersion(). There are implementations GeneralizedProcrustesWarp, ProcrustesWarp and NonLinearWarp. The warp is an extension of IFunction, hence it has the methods getInputDimension() and getOutputDimension(); furthermore, this allows the Map classes apply the warp to other data structures besides a point. | |||||||
| Non-linear warps can be instantiated by either specifying the coefficients, basis function and input landmarks explicitly or by providing the basis function, input and output landmarks and computing the coefficients. | ||||||||
| Changed: | ||||||||
| < < |
Basis functions are classes that implement the interface IBasisFunction. All basis functions must implement the following methods: getDimension(), apply(float[]), getName() and getVersion(). The user can implement a new basis function using this interface. There are variations among the basis functions depending on the dimension of the warp and parameters of the model used to derive them. | |||||||
| > > |
Basis functions are classes that implement the interface IBasisFunction for use with non-linear warps. All basis functions must implement the following methods: getDimension(), apply(float[]), getName() and getVersion(). The user can implement a new basis function using this interface. There are variations among the basis functions depending on the dimension of the warp and parameters of the model used to derive them. | |||||||
| The warps can be encoded and decoded to disk using the class WarpIO. This writes the warp coefficients in an human-readable file for later use. | ||||||||
| <<O>> Difference Topic LandmarkWarpUserGuide1x0 (r1.3 - 07 Dec 2006 - RyanCabeen) |
Landmark Warp Framework User's Guide Version 1.0 | ||||||||
| Line: 6 to 6 | ||||||||
|---|---|---|---|---|---|---|---|---|
Overview | ||||||||
| Changed: | ||||||||
| < < |
This is a framework for using non-linear landmark based warps. This provides tools for computing, applying and implementing warp. The general problem is to find a mapping RN->RN that maps a set of points p.i from the domain to points q.i in the codomain for all i=[1,k]-- these are the landmarks. The behavior at non-landmark points depends on the basis functions used to define the mapping. Given a type of basis function and the landmarks, the framework can compute the coefficients that define the warp. Given the coefficients that define the warp, the framework can apply the mapping. Furthermore, the framework allows for the user to implement new basis functions. | |||||||
| > > |
This is a framework for landmark based warps; that is, a warp that is defined by homologous sets of points (landmarks) in two different spaces. This framework allows the user to find a mapping that best maps the landmarks in one space to landmarks in another space. This provides tools for computing, applying and implementing the warps. Currently there are the following types of landmark warps: Procrustes, Generalized Procrustes, non-linear warp. In a Procrustes warp, the two spaces are related by a rotation and a translation. In a Generalized Procrustes warp, scaling is allowed in addition to the rotation and translation. The non-linear problem is more open-ended. In the non-linear warp, landmarks in the input space are mapped exactly to landmarks in the output space. The behavior at non-landmark points depends on the basis functions used to define the mapping. The framework allows for the user to implement new basis functions. | |||||||
Mathematical BackgroundThis section will address the mathematics used to compute the warps. | ||||||||
| Changed: | ||||||||
| < < |
For two spaces A and B, let there be two sets of points p.i from A and q.i from B for i = [0,K]. For our purposes, A and B will both be RN. We would like to find a function f:A->B such that f(p.i) = q.i for all i. This is the mapping we call the warp. Let G be a function G:RN->RNxN which maps a point to a NxN matrix-- this is the basis function. Let d be a function d:RNxRN->RN that is the displacement function d(a,b) = b-a-- we let f(a) = a + d(a,b). We can define d as a linear combination of basis functions and a linear transformation: | |||||||
| > > |
In the case of a Procrustes warp, the set of landmarks can be considered a shape. Given two shapes, the framework can compute the rotation and translation necessary to bring the first shape into a least-squares best-fit alignment with the second shape. In the case of a Generalized Procrustes warp, scaling is also considered when computing the warp. For a N-dimensional Procrustes warp to exist, at least N of the K landmarks must be in general position. For the non-linear case, consider two spaces A and B, and let there be two sets of points p.i from A and q.i from B for i = [0,K]. For our purposes, A and B will both be RN. We would like to find a function f:A->B such that f(p.i) = q.i for all i. This is the mapping we call the warp. Let G be a function G:RN->RNxN which maps a point to a NxN matrix-- this is the basis function. Let d be a function d:RNxRN->RN that is the displacement function d(a,b) = b-a-- we let f(a) = a + d(a,b). We can define d as a linear combination of basis functions and a linear transformation: | |||||||
| d(p) = sum( G(p-p.i) * c.i ) + A * p + b | ||||||||
| Line: 24 to 30 | ||||||||
Implementation | ||||||||
| Changed: | ||||||||
| < < |
To use this, we need to represent sets of points (landmarks) in some way. One way is to store sets of points as a two dimensional array. This framework is integrated with the ShapeTools library, so you can also use PointSets to encode the landmarks. All points are stored as floats; however, the computation of the coefficients is done with doubles. | |||||||
| > > |
To use this, we need to represent sets of points (landmarks) in some way. One way is to store sets of points as a two dimensional array. This framework is integrated with the ShapeTools library, so you can also use PointSets to encode the landmarks. In keeping with the ShapeTools convention, all two dimensional point arrays will have the dimension be the first coordinate and the index the second coordinate. All points are stored as floats; however, the computation of the coefficients is done with doubles. | |||||||
| Changed: | ||||||||
| < < |
The basic interface is IWarp. This has two methods apply(float[]) and getDimension(). The abstract class PointSetWarp implements this interface and provides the methods for applying the warp to more complicated structures, but does not compute the warp. The class LandmarkWarp actually computes the coefficients and applies the warp to novel points. | |||||||
| > > |
The basic interface is IWarp. This has several methods: apply(float[]), getDimension(), getName(), and getVersion(). The abstract class PointSetWarp implements this interface and provides the methods for applying the warp to more complicated structures, but does not compute the warp. There are implementations GeneralizedProcrustesWarp, ProcrustesWarp and NonLinearWarp. | |||||||
| Changed: | ||||||||
| < < |
Landmark warp can be instantiated by either specifying the coefficients, basis function and domain landmarks explicitly or by providing the basis function, domain and codomain landmarks and computing the coefficients. When only landmarks are provided, the class creates a system of linear equations that are solved using LU decomposition. | |||||||
| > > |
Non-linear warps can be instantiated by either specifying the coefficients, basis function and input landmarks explicitly or by providing the basis function, input and output landmarks and computing the coefficients. | |||||||
| Changed: | ||||||||
| < < |
Basis functions are classes that implement the interface IBasisFunction. All basis functions must implement three methods: getDimension(), apply(float[]), and getName(). The user can implement a new basis function using this interface. Currently, there are two general types of basis functions, thin plate splines and elastic body splines. The first is derived from a model of how metal sheets deform, and the other is derived from the way in which elastic materials deform. There are variations among these basis functions depending on the dimension of the warp and parameters of the model used to derive them. | |||||||
| > > |
Basis functions are classes that implement the interface IBasisFunction. All basis functions must implement the following methods: getDimension(), apply(float[]), getName() and getVersion(). The user can implement a new basis function using this interface. There are variations among the basis functions depending on the dimension of the warp and parameters of the model used to derive them. | |||||||
| Changed: | ||||||||
| < < |
The warps can be encoded and decoded to disk using the class LandmarkWarpIO. This writes the warp coefficients in an ASCII file for later use. | |||||||
| > > |
The warps can be encoded and decoded to disk using the class WarpIO. This writes the warp coefficients in an human-readable file for later use. | |||||||
| <<O>> Difference Topic LandmarkWarpUserGuide1x0 (r1.2 - 22 Nov 2006 - RyanCabeen) |
Landmark Warp Framework User's Guide Version 1.0 | ||||||||
| Line: 12 to 12 | ||||||||
|---|---|---|---|---|---|---|---|---|
| This section will address the mathematics used to compute the warps. | ||||||||
| Changed: | ||||||||
| < < |
For two spaces A and B, let there be two sets of points p.i from A and q.i from B for i = [0,K]. For our purposes, A and B will both be RN. We would like to find a function f:A->B such that f(p.i) = q.i for all i. This is the mapping we call the warp. Consider also a function G:RN->RNxN which maps a point to a NxN matrix. This is the mapping we call the basis function. Consider another function d:RNxRN->RN that is the d(a,b) = b-a. This is the displacement-- notice that f(a) = a + d(a,b). We can define d as a linear combination of basis functions and a linear transformation: | |||||||
| > > |
For two spaces A and B, let there be two sets of points p.i from A and q.i from B for i = [0,K]. For our purposes, A and B will both be RN. We would like to find a function f:A->B such that f(p.i) = q.i for all i. This is the mapping we call the warp. Let G be a function G:RN->RNxN which maps a point to a NxN matrix-- this is the basis function. Let d be a function d:RNxRN->RN that is the displacement function d(a,b) = b-a-- we let f(a) = a + d(a,b). We can define d as a linear combination of basis functions and a linear transformation: | |||||||
| d(p) = sum( G(p-p.i) * c.i ) + A * p + b | ||||||||
| <<O>> Difference Topic LandmarkWarpUserGuide1x0 (r1.1 - 15 Nov 2006 - RyanCabeen) |
| Line: 1 to 1 | ||||||||
|---|---|---|---|---|---|---|---|---|
| Added: | ||||||||
| > > |
Landmark Warp Framework User's Guide Version 1.0OverviewThis is a framework for using non-linear landmark based warps. This provides tools for computing, applying and implementing warp. The general problem is to find a mapping RN->RN that maps a set of points p.i from the domain to points q.i in the codomain for all i=[1,k]-- these are the landmarks. The behavior at non-landmark points depends on the basis functions used to define the mapping. Given a type of basis function and the landmarks, the framework can compute the coefficients that define the warp. Given the coefficients that define the warp, the framework can apply the mapping. Furthermore, the framework allows for the user to implement new basis functions.Mathematical BackgroundThis section will address the mathematics used to compute the warps. For two spaces A and B, let there be two sets of points p.i from A and q.i from B for i = [0,K]. For our purposes, A and B will both be RN. We would like to find a function f:A->B such that f(p.i) = q.i for all i. This is the mapping we call the warp. Consider also a function G:RN->RNxN which maps a point to a NxN matrix. This is the mapping we call the basis function. Consider another function d:RNxRN->RN that is the d(a,b) = b-a. This is the displacement-- notice that f(a) = a + d(a,b). We can define d as a linear combination of basis functions and a linear transformation: d(p) = sum( G(p-p.i) * c.i ) + A * p + b where the sum is from i = 0 to i = K. P is from RN and is the point to be mapped. p.i from RN is the i-th landmark in the domain. c.i is from RN and is the i-th non-linear coefficient. A is from RNxN and contains the affine coefficients. b is from RN and contains the linear shift coefficients. The coefficients are computed by solving a system of K*N+N*(N+1) linear equations that imply that satisfy the conditions on f and computing the output of the basis function at K*K points. For the solution to exist, the domain landmarks must span RN and be distinct. For example, you cannot use points that lie on a plane to define a 3D warp, and you cannot make a warp that has two domain landmarks at the origin.ImplementationTo use this, we need to represent sets of points (landmarks) in some way. One way is to store sets of points as a two dimensional array. This framework is integrated with the ShapeTools library, so you can also use PointSets to encode the landmarks. All points are stored as floats; however, the computation of the coefficients is done with doubles. The basic interface is IWarp. This has two methods apply(float[]) and getDimension(). The abstract class PointSetWarp implements this interface and provides the methods for applying the warp to more complicated structures, but does not compute the warp. The class LandmarkWarp actually computes the coefficients and applies the warp to novel points. Landmark warp can be instantiated by either specifying the coefficients, basis function and domain landmarks explicitly or by providing the basis function, domain and codomain landmarks and computing the coefficients. When only landmarks are provided, the class creates a system of linear equations that are solved using LU decomposition. Basis functions are classes that implement the interface IBasisFunction. All basis functions must implement three methods: getDimension(), apply(float[]), and getName(). The user can implement a new basis function using this interface. Currently, there are two general types of basis functions, thin plate splines and elastic body splines. The first is derived from a model of how metal sheets deform, and the other is derived from the way in which elastic materials deform. There are variations among these basis functions depending on the dimension of the warp and parameters of the model used to derive them. The warps can be encoded and decoded to disk using the class LandmarkWarpIO. This writes the warp coefficients in an ASCII file for later use. | |||||||
|
Revision r1.1 - 15 Nov 2006 - 00:31 - RyanCabeen Revision r1.14 - 12 Aug 2008 - 19:32 - RyanCabeen |