@@ -237,6 +237,7 @@ public void run ( final String arg) {
237237 loadPath ="" ;
238238 loadFile ="None" ;
239239
240+ //@TODO show help with a help button, rather than a radio button.
240241 if (viewManual ){ //they just want to read the manual. Do so and quit.
241242 final MultiStackRegCredits dialog = new MultiStackRegCredits (IJ .getInstance ());
242243 GUI .center (dialog );
@@ -433,14 +434,14 @@ public int processDirectives(ImagePlus imp, boolean loadBool){
433434 };
434435 double [][] anchorPoints = null ;
435436 switch (transformation ) {
436- case AFFINE : {
437+ case TRANSLATION : { // AFFINE: { //should be three points, not one.
437438 anchorPoints = new double [1 ][3 ];
438439 anchorPoints [0 ][0 ] = (double )(width / 2 );
439440 anchorPoints [0 ][1 ] = (double )(height / 2 );
440441 anchorPoints [0 ][2 ] = 1.0 ;
441442 break ;
442443 }
443- case RIGID_BODY : {
444+ case RIGID_BODY : { //three points
444445 anchorPoints = new double [3 ][3 ];
445446 anchorPoints [0 ][0 ] = (double )(width / 2 );
446447 anchorPoints [0 ][1 ] = (double )(height / 2 );
@@ -453,7 +454,7 @@ public int processDirectives(ImagePlus imp, boolean loadBool){
453454 anchorPoints [2 ][2 ] = 1.0 ;
454455 break ;
455456 }
456- case SCALED_ROTATION : {
457+ case SCALED_ROTATION : { //two points
457458 anchorPoints = new double [2 ][3 ];
458459 anchorPoints [0 ][0 ] = (double )(width / 4 );
459460 anchorPoints [0 ][1 ] = (double )(height / 2 );
@@ -463,7 +464,7 @@ public int processDirectives(ImagePlus imp, boolean loadBool){
463464 anchorPoints [1 ][2 ] = 1.0 ;
464465 break ;
465466 }
466- case TRANSLATION : {
467+ case AFFINE : { // TRANSLATION: { //should be one point, not three.
467468 anchorPoints = new double [3 ][3 ];
468469 anchorPoints [0 ][0 ] = (double )(width / 2 );
469470 anchorPoints [0 ][1 ] = (double )(height / 4 );
@@ -1578,7 +1579,7 @@ private void QRdecomposition (
15781579} /* end QRdecomposition */
15791580
15801581/*------------------------------------------------------------------*/
1581- @ SuppressWarnings ({ "rawtypes" , "rawtypes" })
1582+ @ SuppressWarnings ({ })
15821583private ImagePlus registerSlice (
15831584 ImagePlus source ,
15841585 ImagePlus target ,
@@ -2351,10 +2352,16 @@ private ImagePlus registerSlice (
23512352 sourcePoints [0 ][i ] = 0.0 ;
23522353 sourcePoints [1 ][i ] = 0.0 ;
23532354 sourcePoints [2 ][i ] = 0.0 ;
2355+ IJ .log ("sourcePoints rows:" + Integer .toString (sourcePoints .length ));
2356+ IJ .log ("sourcePoints cols:" + Integer .toString (sourcePoints [0 ].length ));
2357+ IJ .log ("globalTransform rows:" + Integer .toString (globalTransform .length ));
2358+ IJ .log ("globalTransform cols:" + Integer .toString (globalTransform [0 ].length ));
2359+ IJ .log ("anchorPoints rows:" + Integer .toString (anchorPoints .length ));
2360+ IJ .log ("anchorPoints cols:" + Integer .toString (anchorPoints [0 ].length ));
23542361 for (int j = 0 ; (j < 3 ); j ++) {
23552362 sourcePoints [0 ][i ] += globalTransform [i ][j ]
23562363 * anchorPoints [0 ][j ];
2357- sourcePoints [1 ][i ] += globalTransform [i ][j ]
2364+ sourcePoints [1 ][i ] += globalTransform [i ][j ] //java.lang.ArrayIndexOutOfBoundsException: 1
23582365 * anchorPoints [1 ][j ];
23592366 sourcePoints [2 ][i ] += globalTransform [i ][j ]
23602367 * anchorPoints [2 ][j ];
@@ -2533,5 +2540,18 @@ public void setSavePath(String savePath) {
25332540 this .savePath = savePath ;
25342541}
25352542
2543+ public static void main (String [] args ) {
2544+ MultiStackReg_ msr = new MultiStackReg_ ();
2545+ ImagePlus srcimp = new ImagePlus ("/Users/miura/Dropbox/sampleImages/RegistrationExample/translation/MAX_reference.tif" );
2546+ ImagePlus tgtimp = new ImagePlus ("/Users/miura/Dropbox/sampleImages/RegistrationExample/translation/MAX_30-pixel-translation-along-x.tif" );
2547+ msr .setSrcImg (srcimp );
2548+ msr .setTgtImg (tgtimp );
2549+ msr .setSrcAction ("Use as Reference" );
2550+ msr .setTgtAction ("Align to First Stack" );
2551+ msr .setTransformation (0 );
2552+ msr .setSaveTransform (true );
2553+ msr .core ("" , "" );
2554+ }
2555+
25362556} /* end class StackReg_ */
25372557
0 commit comments