/** * Update all affine transformations that would have been affected by a * given {@link PointMatch Vertex}. * * @param p */ public void updateAffine( final PointMatch p ) { for ( final AffineModel2D ai : va.get( p ) ) { try { ai.fit( av.get( ai ) ); } catch ( final NotEnoughDataPointsException e ) { e.printStackTrace(); } catch ( final IllDefinedDataPointsException e ) { e.printStackTrace(); } } }
/** * Update all affine transformations. * */ public void updateAffines() { final Set< AffineModel2D > s = av.keySet(); for ( final AffineModel2D ai : s ) { try { ai.fit( av.get( ai ) ); } catch ( final NotEnoughDataPointsException e ) { e.printStackTrace(); } catch ( final IllDefinedDataPointsException e ) { e.printStackTrace(); } } }
/** * Update all affine transformations. * */ public void updateAffines() { final Set< AffineModel2D > s = av.keySet(); for ( final AffineModel2D ai : s ) { try { ai.fit( av.get( ai ) ); } catch ( final NotEnoughDataPointsException e ) { e.printStackTrace(); } catch ( final IllDefinedDataPointsException e ) { e.printStackTrace(); } } }
/** * Update all affine transformations that would have been affected by a * given {@link PointMatch Vertex}. * * @param p */ public void updateAffine( final PointMatch p ) { for ( final AffineModel2D ai : va.get( p ) ) { try { ai.fit( av.get( ai ) ); } catch ( final NotEnoughDataPointsException e ) { e.printStackTrace(); } catch ( final IllDefinedDataPointsException e ) { e.printStackTrace(); } } }
@Override public void run() { while ( !isInterrupted() ) { try { if ( pleaseOptimize ) { mesh.optimize( Double.MAX_VALUE, 10000, 1000 ); pleaseIllustrate = false; apply(); } synchronized ( this ){ wait(); } } catch ( final NotEnoughDataPointsException ex ){ ex.printStackTrace( System.err ); } catch ( final InterruptedException e){ Thread.currentThread().interrupt(); } } } }
/** * Add a triangle defined by 3 PointMatches that defines an * AffineTransform2D. * * @param t * 3 PointMatches (will not be copied, so do not reuse this * list!) */ public void addTriangle( final ArrayList< PointMatch > t ) { final AffineModel2D m = new AffineModel2D(); try { m.fit( t ); } catch ( final NotEnoughDataPointsException e ) { e.printStackTrace(); } catch ( final IllDefinedDataPointsException e ) { e.printStackTrace(); } av.put( m, t ); for ( final PointMatch pm : t ) { if ( !va.containsKey( pm ) ) va.put( pm, new ArrayList< AffineModel2D >() ); va.get( pm ).add( m ); } }
@Override public void run() { while ( !isInterrupted() ) { try { if ( pleaseOptimize ) { mesh.optimize( Double.MAX_VALUE, 10000, 1000 ); pleaseIllustrate = false; apply(); } synchronized ( this ){ wait(); } } catch ( final NotEnoughDataPointsException ex ){ ex.printStackTrace( System.err ); } catch ( final InterruptedException e){ Thread.currentThread().interrupt(); } } } }
/** * Add a triangle defined by 3 PointMatches that defines an * AffineTransform2D. * * @param t * 3 PointMatches (will not be copied, so do not reuse this * list!) */ public void addTriangle( final ArrayList< PointMatch > t ) { final AffineModel2D m = new AffineModel2D(); try { m.fit( t ); } catch ( final NotEnoughDataPointsException e ) { e.printStackTrace(); } catch ( final IllDefinedDataPointsException e ) { e.printStackTrace(); } av.put( m, t ); for ( final PointMatch pm : t ) { if ( !va.containsKey( pm ) ) va.put( pm, new ArrayList< AffineModel2D >() ); va.get( pm ).add( m ); } }
10 ); catch( final NotEnoughDataPointsException e ) { e.printStackTrace(); }
@Override public TranslationInvariantModel<?> fitMatches( final ArrayList<PointMatch> matches ) { try { model.fit( matches ); } catch ( NotEnoughDataPointsException e ) { e.printStackTrace(); } catch ( IllDefinedDataPointsException e ) { e.printStackTrace(); } for ( final PointMatch match : matches ) match.getP1().apply( model ); return model; }
e.printStackTrace( System.err ); return 1;
@Override public void mouseDragged( final MouseEvent e ) { if ( targetIndex >= 0 ) { final ImageWindow win = WindowManager.getCurrentWindow(); final int x = win.getCanvas().offScreenX( e.getX() ); final int y = win.getCanvas().offScreenY( e.getY() ); updateHandles( x, y ); try { myModel().fit( m ); for ( final Tuple tuple : tuples ) { synchronized ( tuple.painter ) { tuple.pleaseRepaint.set( true ); tuple.painter.notify(); } } } catch ( final NotEnoughDataPointsException ex ) { ex.printStackTrace(); } catch ( final IllDefinedDataPointsException ex ) { ex.printStackTrace(); } } }
@Override public void mouseDragged( final MouseEvent e ) { if ( targetIndex >= 0 ) { final ImageWindow win = WindowManager.getCurrentWindow(); final int x = win.getCanvas().offScreenX( e.getX() ); final int y = win.getCanvas().offScreenY( e.getY() ); updateHandles( x, y ); try { myModel().fit( m ); for ( final Tuple tuple : tuples ) { synchronized ( tuple.painter ) { tuple.pleaseRepaint.set( true ); tuple.painter.notify(); } } } catch ( final NotEnoughDataPointsException ex ) { ex.printStackTrace(); } catch ( final IllDefinedDataPointsException ex ) { ex.printStackTrace(); } } }
ex.printStackTrace(); return "";
ex.printStackTrace(); return "";
final static public class Param extends mpicbg.trakem2.align.AbstractLayerAlignmentParam implements Serializable { private static final long serialVersionUID = 208742614581106404L; public boolean isAligned = false; public double layerScale = 0.1; public float minR = 0.6f; public float maxCurvatureR = 10f; public float rodR = 0.9f; public int searchRadius = 200; public int blockRadius = -1; public boolean useLocalSmoothnessFilter = true; public int localModelIndex = 1; public float localRegionSigma = searchRadius; public float maxLocalEpsilon = searchRadius / 2; public float maxLocalTrust = 3; public int resolutionSpringMesh = 16; public double stiffnessSpringMesh = 0.1; public double dampSpringMesh = 0.9; public double maxStretchSpringMesh = 2000.0; public int maxIterationsSpringMesh = 1000; public int maxPlateauwidthSpringMesh = 200; public boolean useLegacyOptimizer = true; public boolean useTps = true; public boolean setup( final Rectangle box )
e.printStackTrace(); return;