Use internal SNAPSHOT couplings again
[trakem2.git] / test / movingleastsquarestransform.js
blob65a2348a82f470faa8764823c22889af4ed66ca3
1 importClass( Packages.mpicbg.trakem2.transform.MovingLeastSquaresTransform );
3 IJ.log( ">>> Test mpicbg.trakem2.transform.MovingLeastSquaresTransform >>>" );
5 var l1 = new java.lang.reflect.Array.newInstance( java.lang.Float.TYPE, 2 );
6 l1[ 0 ] = 40;
7 l1[ 1 ] = 40;
9 var l2 = new java.lang.reflect.Array.newInstance( java.lang.Float.TYPE, 2 );
10 l2[ 0 ] = 300;
11 l2[ 1 ] = 200;
13 var l3 = new java.lang.reflect.Array.newInstance( java.lang.Float.TYPE, 2 );
14 l3[ 0 ] = 300;
15 l3[ 1 ] = 40;
17 var w1 = new java.lang.reflect.Array.newInstance( java.lang.Float.TYPE, 2 );
18 w1[ 0 ] = 80;
19 w1[ 1 ] = 80;
21 var w2 = new java.lang.reflect.Array.newInstance( java.lang.Float.TYPE, 2 );
22 w2[ 0 ] = 260;
23 w2[ 1 ] = 160;
25 var w3 = new java.lang.reflect.Array.newInstance( java.lang.Float.TYPE, 2 );
26 w3[ 0 ] = 240;
27 w3[ 1 ] = 80;
29 var dataString =
30 "rigid 1 " +
31 l1[ 0 ] + " " + l1[ 1 ] + " " +
32 w1[ 0 ] + " " + w1[ 1 ] + " " +
33 l2[ 0 ] + " " + l2[ 1 ] + " " +
34 w2[ 0 ] + " " + w2[ 1 ] + " " +
35 l3[ 0 ] + " " + l3[ 1 ] + " " +
36 w3[ 0 ] + " " + w3[ 1 ];
38 var m = new MovingLeastSquaresTransform();
39 m.init( dataString );
41 var l1p = m.apply( l1 );
42 var l2p = m.apply( l2 );
43 var l3p = m.apply( l3 );
45 if (
46 w1[ 0 ] == l1p[ 0 ] &&
47 w1[ 1 ] == l1p[ 1 ] &&
48 w2[ 0 ] == l2p[ 0 ] &&
49 w2[ 1 ] == l2p[ 1 ] &&
50 w3[ 0 ] == l3p[ 0 ] &&
51 w3[ 1 ] == l3p[ 1 ] )
52 IJ.log( " + transferring control points correctly passed" )
53 else
54 IJ.error( " - transferring control points correctly failed" )
56 IJ.log( "<<< Test mpicbg.trakem2.transform.MovingLeastSquaresTransform <<<" );
58 //IJ.run( "Clown (14K)" );