/*First choose set one fiducial point into each slice */ macro "Remove Overlay [1]"{ run("Remove Overlay"); } macro "Mark fiducial point Tool - C04fT1e12FCf00T8e12P" { roiManager("Associate", "true"); rad = 20; getCursorLoc(clickX, clickY, z, flags); makeRectangle(clickX - rad, clickY - rad, rad * 2, rad * 2); run("Gaussian Blur...", "sigma=10 slice"); run("Find Maxima...", "noise=10 output=[Point Selection] light"); run("Undo"); getSelectionCoordinates(xx, yy); makePoint(xx[0], yy[0]); run("Properties... ", " point=Crosshair color=red size=Large"); run("Add Selection..."); makeRectangle(clickX - rad, clickY - rad, rad * 2, rad * 2); } macro "Use Overlay to Translate [2]"{ run("To ROI Manager"); run("From ROI Manager"); nRois = roiManager("count"); if(nRois != nSlices) exit("nRois = " + nRois + " and nSlices = " nSlices); xx = newArray(nRois); yy = newArray(nRois); roiManager("select", 0); getSelectionCoordinates(xx1, yy1); for(jj = 1; jj< nRois; jj++){ roiManager("select", jj); getSelectionCoordinates(xx2, yy2); dx = xx1[0] - xx2[0]; dy = yy1[0] - yy2[0]; run("Select None"); run("Translate...", "x=&dx y=dy interpolation=Bilinear slice"); } }