Author Topic: New Remote Server functions for imaging  (Read 4601 times)

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3268
  • Other duties as assigned...
    • Probe Software
New Remote Server functions for imaging
« on: June 11, 2016, 08:39:30 AM »
The Remote Server app allows one to write their own scripts or macros for custom EPMA application development. Scripts can be written for any OLE (Active-X) container such as Excel, MatLab, LabView, etc.  See here for more information:

http://probesoftware.com/smf/index.php?topic=88.msg315#msg315

I have recently added several new functions to enable custom imaging app development as listed here:

Public Property Get RemoteInterfaceType() As Integer
Public Property Get RemoteImageInterfaceType() As Integer
Public Property Get RemoteJEOLEOSInterfaceType() As Long
Public Property Get RemoteImageInterfaceImageIxIy() As Single

Public Sub RemoteImageGetBeamMode(beammode As Integer)
Public Sub RemoteImageSetBeamMode(beammode As Integer)
Public Sub RemoteImageBeamDeflection2(xoffset As Single, yoffset As Single)
Public Sub RemoteImageGetImageShift(ix As Single, iy As Single)
Public Sub RemoteImageSetImageShift(ix As Single, iy As Single)
Public Sub RemoteSetReflectedLight(lightonoff As Integer, lightintensity As Integer)
Public Sub RemoteSetTransmittedLight(lightonoff As Integer, lightintensity As Integer)

See the Remote Server documentation for more details.
« Last Edit: June 11, 2016, 10:54:24 AM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3268
  • Other duties as assigned...
    • Probe Software
Re: New Remote Server functions for imaging
« Reply #1 on: October 29, 2016, 05:45:53 PM »
As an aid to developing your own custom imaging applications using the Probe for EPMA Remote Server interface, I have attached below a zip file with a very simple but powerful example of a Remote Server imaging application (remember to login to see attachments). This application and the Remote interface are of course free to all PFE customers. Please let us know if you have any questions on using this for your own custom applications.

To demonstrate how simple it is to develop a custom imaging application for your EPMA instrument, see the "get image" routine code inserted below which was written in VB6.  The complete VB6 project is in the attached zip file.

Code: [Select]
Sub TestRemoteImageGet()
' Get analog signal image

ierror = False
On Error GoTo TestRemoteImageGetError

' Send the image channel
Remote.RemoteImageSetImageMode ImageChannel%

Dim done%                               ' returned, true (-1) if image complete
Dim ntype As Integer                    ' passed (1 = analog signal, 2 = x-ray)

Dim sxmin As Single, symin As Single    ' returned (stage coordinates of corners)
Dim sxmax As Single, symax As Single  ' returned (stage ccordinates of corners)
Dim zmin As Long, zmax As Long          ' returned (intensity min/max)

ReDim iarray(1 To ImageIx%, 1 To ImageIy%) As Byte  ' returned (0-255 normalized intensity data)
ReDim darray(1 To ImageIx%, 1 To ImageIy%) As Long  ' returned (raw intensity data)

' Set beam mode to analog or digital spot (comment out other line)
'Remote.RemoteImageSetBeamMode 1                           ' set to analog scan mode for SX100 mapping or SX100 video or Bruker or Thermo imaging
Remote.RemoteImageSetBeamMode 2                           ' set to digital spot mode for JEOL 8200/8900/8500

' Remove faraday cup
Remote.RemoteFaraday 2

' Start the acquisition
Remote.RemoteImageStart

' Call image get in a loop until complete
Do Until done
Remote.RemoteImageGet done%, ntype%, ImageChannel%, AnalogAverages%, ImageIx%, ImageIy%, sxmin!, symin!, sxmax!, symax!, iarray(), darray&(), zmin&, zmax&

Sleep 100
DoEvents
If ierror Then Exit Do
Loop

' Convert long values to byte array
ReDim barray(1 To ImageIx%, 1 To ImageIy%) As Byte
Screen.MousePointer = vbHourglass
Call BMPConvertLongArrayToByteArray(ImageIx%, ImageIy%, darray&(), barray())
Screen.MousePointer = vbDefault
If ierror Then Exit Sub

' Display intensity data
Call TestRemoteImagingConvertImage(ImageIx%, ImageIy%, barray(), FormMAIN)
If ierror Then Exit Sub

msg$ = "Sxmin=" & Format$(sxmin!) & ", Sxmax=" & Format$(sxmax!) & vbCrLf
msg$ = msg$ & "Symin=" & Format$(symin!) & ", Symax=" & Format$(symax!)
FormMAIN.TextLog.Text = msg$

' Insert faraday cup
Remote.RemoteFaraday 1

' Set beam mode to analog scan mode
'Remote.RemoteImageSetBeamMode 1                           ' set to analog scan mode for SX100 mapping or SX100 video or Bruker or Thermo imaging

Exit Sub

' Errors
TestRemoteImageGetError:
MsgBox Error$, vbOKOnly + vbCritical, "TestRemoteImageGet"
ierror = True
Exit Sub

End Sub

Note that your custom code can be developed in any application development environment which supports the active-X interface. This also includes Excel, Matlab, LabView and many other environments that support OLE containers.
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"