@Override final public void applyInverseInPlace( final double[] location ) throws NoninvertibleModelException { final ListIterator< E > i = transforms.listIterator( transforms.size() ); while ( i.hasPrevious() ) i.previous().applyInverseInPlace( location ); }
@Override public InvertibleCoordinateTransform createInverse() { @SuppressWarnings( "unchecked" ) final InvertibleInterpolatedModel< A, B, M > inverse = new InvertibleInterpolatedModel< A, B, M >( ( A )a.createInverse(), ( B )b.createInverse(), lambda ); inverse.cost = cost; return inverse; } }
@Override final public void applyInPlace( final double[] location ) { for ( final E t : transforms ) t.applyInPlace( location ); }
@Override final public void applyInverseInPlace( final double[] location ) throws NoninvertibleModelException { final ListIterator< E > i = transforms.listIterator( transforms.size() ); while ( i.hasPrevious() ) i.previous().applyInverseInPlace( location ); }
@Override public InvertibleCoordinateTransform createInverse() { @SuppressWarnings( "unchecked" ) final InvertibleInterpolatedModel< A, B, M > inverse = new InvertibleInterpolatedModel< A, B, M >( ( A )a.createInverse(), ( B )b.createInverse(), lambda ); inverse.cost = cost; return inverse; } }
@Override final public void applyInPlace( final double[] location ) { for ( final E t : transforms ) t.applyInPlace( location ); }
@Override public final void applyInPlace(final double[] p) { try { ict.applyInverseInPlace(p); } catch (final NoninvertibleModelException e) { Utils.log2("Point outside mesh: " + p[0] + ", " + p[1]); } } @Override
@Override public InvertibleCoordinateTransform createInverse() { @SuppressWarnings( "unchecked" ) final InvertibleConstantModel< A, M > inverse = new InvertibleConstantModel< A, M >( ( A )model.createInverse() ); inverse.cost = cost; return inverse; } }
@Override public final void applyInverseInPlace(final double[] p) { ict.applyInPlace(p); } @Override
(mpicbg.models.InvertibleCoordinateTransform) ct : new mpicbg.trakem2.transform.TransformMesh(ct, meshResolution, o_width, o_height); try { t.applyInverseInPlace(f); } catch ( final NoninvertibleModelException e ) {} d[0] = f[0]; d[1] = f[1];
@Override public InvertibleCoordinateTransform createInverse() { @SuppressWarnings( "unchecked" ) final InvertibleConstantModel< A, M > inverse = new InvertibleConstantModel< A, M >( ( A )model.createInverse() ); inverse.cost = cost; return inverse; } }
@Override public void mapInverseInterpolated( final ImageProcessor source, final ImageProcessor target ) { final double[] t = new double[ 2 ]; final int sw = source.getWidth() - 1; final int sh = source.getHeight() - 1; final int tw = target.getWidth(); final int th = target.getHeight(); for ( int y = 0; y < th; ++y ) { for ( int x = 0; x < tw; ++x ) { t[ 0 ] = x; t[ 1 ] = y; transform.applyInPlace( t ); if ( t[ 0 ] >= 0 && t[ 0 ] < sw && t[ 1 ] >= 0 && t[ 1 ] < sh ) target.putPixel( x, y, source.getPixelInterpolated( t[ 0 ], t[ 1 ] ) ); } } } }
@Override final protected void addHandle( final int x, final int y ) { final double[] l = new double[]{ x, y }; synchronized ( mesh ) { final InvertibleCoordinateTransform ict = ( InvertibleCoordinateTransform )mesh.findClosest( l ).getModel(); try { ict.applyInverseInPlace( l ); final Point here = new Point( l ); final Point there = new Point( l ); hooks.add( here ); here.apply( ict ); mesh.addMatchWeightedByDistance( new PointMatch( there, here, 10f ), alpha ); } catch ( final NoninvertibleModelException e ){ e.printStackTrace(); } } }
@SuppressWarnings( "unchecked" ) @Override public InvertibleCoordinateTransformList< E > createInverse() { final InvertibleCoordinateTransformList< E > ict = new InvertibleCoordinateTransformList< E >(); final ListIterator< E > i = transforms.listIterator( transforms.size() ); while ( i.hasPrevious() ) ict.add( ( E )i.previous().createInverse() ); return ict; } }
@Override public void mapInverse( final ImageProcessor source, final ImageProcessor target ) { final double[] t = new double[ 2 ]; final int sw = source.getWidth() - 1; final int sh = source.getHeight() - 1; final int tw = target.getWidth(); final int th = target.getHeight(); for ( int y = 0; y < th; ++y ) { for ( int x = 0; x < tw; ++x ) { t[ 0 ] = x; t[ 1 ] = y; transform.applyInPlace( t ); final int tx = ( int )( t[ 0 ] + 0.5f ); final int ty = ( int )( t[ 1 ] + 0.5f ); if ( t[ 0 ] >= 0 && t[ 0 ] <= sw && t[ 1 ] >= 0 && t[ 1 ] <= sh ) target.putPixel( x, y, source.getPixel( tx, ty ) ); } } }
@Override final protected void addHandle( final int x, final int y ) { final double[] l = new double[]{ x, y }; synchronized ( mesh ) { final InvertibleCoordinateTransform ict = ( InvertibleCoordinateTransform )mesh.findClosest( l ).getModel(); try { ict.applyInverseInPlace( l ); final Point here = new Point( l ); final Point there = new Point( l ); hooks.add( here ); here.apply( ict ); mesh.addMatchWeightedByDistance( new PointMatch( there, here, 10f ), alpha ); } catch ( final NoninvertibleModelException e ){ e.printStackTrace(); } } }
@SuppressWarnings( "unchecked" ) @Override public InvertibleCoordinateTransformList< E > createInverse() { final InvertibleCoordinateTransformList< E > ict = new InvertibleCoordinateTransformList< E >(); final ListIterator< E > i = transforms.listIterator( transforms.size() ); while ( i.hasPrevious() ) ict.add( ( E )i.previous().createInverse() ); return ict; } }
@Override public void mapInverseInterpolated( final ImageProcessor source, final ImageProcessor target ) { final double[] t = new double[ 2 ]; final int sw = source.getWidth() - 1; final int sh = source.getHeight() - 1; final int tw = target.getWidth(); final int th = target.getHeight(); for ( int y = 0; y < th; ++y ) { for ( int x = 0; x < tw; ++x ) { t[ 0 ] = x; t[ 1 ] = y; transform.applyInPlace( t ); if ( t[ 0 ] >= 0 && t[ 0 ] < sw && t[ 1 ] >= 0 && t[ 1 ] < sh ) target.putPixel( x, y, source.getPixelInterpolated( t[ 0 ], t[ 1 ] ) ); } } } }
@Override public void mapInterpolated( final ImageProcessor source, final ImageProcessor target ) { final double[] t = new double[ 2 ]; final int sw = source.getWidth() - 1; final int sh = source.getHeight() - 1; final int tw = target.getWidth(); final int th = target.getHeight(); for ( int y = 0; y < th; ++y ) { for ( int x = 0; x < tw; ++x ) { t[ 0 ] = x; t[ 1 ] = y; try { transform.applyInverseInPlace( t ); if ( t[ 0 ] >= 0 && t[ 0 ] <= sw && t[ 1 ] >= 0 && t[ 1 ] <= sh ) target.putPixel( x, y, source.getPixelInterpolated( t[ 0 ], t[ 1 ] ) ); } catch ( final NoninvertibleModelException e ){} } } }
ip2Mask, 1.0, ((InvertibleCoordinateTransform) pair.c).createInverse(), blockRadius, blockRadius,