Author Topic: An Improved Method for Beam Scan to Stage Calibration  (Read 16010 times)

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3275
  • Other duties as assigned...
    • Probe Software
An Improved Method for Beam Scan to Stage Calibration
« on: December 07, 2014, 05:30:10 PM »
I think I have come up with a method that will make it much easier to calibrate our beam scan image acquisitions for X, Y and rotation. These calibrations need to be referenced to the keV and magnification that the beam scan image was acquired with, and a stage scan of a corresponding area, to allow the user to find three points on both the stage scan and beam scan images for the calibration calculation.  All graphically!

As you may know, currently one has to manually calculate the X and Y micron extents of a beam scan image along with the scan rotation from zero degrees (assuming that one is referencing the scan rotation from the instrument default scan rotation, as opposed to resetting the scan rotation to zero each time, based on the beam scan image orthogonality by using a VERI ROTA or similar command).

Now, by simply utilizing a stage scan image along with a corresponding beam scan image and selecting three related points on each image, the CalcImage program will automatically calculate the X and Y extents of the image along with the image rotation (if desired) automatically, and save the results either to the Probewin.ini [image] calibration section and/or to a 3 or 2 point ACQ image calibration file for the beam scan image.



The program will write the fiducial rotation and translation matrices to the CalcImage log window, when the Calculate/Output Beam Image Calibration button is clicked as seen here:

Old Fiducial Coordinates:
 1  13444.7 9110.65 .000000
 2  20831.9 5811.12 .000000
 3  17286.1 15168.0 .000000

New Fiducial Coordinates:
 1  12287.3 25844.8 .000000
 2  12864.5 25550.5 .000000
 3  12591.5 26364.8 .000000

Fiducial Rotation Matrix:
 7.84e-02 -1.17e-03  0.00e+00
 5.13e-04  8.66e-02  0.00e+00
 0.00e+00  0.00e+00  6.79e-03

Fiducial Translation Matrix:
 1.12e+04  2.51e+04  0.00e+00

The "old" fiducials are in image coordinates and the "new" fiducials are in stage coordinates (Cameca microns here), allowing us to calculate the stage coordinates for any pixel in the beam scan image. The "corners" of the beam scan image are also calculated and the actual "rotated" (if any scan rotation is present), width and height of the beam scan image is calculated and output to the log window also:

