var a,b,c,d: integer; macro '[1]square ROI'; var diff: integer; begin getROi(a,b,c,d); if c < d then begin diff := d - c; a := a - diff div 2; c := c + diff; end else begin diff := c - d; b := b - diff div 2; d := d + diff; end; makeRoi(a,b,c,d); end; macro '[2]scale to 512 and add scale bar'; var barlen: integer; begin makeRoi(a,b,c,d); SetScaling('Bilinear,New Window'); ScaleAndRotate(512/c,512/d,0); barlen := trunc(10/0.22*512/c); {one pixel is 0.22 microns} makeRoi(256,256,barlen, barlen/5); setbackgroundColor(0); end;