{Macros for 0n-chip integration with Xybion CCD-50 Camera using NIH-Image1.55Xybion, an LG-3 Frame grabber, and a cable connecting pin 4 of the 15 pin D-shell LG-3 connector to the image inhibit control of the Xybion control box.} Var NofFrames, Q:integer; procedure GetNofFrames; begin NofFrames:=GetNumber('Frames to Average :',16); end; procedure Integration; begin Averageframes('camera', NofFrames); end; Macro 'GetNofFrames[o]'; begin GetNofFrames; end; Macro 'Integrate[i]'; begin if NofFrames= 0 then GetNofFrames; integration; end; Macro 'Continuous Integration[0]'; begin repeat if NofFrames= 0 then GetNofFrames; integration; until button; end; procedure DateAndTime; var year,month,day,hour,min,sec,DoW:integer; l,t,w,h:integer; begin SelectAll; GetRoi(l,t,w,h); GetTime(year,month,day,hour,min,sec,DoW); SetForegroundColor(0); SetFont('Helvetica'); SetFontSize(12); MoveTo(w-50,h-40); Write(month:2,'/',day:2,'/',year-1900); MoveTo(w-50,h-30); Write(hour:2,':'); if (min <10) then Write('0',min:1,':') else Write(min:2,':'); if (sec<10) then Write('0',sec:1) else Write(sec:2); end; macro 'DateAndTime[1]'; begin DateAndTime; end; macro 'Time Lapse to Stack[u]'; { Captures images at a specified rate and saves them to a Stack. Select an area of interest within the Camera window before starting. Abort at any time by pressing the mouse button. } var nFrames,n,Left,Top,Width,Height:integer; interval,EndTicks,secs,CamIntegration,pid1:integer; FirstTime:boolean; begin GetRoi(Left,Top,Width,Height); if width=0 then begin PutMessage('First select the area of interest in the Camera window.'); exit; end; nFrames:=GetNumber('Number of Images?',10); secs:=GetNumber ('Delay Between Images (seconds)?',60.0); CamIntegration:=GetNumber('Camera IntegrationTime (Sec)',0); If (secs*30)< CamIntegration then begin Putmessage('Integration time longer than interval!'); Exit; End; interval:=round(secs*60); FirstTime:=true; SetNewSize(width,height); MakeNewStack('Temp'); Pid1:=Pidnumber; for n:=1 to nFrames do begin StopCapturing; If CamIntegration> 0 then begin startcapturing; AverageFrames('camera',CamIntegration); end; SelectWindow('camera'); makeRoi(Left,Top,Width,Height); Copy; ChoosePic(pid1); if not firsttime then addslice; Paste; killroi; if FirstTime then begin EndTicks:=TickCount+interval; FirstTime:=false; end; if button then begin StopCapturing; exit; end; StartCapturing; while TickCount 0 then AverageFrames('camera',CamIntegration); while TickCount 0 then selectall; if NofFrames> 0 then integration; killroi; MakeLineRoi(x1,y1,x2,y2); PlotProfile; until button; end; Macro 'Dynamic Histogram[h]'; begin repeat; if NofFrames= 0 then capture; If NofFrames> 0 then selectall; if NofFrames> 0 then integration; ShowHistogram; until button; end; macro 'Dynamic 1-D Plot Stack[L]'; var pid1,x1,y1,x2,y2,LineWidth:integer; FirstTime:boolean; begin GetLine(x1,y1,x2,y2,LineWidth); if x1=-1 then begin PutMessage('Create a straight line selection in the Camera window'); exit; end; SetPlotScale(0,255); SetPlotSize(300,150); FirstTime:=true; repeat if NofFrames= 0 then capture; If NofFrames> 0 then selectall; if NofFrames> 0 then integration; if button then exit; MakeLineRoi(x1,y1,x2,y2); PlotProfile; Copy; Dispose; if firsttime then begin; SetNewSize(375,200); MakeNewStack('Temp'); pid1:=pidnumber; end; choosepic(pid1); if not firsttime then addslice; paste; killroi; firsttime:=false; SelectWindow('camera'); until button; SelectPic(pid1); end;