1 importClass( Packages.mpicbg.trakem2.transform.MovingLeastSquaresTransform );
2 importClass( Packages.mpicbg.trakem2.transform.TransformMesh );
3 importClass( Packages.mpicbg.trakem2.transform.TransformMeshMapping );
4 importClass( Packages.java.awt.Color );
6 IJ.log( ">>> Test mpicbg.trakem2.transform.TransformMeshMapping >>>" );
8 var m = new MovingLeastSquaresTransform();
9 m.init( "rigid 2 1 40 40 80 80 1 280 160 220 140 1 280 40 200 80 1" );
10 IJ.run( "Clown (14K)" );
11 var imp = IJ.getImage();
12 for ( var i = 1; i <= 4; ++i )
14 var n = Math.pow( 2, i );
16 var mesh = new TransformMesh( m, n, imp.getWidth(), imp.getHeight() );
17 var mapping = new TransformMeshMapping( mesh );
19 var ipMapping = mapping.createMappedImage( imp.getProcessor() );
20 var ipMappingInterpolated = mapping.createMappedImageInterpolated( imp.getProcessor() );
22 var impMapping = new ImagePlus( n + " mapping", ipMapping );
23 var impMappingInterpolated = new ImagePlus( n + " interpolated mapping", ipMappingInterpolated );
26 impMappingInterpolated.show();
27 impMapping.getCanvas().setDisplayList( mesh.illustrateMesh(), Color.white, null );
28 impMappingInterpolated.getCanvas().setDisplayList( mesh.illustrateMesh(), Color.white, null );
30 var ipMappingInverse = mapping.createInverseMappedImage( ipMapping );
31 var ipMappingInverseInterpolated = mapping.createInverseMappedImageInterpolated( ipMappingInterpolated );
33 var impMappingInverse = new ImagePlus( n + " inverse mapping", ipMappingInverse );
34 var impMappingInverseInterpolated = new ImagePlus( n + " interpolated inverse mapping", ipMappingInverseInterpolated );
35 impMappingInverse.show();
36 impMappingInverseInterpolated.show();
40 IJ.log( " + mapping passed" )
41 IJ.log( "<<< Test mpicbg.trakem2.transform.TransformMeshMapping <<<" );