/** * Initialize the model with the parameters of an {@link AffineTransform}. * * @param a */ @Deprecated final public void set( final AffineTransform a ) { affine.set( a ); }
/** * Initialize the model such that the respective affine transform is: * * <pre> * m00 m01 m02 * m10 m11 m12 * 0 0 1 * </pre> * * @param m00 * @param m10 * * @param m01 * @param m11 * * @param m02 * @param m12 */ @Deprecated final public void set( final double m00, final double m10, final double m01, final double m11, final double m02, final double m12 ) { affine.set( m00, m10, m01, m11, m02, m12 ); }
@Override protected void initModel() { model.set( patch.getAffineTransform() ); }
@Override public void set( final InterpolatedAffineModel2D< A, B > m ) { super.set( m ); affine.set( m.affine ); }
@Override public void set( final InterpolatedAffineModel2D< A, B > m ) { super.set( m ); affine.set( m.affine ); }
/** * Create an affine transformation that compensates for both scale and * pixel shift of a mipmap level that was generated by top-left pixel * averaging. * * @param scaleLevel * @return */ final static protected AffineModel2D createScaleLevelTransform( final int scaleLevel ) { final AffineModel2D a = new AffineModel2D(); final int scale = 1 << scaleLevel; final double t = ( scale - 1 ) * 0.5; a.set( scale, 0, 0, scale, t, t ); return a; }
protected void interpolate() { a.toArray( afs ); b.toArray( bfs ); for ( int i = 0; i < afs.length; ++i ) afs[ i ] = afs[ i ] * l1 + bfs[ i ] * lambda; affine.set( afs[ 0 ], afs[ 1 ], afs[ 2 ], afs[ 3 ], afs[ 4 ], afs[ 5 ] ); }
public void interpolate() { a.toArray( afs ); b.toArray( bfs ); for ( int i = 0; i < afs.length; ++i ) afs[ i ] = afs[ i ] * l1 + bfs[ i ] * lambda; affine.set( afs[ 0 ], afs[ 1 ], afs[ 2 ], afs[ 3 ], afs[ 4 ], afs[ 5 ] ); }
/** The @param ict is expected to transform the data as if this data was expressed in world coordinates, * so this method returns a transformation list that prepends the transform from local to world, then the @param ict, then from world to local. */ static public final mpicbg.models.CoordinateTransform wrap(final AffineTransform to_world, final mpicbg.models.CoordinateTransform ict, final AffineTransform to_local) throws Exception { final mpicbg.models.CoordinateTransformList<mpicbg.models.CoordinateTransform> chain = new mpicbg.models.CoordinateTransformList<mpicbg.models.CoordinateTransform>(); // bravo! // 1 - Prepend to world final mpicbg.models.AffineModel2D toworld = new mpicbg.models.AffineModel2D(); toworld.set(to_world); chain.add(toworld); // 2 - Perform the transform in world coordinates chain.add(ict); // 3 - back to local final mpicbg.models.AffineModel2D tolocal = new mpicbg.models.AffineModel2D(); tolocal.set(to_local); chain.add(tolocal); return chain; }
@SuppressWarnings( "rawtypes" ) @Override protected void initModel() { final AffineTransform a = patch.getAffineTransform(); if ( AffineModel2D.class.isInstance( model ) ) ( ( AffineModel2D )( Object )model ).set( a ); else if ( SimilarityModel2D.class.isInstance( model ) ) ( ( SimilarityModel2D )( Object )model ).set( a.getScaleX(), a.getShearY(), a.getTranslateX(), a.getTranslateY() ); else if ( RigidModel2D.class.isInstance( model ) ) ( ( RigidModel2D )( Object )model ).set( a.getScaleX(), a.getShearY(), a.getTranslateX(), a.getTranslateY() ); else if ( TranslationModel2D.class.isInstance( model ) ) ( ( TranslationModel2D )( Object )model ).set( a.getTranslateX(), a.getTranslateY() ); else if ( InterpolatedAffineModel2D.class.isInstance( model ) ) ( ( InterpolatedAffineModel2D )( Object )model ).set( a ); }
aff.set(m[0], m[4], m[1], m[5], m[3], m[7]); transform = new ImageTransform<R>(imgExt, aff, (InterpolatorFactory) inter); } else if (3 == img.numDimensions()) {
aff_inv.set(props.at.createInverse()); } catch (final NoninvertibleTransformException nite) { Utils.log("ERROR: could not invert the affine transform for Patch " + patch); aff.set(new AffineTransform(1, 0, 0, 1, -box.x, -box.y)); tlist.add(aff); new_aff.set(patch.getAffineTransform()); tlist.add(new_aff);
a.set( at );
model.set( (float)m00, (float)m01, (float)m02, (float)m10, (float)m11, (float)m12 ); params.initialModel = model;
ctl.add( patch.getFullCoordinateTransform() ); final AffineModel2D affineScale = new AffineModel2D(); affineScale.set( scale, 0, 0, scale, -x * scale, -y * scale ); ctl.add( affineScale );