Java Code Examples for mpicbg.models.Point#getL()
The following examples show how to use
mpicbg.models.Point#getL() .
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: ResidualCalculator.java From render with GNU General Public License v2.0 | 5 votes |
private static Point getLocalPoint(final Point worldPoint, final TileSpec tileSpec) throws NoninvertibleModelException { final double[] world = worldPoint.getL(); final double[] local = tileSpec.getLocalCoordinates(world[0], world[1], tileSpec.getMeshCellSize()); return new Point(local); }
Example 2
Source File: CanvasFeatureMatchResultTest.java From render with GNU General Public License v2.0 | 5 votes |
private void verifyEquality(final String context, final Point expected, final Point actual) { final double[] expectedLocal = expected.getL(); final double[] actualLocal = actual.getL(); Assert.assertEquals("incorrect dimension size for " + context, expectedLocal.length, actualLocal.length); for (int i = 0; i < expectedLocal.length; i++) { Assert.assertEquals("incorrect value at index " + i + " of " + context, expectedLocal[i], actualLocal[i], 0.0001); } }
Example 3
Source File: TestPointDescriptor.java From SPIM_Registration with GNU General Public License v2.0 | 5 votes |
protected static void add( final Point p1, final Point p2 ) { final double[] l1 = p1.getL(); final double[] w1 = p1.getW(); final double[] l2 = p2.getL(); final double[] w2 = p2.getW(); for ( int d = 0; d < l1.length; ++d ) { l1[ d ] += l2[ d ]; w1[ d ] += w2[ d ]; } }
Example 4
Source File: AbstractPointDescriptor.java From SPIM_Registration with GNU General Public License v2.0 | 5 votes |
/** * Resets the world coordinates of the descriptorPoints */ protected void resetWorldCoordinates() { for ( final Point point : descriptorPoints ) { final double[] l = point.getL(); final double[] w = point.getW(); for ( int d = 0; d < l.length; ++d ) w[ d ] = l[ d ]; } }
Example 5
Source File: CanvasFeatureMatchResult.java From render with GNU General Public License v2.0 | 4 votes |
/** * @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; }
Example 6
Source File: NonLinearTransformMode.java From TrakEM2 with GNU General Public License v3.0 | 4 votes |
@Override public void mousePressed( final MouseEvent me, final int x_p, final int y_p, final double magnification ) { /* find if clicked on a point */ p_clicked = null; double min = Double.MAX_VALUE; final Point mouse = new Point( new double[]{ x_p, y_p } ); final double a = 64.0 / magnification / magnification; for ( final Point p : points ) { final double sd = Point.squareDistance( p, mouse ); if ( sd < min && sd < a ) { p_clicked = p; min = sd; } } if ( me.isShiftDown() ) { if ( null == p_clicked ) { /* add one */ try { if ( points.size() > 0 ) { /* * Create a pseudo-invertible (TransformMesh) for the screen. */ final CoordinateTransform mlst = createCT(); final SimilarityModel2D toWorld = new SimilarityModel2D(); toWorld.set( 1.0 / magnification, 0, srcRect.x, srcRect.y ); final SimilarityModel2D toScreen = toWorld.createInverse(); final mpicbg.models.CoordinateTransformList< mpicbg.models.CoordinateTransform > ctl = new mpicbg.models.CoordinateTransformList< mpicbg.models.CoordinateTransform >(); ctl.add( toWorld ); ctl.add( mlst ); ctl.add( toScreen ); final CoordinateTransformMesh ctm = new CoordinateTransformMesh( ctl, 32, ( int )Math.ceil( srcRect.width * magnification ), ( int )Math.ceil( srcRect.height * magnification ) ); final double[] l = mouse.getL(); toScreen.applyInPlace( l ); ctm.applyInverseInPlace( l ); toWorld.applyInPlace( l ); } points.add( mouse ); p_clicked = mouse; } catch ( final Exception e ) { Utils.log( "Could not add point" ); e.printStackTrace(); } } else if ( Utils.isControlDown( me ) ) { // remove it points.remove(p_clicked); p_clicked = null; } } }