Beam scan image, 1st corner (30780, 23100: 13653.02, 27035.81
Beam scan image, 2nd corner (0, 0: 11229, 25071.65
Beam scan image, 3rd corner (0, 23100: 11240.85, 27071.81
Beam scan image, rotated width and height: 2412.433, 2000.482

Next we see a screenshot of stage scan and beam scan images calibrated using this method. Note that the mouse cursor in the stage scan image displays the stage coordinates in the circled field.



To test the calculation, the Test button allows the user to select a point on the beam scan image corresponding to a stage image position, e.g., the stage cursor position in the previous screenshot. The correct stage coordinates for the selected beam scan image are correctly calculated as seen here:



And this calculation is also output to the CalcImage log window:

Stage coordinate for selected beam scan image position is X = 12735.18 and Y = 25867.96

At the moment, I haven't implemented the scan rotation calculation (because the math is hurting my head, so I probably need to bring in a math person), so that is why the Do Not Update Rotation checkbox is checked and disabled.  I'll probably get to that a little later.

In the meantime I've tested this for both Cameca and JEOL coordinate systems though it is a first cut. So if you have any stage/beam scan image pairs around, please try it out.  Remember, you *must* know the keV and magnification the beam scan image was acquired with, for this to work properly as a beam scan calibration for the [image] section of your Probewin.ini file.  But it will work regardless if only used for calibrating the beam scan image extents which are output to the CalcImage log window if the Output To .ACQ calibration File option as selected.

Edit by John: the sharp eyed observer will note that the test coordinates in the two images above are not exactly the same.  The stage cursor position in the top image is 12740, 25987 while the test point coordinates from the beam scan image are 12735, 25867.  Clearly the X position is reasonably close but the Y position is off. It turns out there was a bug in the stage image cursor code for the Y axis, which has been fixed, so the current version will do better on the Y coordinate!
« Last Edit: December 22, 2014, 11:28:14 AM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3275
  • Other duties as assigned...
    • Probe Software
Re: An Improved Method for Beam Scan to Stage Calibration
« Reply #1 on: December 11, 2014, 01:29:21 PM »
New addition to the Calibrate Beam Scan window: one can now also load the beam scan image directly from a Probe Image .PrbImg file as seen here:



But until we implement the magnification field in PrbImg files (coming in the next version of Probe Image), you should make a note of the magnification for any beam scans acquired in Probe Image if you would like to utilize that image for beam scan calibrations in CalcImage. Right now Probe Image only records the stage extents for both stage and beam scans.

I should mention that with this new automatic beam scan calibration one can calibrate not only the image parameters for Probe for EPMA's probewin.ini file, but also the beam scan calibration in Probe Image and even the beam scan calibrations in the Thermo and Bruker EDS softwares.
« Last Edit: December 11, 2014, 04:44:29 PM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3275
  • Other duties as assigned...
    • Probe Software
Re: An Improved Method for Beam Scan to Stage Calibration
« Reply #2 on: March 24, 2015, 04:31:26 PM »
Ok, so the new image rotation math code seems to be working so you can calibrate your beam scan images for X, Y and now rotation.

But I had a moment of doubt because when I first ran the calculation on the set of images seen here (stage scan on the left and beam scan on the right rotated, and according to the instrument, roughly 10 degrees rotation), but I got a result of about 350 degrees:



And I thought, heck, I got the rotation exactly opposite.  But then I looked again at the beam scan image and it sure looks like around 350 degrees to me because the vertical lines are rotated counter-clockwise slightly. 

Then I realized, Cameca displays their scan rotation in degrees counter-clockwise(!), so the beam scan is actually rotated around 10 degrees!   Doh!   So I added a reciprocal from 360 statement  to make it agree with Cameca convention (it's always something!).

You'll be able to test this tomorrow for yourselves, but before I implement this in CalcImage I sure would like to hear from a JEOL operator if their scan rotation convention is similar or opposite to Cameca's!
« Last Edit: March 24, 2015, 10:36:04 PM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Anette von der Handt

  • Global Moderator
  • Professor
  • *****
  • Posts: 351
    • UMN Probelab
Re: An Improved Method for Beam Scan to Stage Calibration
« Reply #3 on: March 25, 2015, 07:29:26 PM »
JEOL 8900 with scan rotation reporting back. I just tested it and the scan rotation is also applied counter-clockwise just as described by you for the Cameca.
Against the dark, a tall white fountain played.

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3275
  • Other duties as assigned...
    • Probe Software
Re: An Improved Method for Beam Scan to Stage Calibration
« Reply #4 on: March 25, 2015, 08:04:03 PM »
JEOL 8900 with scan rotation reporting back. I just tested it and the scan rotation is also applied counter-clockwise just as described by you for the Cameca.

Interesting- it must be an engineering perspective!

I will adjust the code.
« Last Edit: March 25, 2015, 08:07:33 PM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Probeman

  • Emeritus
  • *****
  • Posts: 2836
  • Never sleeps...
    • John Donovan
Re: An Improved Method for Beam Scan to Stage Calibration
« Reply #5 on: March 31, 2015, 02:28:04 PM »
Note that in order to avoid having the instrument set the scan rotation during an image acquisition for beam calibration purposes, be sure to check this box in the Imaging or Digitize Image windows:



This does not apply to the JEOL 8900 as there is no computer control for scan rotation in that instrument.
« Last Edit: April 13, 2015, 10:00:49 AM by Probeman »
The only stupid question is the one not asked!

Probeman

  • Emeritus
  • *****
  • Posts: 2836
  • Never sleeps...
    • John Donovan
Re: An Improved Method for Beam Scan to Stage Calibration
« Reply #6 on: September 01, 2015, 01:49:48 PM »
Ok, that was interesting!   Paul Carpenter was right- there was a silly bit of code in the multi-point beam scan calibration.  Once I got that fixed...

So I spent an hour or so acquiring two stage scan BSE images and several beam scan images in order to test the new three point beam scan calibration code in CalcImage and it appears to work very well. Here's the procedure I used:

1. I acquired a 512 x 512 um stage scan and a 256 x 256 um stage scan (for better accuracy for high mag calibrations) centered on an area
in Probe Image (you'll want to have some dirt or debris in the field of view for use as fiducial reference points!).  These are the "reference" images because we assume our instrument stage is orthogonal!

2. Then I acquired a number of beam scan images in PFE without scan rotation. For this simply set the scan rotation on your instrument to zero and then check this box here to *not* send scan rotation commands to the instrument as described in the post above:

http://probesoftware.com/smf/index.php?topic=396.msg2505#msg2505

3. I acquired a range of mags from low mag 334x (one could go lower), to a fairly high mag 1335x (one could go higher).  Be sure to name the images with the mag you acquired them with so you won't get mixed up. CalcImage will read the mag and scan rotation in the .acq (or PrbImg) files, but it helps to have the mags in the file name on disk.

4. Then I loaded one of the stage scan images and one of the beam scan images into the Processing | Calibrate Beam Scan From Stage Scan menu window in CalcImage. Note that the left image is always the stage scan and the right window is always the beam scan.  Then using the Fiducial buttons, specify three reference points in both images that coincide exactly and then press the Calibrate button.

Just to see that the code all works in any order, I then mulched the calibrations around in the Probewin.ini file so I had both increasing and decreasing order and also a random mix as seen here:

; Single calibration
;ImageInterfaceCalNumberOfBeamCalibrations=1
;ImageInterfaceCalKeV="15.0"                        ; image calibration keV
;ImageInterfaceCalMag="400.0"                       ; image calibration mag
;ImageInterfaceCalXMicrons="943"                    ; SX100 Video X calibration in um (01-18-2011)
;ImageInterfaceCalYMicrons="714"                    ; SX100 Video Y calibration in um (01-18-2011)
;ImageInterfaceCalScanRotation="9.0"                ; SX100 scan rotation calibration

; Multiple calibration (increasing mag)
ImageInterfaceCalNumberOfBeamCalibrations="5"
ImageInterfaceCalKeV="15,15,15,15,15"
ImageInterfaceCalMag="334,405,571,758,1335"
ImageInterfaceCalXMicrons="1118.2,926.9,659.7,498.7,282."
ImageInterfaceCalYMicrons="848.4,705.2,504.1,376.3,207.0"
ImageInterfaceCalScanRotation="8.7,8.8,8.9,9.1,9.3"

; Multiple calibration (decreasing mag)
;ImageInterfaceCalNumberOfBeamCalibrations="5"
;ImageInterfaceCalKeV="15,15,15,15,15"
;ImageInterfaceCalMag="1335,758,571,405,334"
;ImageInterfaceCalXMicrons="282.5,498.7,659.7,926.9,1118.2"
;ImageInterfaceCalYMicrons="207.0,376.3,504.1,705.2,848.4"
;ImageInterfaceCalScanRotation="9.3,9.1,8.9,8.8,8.7"

; Multiple calibration (random mag)
;ImageInterfaceCalNumberOfBeamCalibrations="5"
;ImageInterfaceCalKeV="15,15,15,15,15"
;ImageInterfaceCalMag="571,334,405,758,1335"
;ImageInterfaceCalXMicrons="659.7,1118.2,926.9,498.7,282.5"
;ImageInterfaceCalYMicrons="504.1,848.4,705.2,376.3,207.0"
;ImageInterfaceCalScanRotation="8.9,8.7,8.8,9.1,9.3"

Note that the semi-colon indicates a comment, so these lines are ignored by the software. It all seems to work great!  Use the DebugMode menu to see the gritty details of the calibration calculations.  Thanks to Paul Carpenter for testing this.  I updated the code in both v. 10.9.9 and 11.0.3.
john
« Last Edit: September 01, 2015, 02:17:42 PM by Probeman »
The only stupid question is the one not asked!

Probeman

  • Emeritus
  • *****
  • Posts: 2836
  • Never sleeps...
    • John Donovan
Re: An Improved Method for Beam Scan to Stage Calibration
« Reply #7 on: February 13, 2016, 10:47:39 AM »
The CalcImage | Calibrate Beam Scan menu window now has a plot window for checking your beam scan calibrations as seen here:



These mag/FOV values were calibrated using images from my Sx100 using the three point fiducial method in CalcImage that references a stage scan and multiple beam scan images to accurately calibrate beam scans for x, y and scan rotation at different magnifications, as described in the posts above.
« Last Edit: April 14, 2020, 12:35:27 PM by John Donovan »
The only stupid question is the one not asked!

Ben Buse

  • Professor
  • ****
  • Posts: 488
Re: An Improved Method for Beam Scan to Stage Calibration
« Reply #8 on: September 15, 2016, 05:24:29 AM »
Hi John,

Using multiple magnifications looks really good. I've just recorded them for 20kV into probeimage. Does the program then do a fit to the multiple magnification data to determine the FOV at any magnification.

Also presumably you can load the data for each kV, I've done it for 20kV and can now add it for the other kV. Do you find it changes much for kV's.
« Last Edit: September 15, 2016, 08:36:50 AM by John Donovan »

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3275
  • Other duties as assigned...
    • Probe Software
Re: An Improved Method for Beam Scan to Stage Calibration
« Reply #9 on: September 15, 2016, 08:36:35 AM »
Using multiple magnifications looks really good. I've just recorded them for 20kV into probeimage. Does the program then do a fit to the multiple magnification data to determine the FOV at any magnification.

Hi Ben,
Yes, it does an interpolation between the two "nearest neighbor" calibrations that match the current keV.  Assuming their are calibrations on each side of the specified magnification.  If not, it does a simple division to find the calibration for the specified mag.

By the way, here is the code I'm using for the beam scan calibration interpolation in PFE (Brian is doing something very similar for PI):

Code: [Select]
Function RealTimeGetBeamScanCalibration(XorYMotor As Integer, keV As Single, mag As Single, srota As Single) As Single
' Returns the beam scan calibration in microns (and scan rotation) for the specified keV and mag
' XorYMotor = XMotor% or YMotor%

ierror = False
On Error GoTo RealTimeGetBeamScanCalibrationError

Dim i As Integer
Dim tfov As Single

Dim norder As Integer
Dim npts As Integer

ReDim acoeff(1 To MAXCOEFF%) As Single

ReDim txdata(1 To MAXBEAMCALIBRATIONS%) As Single
ReDim tydata(1 To MAXBEAMCALIBRATIONS%) As Single
ReDim tsdata(1 To MAXBEAMCALIBRATIONS%) As Single

Dim txdata2(1 To 2) As Single   ' magnification data
Dim tydata2(1 To 2) As Single   ' X or Y micron data
Dim tsdata2(1 To 2) As Single   ' scan rotation data

Static old_mag As Single

' Check for valid number of beam scan calibrations
If ImageInterfaceCalNumberOfBeamCalibrations% < 1 Then GoTo RealTimeGetBeamScanCalibrationBadNumberOfCalibrations
If ImageInterfaceCalNumberOfBeamCalibrations% > MAXBEAMCALIBRATIONS% Then GoTo RealTimeGetBeamScanCalibrationBadNumberOfCalibrations

' Check for valid X or Y motor
If XorYMotor% <> XMotor% And XorYMotor% <> YMotor% Then GoTo RealTimeGetBeamScanCalibrationBadXorYMotor

' Check for zero mag
If mag! = 0# Then GoTo RealTimeGetBeamScanCalibrationZeroMag

' Check if only one beam scan calibration
If ImageInterfaceCalNumberOfBeamCalibrations% = 1 Then
If XorYMotor% = XMotor% Then tfov! = ImageInterfaceCalXMicronsArray!(1) * ImageInterfaceCalMagArray!(1) / mag!
If XorYMotor% = YMotor% Then tfov! = ImageInterfaceCalYMicronsArray!(1) * ImageInterfaceCalMagArray!(1) / mag!
srota! = DefaultScanRotation!  ' load global as default
RealTimeGetBeamScanCalibration! = tfov!
If VerboseMode And mag! <> old_mag! Then
msg$ = "Beam scan calibration (single), passed mag= " & Format$(mag!) & ", microns= " & Format$(tfov!) & ", rota= " & Format$(srota!)
Call IOWriteLog(msg$)
End If
old_mag! = mag!
Exit Function
End If

' Check for more than one beam scan calibration (might need to do least squares fit for interpolation)
If ImageInterfaceCalNumberOfBeamCalibrations% > 1 Then

' Load values based on number of matching keV values
npts% = 0
For i% = 1 To ImageInterfaceCalNumberOfBeamCalibrations%
If keV! = ImageInterfaceCalKeVArray!(i%) Then
npts% = npts% + 1
ReDim Preserve txdata(1 To npts%) As Single     ' magnification data
ReDim Preserve tydata(1 To npts%) As Single     ' X or Y micron data
txdata!(npts%) = ImageInterfaceCalMagArray!(i%)
If XorYMotor% = XMotor% Then tydata!(npts%) = ImageInterfaceCalXMicronsArray!(i%)
If XorYMotor% = YMotor% Then tydata!(npts%) = ImageInterfaceCalYMicronsArray!(i%)
tsdata!(npts%) = ImageInterfaceCalScanRotationArray!(i%)
End If
Next i%

' Check for no matching calibrations (use default)
If npts% = 0 Then
If XorYMotor% = XMotor% Then tfov! = ImageInterfaceCalXMicronsArray!(1) * ImageInterfaceCalMagArray!(1) / mag!
If XorYMotor% = YMotor% Then tfov! = ImageInterfaceCalYMicronsArray!(1) * ImageInterfaceCalMagArray!(1) / mag!
srota! = DefaultScanRotation!  ' load global as default
RealTimeGetBeamScanCalibration! = tfov!
If VerboseMode And mag! <> old_mag! Then
msg$ = "Beam scan calibration (default), passed mag= " & Format$(mag!) & ", microns= " & Format$(tfov!) & ", rota= " & Format$(srota!)
Call IOWriteLog(msg$)
End If
old_mag! = mag!
Exit Function

' Check for one calibration (use one matching the current keV)
ElseIf npts% = 1 Then
tfov! = tydata!(1) * txdata!(1) / mag!
srota! = tsdata!(1)
RealTimeGetBeamScanCalibration! = tfov!
If VerboseMode And mag! <> old_mag! Then
msg$ = "Beam scan calibration (single keV match), passed mag= " & Format$(mag!) & ", microns= " & Format$(tfov!) & ", rota= " & Format$(srota!)
Call IOWriteLog(msg$)
End If
old_mag! = mag!
Exit Function

' Check for more than one calibration (only load closest two for linear interpolations of micron and scan rotation data)
Else
If VerboseMode And mag! <> old_mag! Then
msg$ = vbCrLf & "Number of beam scan calibrations that match passed keV (" & Format$(keV!) & "), stored in PROBEWIN.INI = " & Format$(npts%)
Call IOWriteLog(msg$)
End If

' Load mag into temp variables for fit (we only want to use the two calibrations on each side of the specified mag)
txdata2!(1) = MAXMINIMUM!
txdata2!(2) = MAXMAXIMUM!
For i% = 1 To npts%
If VerboseMode And mag! <> old_mag! Then
If XorYMotor% = XMotor% Then msg$ = "Matching X beam scan calibration " & Format$(i%) & ", mag()= " & Format$(txdata!(i%)) & ", micron()= " & Format$(tydata!(i%)) & ", rota()= " & Format$(tsdata!(i%))
If XorYMotor% = YMotor% Then msg$ = "Matching Y beam scan calibration " & Format$(i%) & ", mag()= " & Format$(txdata!(i%)) & ", micron()= " & Format$(tydata!(i%)) & ", rota()= " & Format$(tsdata!(i%))
Call IOWriteLog(msg$)
End If

If txdata!(i%) < txdata2!(1) And txdata!(i%) >= mag! Then    ' smallest value that is greater than the specified mag
txdata2!(1) = txdata!(i%)
tydata2!(1) = tydata!(i%)
tsdata2!(1) = tsdata!(i%)
End If
If txdata!(i%) > txdata2!(2) And txdata!(i%) <= mag! Then    ' largest value that is smaller than the specified mag
txdata2!(2) = txdata!(i%)
tydata2!(2) = tydata!(i%)
tsdata2!(2) = tsdata!(i%)
End If
Next i%

' Check if extrapolating on high side and if so, just use first parameter that matches the keV (tydata loaded for X or Y micron calibrations)
If txdata2!(1) = MAXMINIMUM! Or txdata2!(1) = MAXMINIMUM! Then
tfov! = tydata2!(2) * txdata2!(2) / mag!
srota! = tsdata2!(2)
If VerboseMode And mag! <> old_mag! Then
msg$ = "Extrapolating from high side, passed mag= " & Format$(mag!) & ", Extrapolated: ROTA= " & Format$(srota!) & ", FOV= " & Format$(tfov!)
Call IOWriteLog(msg$)
End If
RealTimeGetBeamScanCalibration! = tfov!
old_mag! = mag!
Exit Function
End If
End If

' Check if extrapolating on low side and if so, just use first parameter that matches the keV (tydata loaded for X or Y micron calibrations)
If txdata2!(2) = MAXMINIMUM! Or txdata2!(2) = MAXMAXIMUM! Then
tfov! = tydata2!(1) * txdata2!(1) / mag!
srota! = tsdata2!(1)
If VerboseMode And mag! <> old_mag! Then
msg$ = "Extrapolating from low side, passed mag= " & Format$(mag!) & ", Extrapolated: ROTA= " & Format$(srota!) & ", FOV= " & Format$(tfov!)
Call IOWriteLog(msg$)
End If
RealTimeGetBeamScanCalibration! = tfov!
old_mag! = mag!
Exit Function
End If
End If

' Convert to log-log fit
txdata2!(1) = Log(txdata2!(1))    ' mag
txdata2!(2) = Log(txdata2!(2))    ' mag

tydata2!(1) = Log(tydata2!(1))    ' microns
tydata2!(2) = Log(tydata2!(2))    ' microns

' Do fit of X or Y microns as a function of magnification if interpolating
norder% = 1
Call LeastSquares(norder%, Int(2), txdata2!(), tydata2!(), acoeff!())
If ierror Then Exit Function

' Calculate X or Y scan size for this mag
tfov! = acoeff!(1) + acoeff!(2) * Log(mag!)

' Take exponent of
tfov! = NATURALE# ^ tfov!

' Convert from log-log fit
txdata2!(1) = NATURALE# ^ txdata2!(1)   ' mag
txdata2!(2) = NATURALE# ^ txdata2!(2)   ' mag

tydata2!(1) = NATURALE# ^ tydata2!(1)   ' microns
tydata2!(2) = NATURALE# ^ tydata2!(2)   ' microns

' Do fit of scan rotation as a function of magnification
norder% = 1
Call LeastSquares(norder%, Int(2), txdata2!(), tsdata2!(), acoeff!())
If ierror Then Exit Function

' Calculate scan rotation for this mag
srota! = acoeff!(1) + acoeff!(2) * mag!

If VerboseMode And mag! <> old_mag! Then
msg$ = "High side matching beam scan calibration, passed mag= " & Format$(mag!) & ", mag()= " & Format$(txdata2!(1)) & ", micron()= " & Format$(tydata2!(1)) & ", rota()= " & Format$(tsdata2!(1))
Call IOWriteLog(msg$)
msg$ = "Low side matching beam scan calibration, passed mag= " & Format$(mag!) & ", mag()= " & Format$(txdata2!(2)) & ", micron()= " & Format$(tydata2!(2)) & ", rota()= " & Format$(tsdata2!(2))
Call IOWriteLog(msg$)
msg$ = "Linear fit to beam scan calibrations, ROTA= " & Format$(srota!) & ", FOV= " & Format$(tfov!)
Call IOWriteLog(msg$)
End If

RealTimeGetBeamScanCalibration! = tfov!
old_mag! = mag!
Exit Function

' Errors
RealTimeGetBeamScanCalibrationError:
MsgBox Error$, vbOKOnly + vbCritical, "RealTimeGetBeamScanCalibration"
ierror = True
Exit Function

RealTimeGetBeamScanCalibrationBadNumberOfCalibrations:
msg$ = "Invalid number of beam scan calibrations (this error should not occur, please contact Probe Software technical support with details)."
MsgBox msg$, vbOKOnly + vbExclamation, "RealTimeGetBeamScanCalibration"
ierror = True
Exit Function

RealTimeGetBeamScanCalibrationBadXorYMotor:
msg$ = "Motor " & Format$(XorYMotor%) & " is not valid stage axis motor (this error should not occur, please contact Probe Software technical support with details)."
MsgBox msg$, vbOKOnly + vbExclamation, "RealTimeGetBeamScanCalibration"
ierror = True
Exit Function

RealTimeGetBeamScanCalibrationZeroMag:
msg$ = "Passed magnification value is zero (motor= " & Format$(XorYMotor%) & ", keV= " & Format$(keV!) & ", srota= " & Format$(srota!) & "), (this error should not occur, please contact Probe Software technical support with details)."
MsgBox msg$, vbOKOnly + vbExclamation, "RealTimeGetBeamScanCalibration"
ierror = True
Exit Function

End Function

Also prrsumably you can load the data for each kV, I've done it for 20kV and can now add it for the other kV. Do you find it changes much for kV's.

That is a really good question and I hope some smart person can help answer that question for us!

I suspect the answer is "it depends" on exactly how much attention your service person gives to such matters.

The idea for specifying the beam scan calibration as a function of keV, mag and scan rotation is that I assume most labs (like my own), don't usually have these hardware items adjusted constantly and so having a software method to deal with them can really help.

Also, I think getting these beam scan calibration issues dealt with in hardware is possible, though difficult, so the software calibration allows one to tweak the accuracy as far as one wants to...

That's my idea anyway.
john
« Last Edit: September 15, 2016, 09:10:16 AM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Ben Buse

  • Professor
  • ****
  • Posts: 488
Re: An Improved Method for Beam Scan to Stage Calibration
« Reply #10 on: September 19, 2016, 03:59:36 AM »
Thanks

Ben

glennpoirier

  • Professor
  • ****
  • Posts: 54
Re: An Improved Method for Beam Scan to Stage Calibration
« Reply #11 on: December 20, 2017, 01:03:46 PM »
Hi John,
Last time I tried to calibrate beam scan to stage I screwed it up somehow (probably because some points used the new JEOL scan generator code and some used the old method). Is there an easy way to delete the bad calibration and start from scratch? (Would simply deleting the relevant lines in probewin.ini work?)

Cheers

Glenn

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3275
  • Other duties as assigned...
    • Probe Software
Re: An Improved Method for Beam Scan to Stage Calibration
« Reply #12 on: December 20, 2017, 03:37:46 PM »
Hi John,
Last time I tried to calibrate beam scan to stage I screwed it up somehow (probably because some points used the new JEOL scan generator code and some used the old method). Is there an easy way to delete the bad calibration and start from scratch? (Would simply deleting the relevant lines in probewin.ini work?)

Hi Glenn,
You could manually delete the lines in the probewin.ini file, but remember you'd be starting from scratch as each line can hold more than one calibration as seen here:

ImageInterfaceCalNumberOfBeamCalibrations="5"
ImageInterfaceCalKeV="15,15,15,15,15"
ImageInterfaceCalMag="334,405,571,758,1335"
ImageInterfaceCalXMicrons="1118.275,926.9622,659.7579,498.7495,282.546"
ImageInterfaceCalYMicrons="848.4153,705.2865,504.1712,376.3542,207.0935"
ImageInterfaceCalScanRotation="8.7,8.8,8.9,9.1,9.3"

If you want to do this manually it might be better to only edit/delete the specific offending calibrations.   But then you'll want to also change the "number of beam calibrations" value to reflect how many calibrations are left after you edit them.

But yes, to be perfectly safe you could just delete them all and PFE should re-create an empty set automatically. Which will get updated automatically from the CalcImage Calibrate Beam Scan window.
john
« Last Edit: December 20, 2017, 03:39:59 PM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Scott B.

  • Global Moderator
  • Post Doc
  • *****
  • Posts: 10
Re: An Improved Method for Beam Scan to Stage Calibration
« Reply #13 on: January 06, 2023, 12:41:47 PM »
Greetings,

I rely on the image/stage calibration feature in CalcImage. I have almost entirely gone to having users digitize positions on images, as it is easy and intuitive for them, and ensures they have spatial information recorded (amazes me how many spreadsheets there are floating around full of microanalytical data with no spatial context. For god sakes, it’s the whole point of the microprobe…).
 
My instrument has a pile of variables that stack together to shift the image away from the optical scope center (variation in scan speed, steps in the magnification coils, and imprecise magnification calibration, et al.) so without the CalcImage calibration, I’d have to recalibrate my image manually (i.e. potentiometers on the back of my Noran box) for a given magnification and scan speed, and force the user to stay near those conditions to get any kind of precision with Digitize Image.
 
With the CalcImage calibration, I can get ≤ 20 µm precision from Digitize Image, even at low magnification out near the edges of the image, and with a 5 or 6 point calibration, it only gets better as you zoom in.

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3275
  • Other duties as assigned...
    • Probe Software
Re: An Improved Method for Beam Scan to Stage Calibration
« Reply #14 on: April 17, 2024, 01:54:12 PM »
A small update on the three point image calibration in CalcImage which allows one to calibrate your beam scans to stage scanned images at various magnifications:



Recently Scott Boroughs (see posts above) mentioned that when using the "Clear" button to clear all current image calibrations (perhaps after a column service visit from your service engineer), the default image calibration that is loaded wasn't very accurate.

So we've modified the code to load a more accurate default image calibration when the "Clear" button is clicked in the latest version of CalcImage (update from the Probe for EPMA Help menu).

The new code takes into account the specific image hardware interface used by Probe for EPMA (mapping, video, Thermo, Bruker, etc.) and provides a more accurate values for subsequent refining.

The current code is here and from the "???" comments you can see where would we like to obtain additional "default" calibrations for those interfaces... if you have that image interface and have calibrated your beam scanning recently.

Code: [Select]
' JEOL image calibrations (4=8900/8200/8500/8x30, 7=JEOL 8230/8530 Video, 8=iSP100/iHP200F MEC Video, 9=Bruker, 10=Thermo)
If MiscIsInstrumentStage("JEOL") Then
If ImageInterfaceType% = 7 Then                         ' JEOL EDS video
ImageInterfaceCalXMicronsArray!(1) = 100# / DefaultMagnification! * 1200#               ' assume 100x = 1200um  (???)
ImageInterfaceCalYMicronsArray!(1) = ImageInterfaceCalXMicronsArray!(1) * 3# / 4#       ' assume 4:3 for JEOL EDS video interface
ElseIf ImageInterfaceType% = 8 Then                     ' JEOL MEC video (not implemented yet!!!)
ImageInterfaceCalXMicronsArray!(1) = 100# / DefaultMagnification! * 1200#               ' assume 100x = 1200um  (???)
ImageInterfaceCalYMicronsArray!(1) = ImageInterfaceCalXMicronsArray!(1) * 3# / 4#       ' assume 4:3 for JEOL MEC video interface (not implemented yet!!!)
ElseIf ImageInterfaceType% = 9 Then                     ' Bruker
ImageInterfaceCalXMicronsArray!(1) = 100# / DefaultMagnification! * 1200#               ' assume 100x = 1200um  (???)
ImageInterfaceCalYMicronsArray!(1) = ImageInterfaceCalXMicronsArray!(1) * 3# / 4#       ' assume 4:3 for Bruker image interface
ElseIf ImageInterfaceType% = 10 Then                    ' Thermo
ImageInterfaceCalXMicronsArray!(1) = 100# / DefaultMagnification! * 1300#               ' assume 100x = 1300um  (WSU 8500, 100x = 1311um)
ImageInterfaceCalYMicronsArray!(1) = ImageInterfaceCalXMicronsArray!(1) * 3# / 4#       ' assume 4:3 for Thermo image interface
Else
ImageInterfaceCalXMicronsArray!(1) = 100# / DefaultMagnification! * 1150#               ' assume 100x = 1150um  (WSU 8500, 100x = 1162um)
ImageInterfaceCalYMicronsArray!(1) = ImageInterfaceCalXMicronsArray!(1)                 ' assume 1:1 for JEOL mapping interface (ImageInterfaceType=4)
End If
End If

' Cameca image calibrations (5=SX100/SXFive Mapping, 6=SX100/SXFive Video, 9=Bruker, 10=Thermo)
If Not MiscIsInstrumentStage("JEOL") Then
If ImageInterfaceType% = 6 Then                         ' Cameca video image interface
ImageInterfaceCalXMicronsArray!(1) = 1000# / DefaultMagnification! * 350#               ' assume 1000x = 350um  (UofO SX100, 1054x = 343um)
ImageInterfaceCalYMicronsArray!(1) = ImageInterfaceCalXMicronsArray!(1) * 3# / 4#       ' assume 4:3 for Cameca video interface
ElseIf ImageInterfaceType% = 9 Then                     ' Bruker
ImageInterfaceCalXMicronsArray!(1) = 400# / DefaultMagnification! * 950#                ' assume 400x = 950um  (???)
ImageInterfaceCalYMicronsArray!(1) = ImageInterfaceCalXMicronsArray!(1) * 3# / 4#       ' assume 4:3 for Bruker image interface
ElseIf ImageInterfaceType% = 10 Then                    ' Thermo
ImageInterfaceCalXMicronsArray!(1) = 400# / DefaultMagnification! * 950#                ' assume 400x = 950um  (???)
ImageInterfaceCalYMicronsArray!(1) = ImageInterfaceCalXMicronsArray!(1) * 3# / 4#       ' assume 4:3 for Thermo image interface
Else
ImageInterfaceCalXMicronsArray!(1) = 400# / DefaultMagnification! * 950#                ' assume 400x = 950um  (UofO SX100, 400x = 943um)
ImageInterfaceCalYMicronsArray!(1) = ImageInterfaceCalXMicronsArray!(1)                 ' assume 1:1 for Cameca mapping interface (ImageInterfaceType=5)
End If
End If
« Last Edit: April 17, 2024, 01:56:29 PM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"