macro 'Export LUT [E]'; { Copies the current look-up table to the Area(Red), Mean(Green) and Perimeter/Length(blue) columns. Max Measurements must be set to 256 or greater. } var i:integer; v:real; begin RequiresVersion(1.45); SetCounter(256); SetOptions('Area,Mean, Perimeter'); for i:=0 to 255 do begin rArea[i+1]:=RedLut[i]; rMean[i+1]:=GreenLut[i]; rLength[i+1]:=BlueLut[i]; end; ShowResults; SetExport('Measurements'); Export('RGB LUT'); end; macro 'Invert LUT [I]'; var i:integer; begin for i:=1 to 254 do begin RedLUT[i]:=255-RedLut[i]; GreenLUT[i]:=255-GreenLut[i]; BlueLUT[i]:=255-BlueLut[i]; end; UpdateLUT; end; macro 'Log Tranform'; var i,v:integer; ln255:real; BEGIN RedLUT[255]:=0; GreenLUT[255]:=0; BlueLUT[255]:=0; ln255:=ln(255); for i:=1 to 255 DO begin v:=round(ln(i)*255.0/ln255); RedLUT[255-i]:=v; GreenLUT[255-i]:=v; BlueLUT[255-i]:=v; end; UpdateLUT; END. macro 'Gamma TranformÉ [G]'; var i,v:integer; n,mode,min,max:integer gamma,mean:real; begin gamma:=GetNumber('Gamma(0.1-3.0):',2); measure; GetResults(n,mean,mode,min,max); ShowMessage('min=',min:1,'\max=',max:1); for i:=1 to 254 DO begin if (i>min) and (i=NextStep then begin NextStep:=trunc(NextStep+StepSize); level:=level-delta; UpdateLUT; end; if level<0 then level:=0; RedLUT[i]:=level; GreenLUT[i]:=level; BlueLUT[i]:=level; end; end; macro 'Make Four Ramp LUT'; var i,entry:integer; BEGIN entry:=0; for i:=0 to 63 DO begin RedLUT[entry]:=255-i*4; GreenLUT[entry]:=255-i*4; BlueLUT[entry]:=255-i*4; entry:=entry+1; end; for i:=0 to 63 DO begin RedLUT[entry]:=255-i*4; GreenLUT[entry]:=0; BlueLUT[entry]:=0; entry:=entry+1; end; for i:=0 to 63 DO begin RedLUT[entry]:=0; GreenLUT[entry]:=255-i*4; BlueLUT[entry]:=0; entry:=entry+1; end; for i:=0 to 63 DO begin RedLUT[entry]:=0; GreenLUT[entry]:=0; BlueLUT[entry]:=255-i*4; entry:=entry+1; end; UpdateLUT; end. macro 'Set Pixels RedÉ'; var v1,v2,i:integer; begin v1:=GetNumber('Starting Pixel Value(1-254)',10); v2:=GetNumber('Ending Pixel Value(1-254)',10); if v2 63) do d := GetNumber('Amount of color',20); for i := d*2 to 127 do begin j := 255 - i; RedLUT[i] := j + d; GreenLUT[i] := j + d; BlueLUT[i] := j - d*2; RedLUT[j] := i - d*2; GreenLUT[j] := i + d; BlueLUT[j] := i + d; end; UpdateLUT; end; macro 'Color Merge Two Images'; { Merges a "red" image and a "green" image to create a composite color image. The macro does this by scaling both images to 0-15, multiplying the second by 16, creating a single 8-bit by ORing the two 4-bit images, and then generating a custom red and green LUT to display the composite image. } var i,w1,w2,h1,h2,merged:integer; begin SaveState; if nPics<>2 then begin PutMessage('This macro operates on exactly two images.'); exit; end; SelectPic(1); GetPicSize(w1,h1); SelectPic(2); GetPicSize(w2,h2); if (w1<>w2) or (h1<>h2) then begin PutMessage('The two images must have the same width and height.'); exit; end; SetNewSize(w1,h2); MakeNewWindow('Merged'); merged:=PicNumber; SelectPic(1); SelectAll; Copy; SelectPic(merged); Paste; SelectAll; MultiplyByConstant(1/16); ChangeValues(0,0,1); ChangeValues(16,16,15); SelectPic(2); SelectAll; Duplicate('Temp'); MultiplyByConstant(1/16); ChangeValues(16,16,15); MultiplyByConstant(16); ChangeValues(0,0,1); SelectAll; Copy; SelectPic(merged); Paste; DoOr; for i:=0 to 255 do begin RedLut[i]:=(i mod 16)*16; GreenLut[i]:=(i div 16)*16; BlueLut[i]:=0; end; UpdateLut; SelectPic(nPics); Dispose; {Temp} RestoreState; end;