MACROS AND VISUAL BASIC
LSM 710 and LSM 780
Carl Zeiss
VBA PROGRAMMING FOR LSM
Systems
46 M60-1-0025
e
02/2010
Function GetAveragePixel(ScanDoc As DsRecordingDoc, ChannelName As String, mean As Double)
Dim line As Variant
Dim x As Long, xmax As Long
Dim y As Long, ymax As Long
Dim spl As Long
Dim bpp As Long
Dim Sum As Double
Dim Channel As Long
GetAverageScanLineParams = False
If (ChannelIndexFromChannelName(ChannelName, Channel) = False) Then
Exit Function
End If
'check for valid doc
If (ScanDoc Is Nothing) Then Exit Function
Sum = 0
xmax = ScanDoc.Recording.SamplesPerLine
ymax = ScanDoc.Recording.LinesPerFrame
For y = 0 To ymax - 1
line = ScanDoc.ScanLine(Channel, 0, 0, 0, spl, bpp)
For x = 0 To spl - 1
Sum = Sum + line(x)
Next x
Next y
mean = Sum / (xmax*ymax)
GetAverageScanLineParams = True
End Function