{ Alignment macros This is a set of macros for aligning pictures in a stack with manual assistance. First, one draws a line between two features on one slice, and defines this as the reference line (Refrence [R]). Then, one marks the same reference line on another slice and runs the MatchRef [M] macro, which will rotate, scale, and shift the image in order to match the original reference line. These macros were originally used for aligning camera lucida drawings of wholemounted brains to a standard size and orientation; they may prove more widely useful for rough alignment of images of serial sections. ====== Written by ====== Chi-Bin Chien, Dept. of Biology, UC San Diego Comments and bug reports to: chien@jeeves.ucsd.edu (I can't promise any support for these macros, but will do my best to respond.) Version 1.01, last modified 6/16/94 Requires Image version 1.53 } { ==== List of Macros ==== Add Slice [+] adds slice Delete Slice [-] deletes slice Goto [G] go to desired slice Double Slice [2] put an extra copy of this slice in the stack Reference [R] pick reference line StandardRef [R] use standard reference line MatchRef [M] sizes & rotates window so that selected line matches reference line. Marks magnification and rotation. Crop [C] crops the current stack to a new stack, deletes old stack. Enlarge [E] copy stack to a bigger stack, extra 50 pixels on each side Invert [I] inverts the window, or all slices in the stack Fill [F] fills the ROI in the window or all slices Last modified 1/19/94 } { global variables } var xref1,yref1,xref2,yref2:integer; { x and y for reference points 1 and 2 } refdx,refdy:integer; { vector from point 1 to point 2 } reflength,refangle:real; { distance and angle from point 1 to point 2 } macro 'Alignment Macros'; begin end; macro '(-'; begin end; macro 'Add Slice [+]'; begin AddSlice end; macro 'Delete Slice [-]'; begin DeleteSlice end; { Error and CheckForStack are utility routines. } { Error(s) issues the error message S and terminates the macro. } procedure Error(s:string); begin PutMessage(s); exit; end; procedure CheckForStack; begin if nSlices=0 then Error('This window is not a stack'); end; macro 'Goto [G]'; var s: integer; begin CheckForStack; s:=GetNumber('Slice to go to:', 1); SelectSlice(s); end; macro 'Double Slice [2]'; begin CheckForStack; SelectAll; Copy; AddSlice; Paste; end; macro 'Reference [R]'; var tmp:integer; begin GetLine(xref1,yref1,xref2,yref2,tmp); if (xref1<0) then Error('Select line between two reference points.'); if yref1