1 package mpi
.fruitfly
.registration
;
3 import java
.util
.ArrayList
;
4 import java
.util
.Collection
;
6 public class PointMatch
8 final private Point p1
;
9 final public Point
getP1() { return p1
; }
11 final private Point p2
;
12 final public Point
getP2() { return p2
; }
15 final public float getWeight(){ return weight
; }
16 final public void setWeight( float weight
){ this.weight
= weight
; }
18 private float distance
;
19 final public float getDistance(){ return distance
; }
31 distance
= Point
.distance( p1
, p2
);
43 distance
= Point
.distance( p1
, p2
);
47 * apply a model to p1, update distance
51 final public void apply( Model model
)
54 distance
= Point
.distance( p1
, p2
);
58 * convert from Matches, weight is 1.0
63 final public static ArrayList
< PointMatch
> fromMatches( Collection
< Match
> matches
)
65 ArrayList
< PointMatch
> list
= new ArrayList
< PointMatch
>();
66 for ( Match match
: matches
)
70 new Point( match
.p1
),
71 new Point( match
.p2
) ) );
77 * convert to Matches using the world coordinates, weight gets lost
82 final public static ArrayList
< Match
> toMatches( Collection
< PointMatch
> matches
)
84 ArrayList
< Match
> list
= new ArrayList
< Match
>();
85 for ( PointMatch match
: matches
)
95 final public static ArrayList
< Match
> toLocalMatches( Collection
< PointMatch
> matches
)
97 ArrayList
< Match
> list
= new ArrayList
< Match
>();
98 for ( PointMatch match
: matches
)
109 * flip symmetrically, weight remains unchanged
114 final public static ArrayList
< PointMatch
> flip( Collection
< PointMatch
> matches
)
116 ArrayList
< PointMatch
> list
= new ArrayList
< PointMatch
>();
117 for ( PointMatch match
: matches
)