macro 'AutoTrack Quicktime'; var x,y,k,m,pid,h,w,a,b,e,t,q,offset,i,PicSize,HdrSize,width,height:integer; r:real; begin HdrSize:= 0; h:=GetNumber('Enter height.',240); w:=GetNumber('Enter width.',320); a:=GetNumber('Frames to Average.',2); b:=GetNumber('Acquisition Frequency.',1); r:=GetNumber('Enter Frame Capture Rate (fps)',12); width:= w; height:=h; PicSize:=width*height; offset:=HdrSize; SetImport('8-bit'); SetNewSize(width,height); MakeNewStack('AVGstack'); e:=0; offset:=e*PicSize; SetCustom(width,height,offset,a); Import(''); AverageSlices; SelectWindow('Average'); SelectAll; Copy; Dispose; Dispose; SelectWindow('AVGstack'); Paste; e:=e+b; for I:=1 to 20 do begin {Macro will terminate at eof} offset:=e*PicSize; SetCustom(width,height,offset,a); Import(''); AverageSlices; SelectWindow('Average'); SelectAll; Copy; Dispose; Dispose; SelectWindow('AVGstack'); AddSlice; Paste; e:=e+b; end; q:=GetNumber('Threshold 1-254)',170); for i:= 1 to nSlices do begin SelectSlice(i); invert; SubtractBackground('2D Rolling Ball(faster)',50); EnhanceContrast; ApplyLut; SetThreshold(q); MakeBinary; Erode; Erode; end; MakeNewWindow('TRACKSET'); NextWindow; m:=nSlices; k:=m-1; for i:= 2 to k do begin SelectSlice(i); SelectAll; Copy; NextWindow; Paste; SetOption; DoReplace; NextWindow; end; NextWindow; MultiplybyConstant(0.5); NextWindow; SelectSlice(1); SelectAll; Copy; NextWindow; Paste; Add; MultiplybyConstant(0.75); NextWindow; SelectSlice(m); SelectAll; Copy; NextWindow; Paste; Add; rMinor[1]:=1200*b/r; end; macro 'TrackLength Quicktime'; var a,b,i,:integer; TotalLength,c,d,e,f,t,s:real; begin SelectWindow('TRACKSET'); Duplicate('TRACKSET-labeled'); SelectWindow('TRACKSET-labeled'); SetThreshold(1); MakeBinary; SelectWindow('AvgStack'); SelectSlice(1); SelectAll; Copy; SelectWindow('TRACKSET-labeled'); Paste; Subtract; SetThreshold(254); MakeBinary; SetOptions('Area,Length'); IgnoreParticlesTouchingEdge(true); LabelParticles(true); SetMajorLabel('Speed u/s'); a:=GetNumber('Enter min size.',40); b:=GetNumber('Enter max size.',4000); t:=GetNumber('Enter time in sixtieth sec.',rMinor[1]); s:=GetNumber('pixels/unit?',4.15); SetScale(s,'µm'); SetParticleSize(a,b); AnalyzeParticles; for i:=1 to rCount do begin TotalLength:=0; c:=(rLength[i]*rLength[i])-(16*rArea[i]); e:=abs(c); d:=sqrt(e); TotalLength:=(rLength[i]+d)*15/t; rMajor[i]:=TotalLength; ShowResults; end; end; macro '(-' begin end; macro 'Average Quicktime Movie'; { Imports and averages an uncompressed (compression=None and 256 Grays) Quicktime movie with an arbitrary number slices. } var h,w,a,b,e,offset,i,PicSize,HdrSize,width,height:integer; r:real; begin HdrSize:= 0; h:=GetNumber('Enter height.',240); w:=GetNumber('Enter width.',320); a:=GetNumber('Frames to Average.',2); b:=GetNumber('Acquisition Frequency.',1); r:=GetNumber('Enter Frame Capture Rate (fps)',12); width:= w; height:=h; PicSize:=width*height; offset:=HdrSize; SetImport('8-bit'); SetNewSize(width,height); MakeNewStack('AVGstack'); e:=0; offset:=e*PicSize; SetCustom(width,height,offset,a); Import(''); AverageSlices; SelectWindow('Average'); SelectAll; Copy; Dispose; Dispose; SelectWindow('AVGstack'); Paste; e:=e+b; for I:=1 to 20 do begin {Macro will terminate at eof} offset:=e*PicSize; SetCustom(width,height,offset,a); Import(''); AverageSlices; SelectWindow('Average'); SelectAll; Copy; Dispose; Dispose; SelectWindow('AVGstack'); AddSlice; Paste; e:=e+b; end; rMinor[1]:=1200*b/r; end; macro 'InvertStack'; var i:integer; begin for i:= 1 to nSlices do begin SelectSlice(i); invert; end; end; macro 'SubtractBackground'; var i:integer; begin for i:= 1 to nSlices do begin SelectSlice(i); SubtractBackground('2D Rolling Ball(faster)',50); end; end; macro 'EnhanceContrastStack'; var i:integer; begin for i:= 1 to nSlices do begin SelectSlice(i); EnhanceContrast; ApplyLut; end; end; macro 'ThresholdStack'; var i:integer; t:integer; begin t:=GetNumber('Enter Threshold Value.',170); for i:= 1 to nSlices do begin SelectSlice(i); SetThreshold(t); MakeBinary; end; end; macro 'ErodeStack'; var i:integer; begin for i:= 1 to nSlices do begin SelectSlice(i); Erode; end; end; macro 'Track'; var i:integer; k:integer; m:integer; width:integer; height:integer; begin GetPicSize(width,height); SetNewSize(width,height); MakeNewWindow('TRACKSET'); NextWindow; m:=nSlices; k:=m-1; for i:= 2 to k do begin SelectSlice(i); SelectAll; Copy; NextWindow; Paste; SetOption; DoReplace; NextWindow; end; NextWindow; MultiplybyConstant(0.5); NextWindow; SelectSlice(1); SelectAll; Copy; NextWindow; Paste; Add; MultiplybyConstant(0.75); NextWindow; SelectSlice(m); SelectAll; Copy; NextWindow; Paste; Add; end; macro 'TrackLength Quicktime'; var a,b,i,:integer; TotalLength,c,d,e,f,t,s:real; begin SelectWindow('TRACKSET'); Duplicate('TRACKSET-labeled'); SelectWindow('TRACKSET-labeled'); SetThreshold(1); MakeBinary; SelectWindow('AvgStack'); SelectSlice(1); SelectAll; Copy; SelectWindow('TRACKSET-labeled'); Paste; Subtract; SetThreshold(254); MakeBinary; SetOptions('Area,Length'); IgnoreParticlesTouchingEdge(true); LabelParticles(true); SetMajorLabel('Speed u/s'); a:=GetNumber('Enter min size.',40); b:=GetNumber('Enter max size.',4000); t:=GetNumber('Enter time in sixtieth sec.',rMinor[1]); s:=GetNumber('pixels/unit?',4.15); SetScale(s,'µm'); SetParticleSize(a,b); AnalyzeParticles; for i:=1 to rCount do begin TotalLength:=0; c:=(rLength[i]*rLength[i])-(16*rArea[i]); e:=abs(c); d:=sqrt(e); TotalLength:=(rLength[i]+d)*15/t; rMajor[i]:=TotalLength; ShowResults; end; end; macro '(-' begin end; {FilamentLength measures the length of individual filaments.} macro 'FilamentLength'; var a,b,i:integer; TotalLength, c,d,e,s:real; begin SetThreshold(1); MakeBinary; SetOptions('Area,Length'); IgnoreParticlesTouchingEdge(true); LabelParticles(true); SetMajorLabel('FilamentLength'); a:=GetNumber('Enter min size.',40); b:=GetNumber('Enter max size.',4000); s:=GetNumber('pixels/unit?',4.15); SetScale(s,'µm'); SetParticleSize(a,b); AnalyzeParticles; for i:=1 to rCount do begin TotalLength:=0; c:=(rLength[i]*rLength[i])-(16*rArea[i]); e:=abs(c); d:=sqrt(e); TotalLength:=(rLength[i]+d)/4; rMajor[i]:=TotalLength; ShowResults; end; end;