SciScan API (Active X Interface)

For background information on programming within SciScan please make sure you have read and understood the concepts on our Programming Concepts in SciScan page, before starting to interface using ActiveX.

Interaction with SciScan can be carried out through listening to and modifying the various GFVs through the GFG core ,from LabVIEW VI’s or using ActiveX and the provided GFG_Translator.vi

ActiveX control has been tested with MATLAB and Python. Please refer to the relevant example script files (.m or .py) for the application you are interested in. These examples should be easily adaptable to other programming languages that support ActiveX. To view the ActiveX example files  please see the SciScan Zip File and look at the ActiveX Connectivity Examples.

The GFG_Translator.vi can also be found in the SciScan Root Folder. However whilst the GFG_Translator.vi  is included in the zip file, it has intentionally been excluded from the LabVIEW project, as calling a VI insdie a project will crash LabVIEW.

Points to Note

  1. GFG_Translator.vi should NOT be added to the LabVIEW project of SciScan (or any other project). Calling a VI inside a project using this technique crashes LabVIEW
  2. FOCUS, Record and Cancel cannot be set using the standard set method for Booleans due to restrictions enforced in SciScan. Please see the separate examples below to programmatically control FOCUS, Record and Cancel.

The state of the different components in SciScan are stored in a Generalized Functional Global variable (GFG) named GFG_Core.vi. To access this data (read/write) from outside the project, a ‘middleman’ VI called GFGTranslator.vi is made available.

Note for advanced users: 

To access data stored in GFG_Core.vi in SciScan from outside the project, it is required to use the reference number of the GFG_Core, which gets written into a file <SciScan application path>\GFG\GFG_core.ref when SciScan starts up. Internally, the GFGTranslator.vi uses this reference number to gain access to the GFG_Core.vi.  Please refer to the LabVIEW code of GFGTranslator.vi for more details. 

Using GFGTranslator.vi

  1. Using windows explorer, ensure that GFGTranslator.vi is present in your SciScan root folder. Note that this will NOT be visible in your lvproj LabVIEW project. It should NOT be added to the SciScan project (or any other project). Calling a VI inside a project using this technique crashes LabVIEW 
  1. Run SciScan
    1. Open the script file (Python/MATLAB) and make the following changes
        • Set the path to the GFG_translator.vi

       

      Python Set Path to GFG_translator.vi
      Python Set Path to GFG_translator.vi
      MATLAB Set Path to GFG_translator.vi
      MATLAB Set Path to GFG_translator.vi
  • Navigate to the code snippet relevant to the action (get, set) and data type (string, path, numeric, boolean, booleanref, all, variant (Read Only), image (Read Only)).

     

    Python Example
    Python Example

     

    MATLAB Example
    MATLAB Example
  • Un-comment the relevant code snippet and run the Script to execute the selected example.
  1. Once you are familiar with the calling conventions for the different data types, you can modify the examples and incorporate them into your own code to control SciScan from within your existing work flow

FOCUS, Record and Cancel

FOCUS, Record and Cancel cannot be set using the standard set method for Booleans due to restrictions enforced in SciScan. To set these controls programmatically; for example, to programmatically trigger a ‘Record’ use the booleanref data type as shown in the following examples.

Python Example of FOCUS, Record, Cancel
Python Example of FOCUS, Record, Cancel

 

Python Example of FOCUS, Record, Cancel
MATLAB Example of FOCUS, Record, Cancel

For more information on programming concepts within SciScan please see the Programming Module.

Galvo and Resonant Variables

For the galvo or resonant variables that can be read or written to using ActiveX, or a  stand-alone VI, see the Galvo or Resonant  Variable look up tables.

 

Was this article helpful?

Related Articles