Created
September 17, 2015 08:43
-
-
Save mutterer/6c19cf27938c81256f64 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var xp = newArray(); | |
| var yp = newArray(); | |
| macro "tick marks Tool - C00cT0f16T" { | |
| if (roiManager('count')<1) exit("add at least one ROI the the roiManager"); | |
| roiManager("Show All"); | |
| getCursorLoc(x, y, z, flags); | |
| roiManager('select',0); | |
| run("Interpolate", "interval=1 adjust"); | |
| getSelectionCoordinates(xp, yp); | |
| roiManager('select',0); | |
| while (flags&16!=0) { | |
| Overlay.clear; | |
| getCursorLoc(x, y, z, flags); | |
| d=getWidth; | |
| for (i=0;i<xp.length;i++) { | |
| di = sqrt ((x-xp[i])*(x-xp[i])+(y-yp[i])*(y-yp[i])); | |
| if (di<d) { | |
| d=di; | |
| cp = i; | |
| } | |
| } | |
| Overlay.drawLine(x, y, xp[cp], yp[cp]); | |
| Overlay.show; | |
| wait(50); | |
| } | |
| makeLine(x, y, xp[cp], yp[cp]); | |
| roiManager('add'); | |
| roiManager('select',0); | |
| } | |
| macro "unfold line Action Tool - C00cT0f16U" { | |
| newImage("unfolded tick line", "8-bit white", xp.length+20, 32, 1); | |
| setForegroundColor(0,0,0); | |
| drawLine(10, 16, 10+xp.length, 16); | |
| for (i=0;i<xp.length;i++) { | |
| for (r=1;r<roiManager('count');r++) { | |
| roiManager('select',r); | |
| getLine(x1, y1, x2, y2, lineWidth); | |
| if (x2==xp[i]&&y2==yp[i]) drawLine(10+i, 16, 10+i, 10); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment