News:

:) Remember, you need to be logged in to see posted attachments!

Main Menu

New Remote Server functions for imaging

Started by John Donovan, June 11, 2016, 08:39:30 AM

Previous topic - Next topic

John Donovan

Quote from: Dan R on March 06, 2025, 01:41:12 PMThanks John, so when we are collecting an image, our system is actually in 'analog scan' mode, so to modify your original VBA code above, we would need to:

' Remove faraday cup
Remote.RemoteFaraday 2

' CALL UNFREEZE
' SET DELAY AND WAIT


' Start the acquisition
Remote.RemoteImageStart

Once the image is acquired, we would set to deflect the beam and perform spot analyses:
Remote.RemoteImageSetBeamMode 2                          ' set to digital spot mode for JEOL 8200/8900/8500

and then we would start again in another location...

That should be fine, though I checked our code and see that we:

1. Set the beam conditions

2. Call Unfreeze

3. Remove Faraday

4. Acquire image
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Dan R

#16
Thanks so much John! The testRemoteImage.exe works great now so long as I:
1. Unblank Beam
2. Call Unfreeze
3. Wait ~5 sec
4. Collect image

No more weird partial scans!
-Dan

John Donovan

#17
Quote from: Dan R on March 07, 2025, 10:55:49 AMThanks so much John! The testRemoteImage.exe works great now so long as I:
1. Unblank Beam
2. Call Unfreeze
3. Wait ~5 sec
4. Collect image

No more weird partial scans!
-Dan

That's great to hear.  We also modified the TestRemoteImaging application code to show this "unfreeze" function call (see updated code in TestRemoteImaging.zip attached below):

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

' Remove faraday cup
Remote.RemoteFaraday 2

' Unfreeze JEOL 8230/8530 and iSP100/iHP200F video imaging if necessary (add additional delay if necessary)
If JEOLEOSInterfaceType& = 3 Then
Remote.RemoteImageUnfreeze
End If

' Start the acquisition
Remote.RemoteImageStart

Note in the TestRemoteImaging code above, there are two calls to Remote.RemoteImageSetBeamMode, but one of them is commented out.

This is because depending on the scan generator system, you will select either analog scan mode, or digital spot mode. See attached ZIP file for the complete code for this test app.

By the way, there is one caveat I should mention.  I was looking at the imaging code we use and noticed that the "unfreeze" call is made *before* the cup is removed and I was trying to understand why. Then I noticed a comment in our code, that in order to change the analog signal channel on these JEOL 8230/8530 instruments using EDS video imaging, say from SE to BSE, one must perform analog signal channel selection *after* unfreezing the JEOL video system.

So, in our code we set the beam conditions (Kev, etc.),  unfreeze, then set the signal channel, then all the other scan modes, etc.  Here's the code we use:

' Dimension byte array
If ImageIx% = 0 Or ImageIy% = 0 Then GoTo DigitizeImageStartZeroSize

' Get current positions
Call RealTimeGetAllPositions(Int(1))    ' update motors only
If ierror Then Exit Sub

' Starting acquisition, set conditions (if running automation)
If AcquisitionOnAutomate Then
Screen.MousePointer = vbHourglass
Call IOStatusAuto(vbNullString)
If imageconditionset = False Then
If DefaultColumnConditionMethod = 0 Then
Call IOStatusImage("Setting imaging kilovolts...")
Else
Call IOStatusImage("Setting imaging column condition...")
End If
DoEvents

' If using automated imaging, set conditions (store EDS variable and reset so EDS/Light condition is not changed)
itemp% = EDSThinWindowPresent
EDSThinWindowPresent = False
Screen.MousePointer = vbHourglass
If Not DigitizeImageSkipBeamModes Then      ' set true in procedure DigitizeImageAutomate
Call RealTimeSetConditions(DefaultTakeOff!, DefaultKiloVolts!, DefaultBeamCurrent!, DefaultBeamSize!, DefaultColumnConditionMethod%, DefaultColumnConditionString$)
End If
Screen.MousePointer = vbDefault
EDSThinWindowPresent = itemp%
If ierror Then Exit Sub

imageconditionset = True
End If
End If

' If JEOL 8230/8530 or iSP100/iHP200F always unfreeze before image acquisition (regardless of imaging interface type)
Call RealTimeUnfreeze       ' need to do this *before* setting image channel (RealTimeImageSetImageMode)
If ierror Then Exit Sub

' Make sure displayed mag is loaded
DefaultMagnificationImaging! = (FormIMAGE.TextMagnification.Text)        ' added 03-23-2016 in case UseDoNotSetConditionsFlag or DigitizeImageSkipBeamModes is set (Seward)

' If not skipping set beam mode or using automated imaging, set beam modes (see AutomateAcquireImageSetConditions for using digitized conditions)
If Not DigitizeImageSkipBeamModes Or (AcquisitionOnAutomate And Not UsePositionSampleMagKeVForAutomatedImaging) Then

' Set image mode (analog signal source)
Call RealTimeImageSetImageMode(ImageChannelNumber%)                      ' need to "unfreeze" JEOL 8230/8530 instrument first for video acquisition!!!
If ierror Then Exit Sub

' Set beam mode for analog signal imaging (need to set analog signal source *before* setting beam mode for JEOL, see RealTimeImageSetImageMode call above)
Call RealTimeImageSetBeamModeImaging
If ierror Then Exit Sub

' Set the mag to currently displayed (or position sample) magnification
Call IOStatusImage("Setting imaging magnification to " & Str$(DefaultMagnificationImaging!) & "...")
If DebugMode Then Call IOWriteLog("DigitizeImageStart: setting imaging magnification to " & Str$(DefaultMagnificationImaging!) & "...")
DoEvents
Call RealTimeSetMagnification(DefaultMagnificationImaging!)
If ierror Then Exit Sub

If DebugMode Then Call IOWriteLog("DigitizeImageStart: waiting " & Format$(AutomatedImageAcquisitionMagChangeMilliSecDelay&) & " msec after setting magnification...")
Call Sleep(AutomatedImageAcquisitionMagChangeMilliSecDelay&)

' Get the current beam size
Call RealTimeGetBeamSize(tbeamsize!)
If ierror Then Exit Sub

' Make sure beam is focussed (if using automated image acquisition or the beamsize is *not* zero)
If AcquisitionOnAutomate Or tbeamsize! <> 0# Then
Call IOStatusAuto("Setting zero beam size before image acquisition...")
Call RealTimeSetBeamSize(CSng(0#))        ' force beam size to zero
If ierror Then Exit Sub
End If

' Use current imaging magnification if not setting beam conditions or not using automated image acquisition
Else
DefaultMagnification! = DefaultMagnificationImaging!    ' need to set global for beam deflection calibration in RealTimeImageBeamDeflection()
End If

' Send scan rotation if present (get scan rotation based on current keV and mag)
If ScanRotationPresent Then
tfov! = RealTimeGetBeamScanCalibration!(XMotor%, DefaultKiloVolts!, DefaultMagnification!, DefaultScanRotation!)
If ierror Then Exit Sub
Call IOStatusImage("Setting scan rotation to " & Str$(DefaultScanRotation!) & "...")
DoEvents
Call RealTimeSetColumnParameters(Int(7), tCondenserCoarse&, tCondenserFine&, tObjectiveCoarse#, tObjectiveFine#, tAstigmation1&, tAstigmation2&, DefaultScanRotation!, tmagnification!)
If ierror Then Exit Sub
End If

' Remove faraday
Call RealTimeGetFaradayState    ' check faraday state
If ierror Then Exit Sub
If Not BeamOnFlag Then
Call RealTimeFaraday(Int(2))
If ierror Then Exit Sub
End If

' Clear Acquire beam deflection
Call AcquireUpdateSampleProgressUnLoad
If ierror Then Exit Sub

' Deal with optical lamp modes if automated image acquisition
If AcquisitionOnAutomate Then
If MiscIsInstrumentStage("CAMECA") Or (MiscIsInstrumentStage("JEOL") And JeolEOSInterfaceType& <> 2) Then       ' this sequence causes corruption of TCP/IP stack on JEOL 8900
Call IOStatusImage("Setting optical modes for automated electron imaging...")
If TransmittedLightPresent Then
If DebugMode Then Call IOStatusImage("Checking for light mode (reflected vs. transmitted)...")
Call RealTimeGetLightMode(mode%)                    ' check if in transmitted light mode
If ierror Then Exit Sub
If mode% = 1 Then
If DebugMode Then Call IOStatusImage("Setting light mode to reflected...")
Call RealTimeSetLightMode(Int(0))                   ' set to reflected light if in transmitted light
If ierror Then Exit Sub
End If
End If
If DebugMode Then Call IOStatusImage("Checking if reflected light is on...")
Call RealTimeGetReflectedLightMode(mode%)           ' check if reflected light is on
If ierror Then Exit Sub
If mode% = 1 Then                                   ' if reflected light is on, turn off
If DebugMode Then Call IOStatusImage("Turning reflected light is off...")
Call RealTimeSetReflectedLightMode(Int(0))
If ierror Then Exit Sub
If DebugMode Then Call IOStatusImage("Waiting for reflected light off...")
Call MiscDelay6(FormMAIN.StatusBarAuto, "reflected light off...", CDbl(1#), Now)      ' wait 1 second for light fully off (without DoEvents)
If ierror Then Exit Sub
End If
End If
End If

Call IOStatusAuto("Starting image acquisition...")
Call IOStatusImage("Starting image acquisition...")

' Start image acquisition
Call RealTimeImageStart
If ierror Then Exit Sub
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"