Java Code Examples for mpicbg.models.PointMatch#getP2()

The following examples show how to use mpicbg.models.PointMatch#getP2() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PointMatchQualityStats.java    From render with GNU General Public License v2.0 5 votes vote down vote up
private static double[] getWorldDeltaXAndYStandardDeviation(final List<PointMatch> pointMatchList) {
    final double[] deltaWorldX = new double[pointMatchList.size()];
    final double[] deltaWorldY = new double[pointMatchList.size()];
    for (int i = 0; i < pointMatchList.size(); i++) {
        final PointMatch pointMatch = pointMatchList.get(i);
        final Point p = pointMatch.getP1();
        final Point q = pointMatch.getP2();
        deltaWorldX[i] = p.getW()[0] - q.getW()[0];
        deltaWorldY[i] = p.getW()[1] - q.getW()[1];
    }
    return new double[] { calculateStandardDeviation(deltaWorldX), calculateStandardDeviation(deltaWorldY) };
}
 
Example 2
Source File: AbstractAffineTile2D.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Extract the common {@linkplain PointMatch PointMatches} of two tiles.
 *
 * @param other
 * @param commonMatches
 */
final public void commonPointMatches( final Tile< ? > other, final Collection< PointMatch > commonMatches )
{
	for ( final PointMatch pm : matches )
		for ( final PointMatch otherPm : other.getMatches() )
			if ( pm.getP1() == otherPm.getP2() )
			{
				commonMatches.add( pm );
				break;
			}
}
 
Example 3
Source File: CanvasFeatureMatchResult.java    From render with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param  pointMatchList  list of point matches to convert.
 * @param  renderScale     scale of rendered canvases (needed to return matches in full scale coordinates).
 * @param  pOffsets        full scale x[0] and y[1] offset for all pCanvas matches.
 * @param  qOffsets        full scale x[0] and y[1] offset for all qCanvas matches.
 *
 * @return the specified point match list in {@link Matches} form.
 */
private static Matches convertPointMatchListToMatches(final List<PointMatch> pointMatchList,
                                                      final double renderScale,
                                                      final double[] pOffsets,
                                                      final double[] qOffsets) {

    final Matches matches;

    final int pointMatchCount = pointMatchList.size();

    if (pointMatchCount > 0) {

        PointMatch pointMatch = pointMatchList.get(0);
        Point p1 = pointMatch.getP1();
        double[] local1 = p1.getL();
        final int dimensionCount = local1.length;

        final double[][] p = new double[dimensionCount][pointMatchCount];
        final double[][] q = new double[dimensionCount][pointMatchCount];
        final double[] w = new double[pointMatchCount];

        Point p2;
        double[] local2;
        for (int i = 0; i < pointMatchCount; i++) {

            pointMatch = pointMatchList.get(i);

            p1 = pointMatch.getP1();
            local1 = p1.getL();

            p2 = pointMatch.getP2();
            local2 = p2.getL();

            for (int j = 0; j < dimensionCount; j++) {
                // point matches must be stored in full scale world coordinates
                if (renderScale == 1.0) {
                    p[j][i] = local1[j] + pOffsets[j];
                    q[j][i] = local2[j] + qOffsets[j];
                } else {
                    p[j][i] = (local1[j] / renderScale) + pOffsets[j];
                    q[j][i] = (local2[j] / renderScale) + qOffsets[j];
                }
            }

            w[i] = pointMatch.getWeight();

        }

        matches = new Matches(p, q, w);

    } else {
        matches = new Matches(new double[1][0], new double[1][0], new double[0]);
    }


    return matches;
}