WPOCT Software Developer's Kit (SDK)
SDK For using Wasatch Photonics OCT Spectrometers
Overview

The WPOCT products are a series of independent software products created by Wasatch Photonics. They are packaged as toolkits and provide a set of application programming interfaces (APIs) that are designed to convert data obtained from a linescan camera into meaningful OCT image data.

These toolkits run as Windows DLLs under Windows 8.1, and Windows 10. The three main components available are Camera (Acquisition), the Controller, and the Converter (Processor).

Each of these toolkits is independent of the others, so they allow developers to develop portions of a product on their own while using Wasatch components for accelerated development.

The components are detailed below along with a short description of what is required to use them.

Contents

  • Utensil-Camera (aka, Acquisition)
    • control and monitor specific cameras and frame grabbers used in WPOCT systems
  • Utensil-Controller
    • control and monitor the Wasatch Photonics OCT engine board
  • Utensil-Converter
    • convert data obtained from a line scan camera into meaningful 2D OCT image data
  • 3rd-party
    • external dependencies for the above 3 primary components

The three "utensil" projects include both APIs for our hardware and data formats, as well as example programs that show how to use those APIs.

Dependencies

To build the projects included in the nested folders here, the user will need to install Visual Studios 2019, with C++ and C# development tools, as well as the following add-ons:

- Windows SDK 10.0.18362
- C++ MFC for current build tools

The build process for these software kits has only been tested on Visual Studio 2019. It is possible that there are other build requirements. It is also possible other versions of Visual Studios will work as well.

SWIG

For SWIG batch scripts to run, the WP-OCT SDK must be installed to the directory C:\wasatch, such that C:\wasatch\3rd-party\SWIG and C:\wasatch\UtensilCamera are valid directories.

See swigcreatecameracsfiles.bat for examples.

3rd-Party

Pre-built binaries, sometimes along with source, are included in the 3rd-party folder for the following dependencies.

Connecting the Components: Connecting the Camera, Controller and Converter

Sequence of Events

The diagram below shows a simplified sequence of events to generate OCT data from a spectrometer.

dot_inline_dotgraph_1.png

Controller

The IWPOCTController issues commands to the Wasatch Photonics OCT Engine board, which in turn controls hardware connected to the board, such as lights and motors. The board also issues timing signals to the camera or frame grabber but does not control the camera itself.

The following commands provide a sequence that should be used to initialize the OCT controller set the timing, and start the scanning. Note that the commands can be either directly through serial communication or through the Wasatch Controller.

The commands below are the Controller APIs that are called to commence scanning. For some of these, the default value will be sufficient.

Refer to this class API for more information on Controller APIs (such as “SendCommand”):

Refer to this document for complete details on each engine board command (such as “a_scans 1024”):

To open the serial port:

result = _controller->OpenPort(COM3, 115200, 1, 100, false);

To setup and start a scan:

// Send all the motors home.
bool result = _controller->SendCommand("mgh a");

Sleep(1000);

// Turn on the sled.
result = _controller->SendCommand("out1 1");

// Set number of a_scans per b_scan.
result = _controller->SendCommand("a_scans 1024");

// Set number of b_scans.
result = _controller->SendCommand("b_scans 400");

// Set the delay.
result = _controller->SendCommand("delay 60");

// Set the return time.
result = _controller->SendCommand("t_ret 7");

// Set the pulse width.
result = _controller->SendCommand("pulse 5");

// Set the phase time.
result = _controller->SendCommand("phase 50");

// Set the trigger delay mode (0 or 1).
result = _controller->SendCommand("trdmode 0");

// Set the scan area.
result = _controller->SendCommand("xy_ramp 5000 25000 7000 22000 1");

// Set the reference arm position.
result = _controller->SendCommand("mg2 p 450");

Sleep(1000);

// Start scanning.
result = _controller→SendCommand("scan");

To stop scanning:

// Turn off the sled.
bool result=_controller→SendCommand("out1 0");

// Stop scanning.
Result =_controller->SendCommand("stop");

Acquisition (Camera)

If you are using the Wasatch Photonics WPOCT Acquisition toolkit, then the following commands should be issued through the IWPOCTCamera to acquire raw OCT data from the spectrometer:

Initialize Library
   Get Num Cameras
   Get Camera ID
   Open Camera
     Set Parameters
     Start Acquiring
       Get Buffer 
       Pass data to the converter
       Requeue Buffer
       Repeat Get Buffer
     Stop Acquiring
   Close Camera
Shutdown Library

If you are NOT using the Wasatch Photonics WPOCT Acquisition APIs, then the Dalsa Sapera SDK should be used to acquire data from the camera link card. The following sequence with from the Sapera SDK can be used to acquire data:

  1. Open the SapManager.
  2. Query the number of frame grabbers and get the name of the frame grabber present.
  3. Create the buffers where the images are stored.
  4. The Acquisition, Transfer, and optionally the View objects must also be created.
  5. Acquire an image using the Grab() command. The buffer is then read and the data copied to the application memory.
  6. To shutdown, stop the transfers and close SapManager.

For more information about the Camera API, see this class:

Processor (Converter)

The WPOCT Processor DLL (IWPOCTConverter) converts data obtained from the camera into OCT intensity image data. Data to be converted (IWPOCTInOutData) can be in the form of a memory buffer or a file on the disk.

Conversion is GPU-accelerated and can be multi-threaded by the user. Data is pointed to by an instance of an IWPInOutData object.

A typical set of commands to convert a memory buffer is:

// Allocate memory for input and output arrays.
// Set conversion parameters.
_converter->SetScanDimensions(width, height);
_converter->SetDispersionCoefficients(dispCoeffs, 2);
_converter->SetNumberOfLinesToIgnore(top, bottom);
_converter->SetMinMaxScaling(min, max);

// Convert the raw data to phase and/or intensity.
bool result = _converter→ConvertSpectralDataToPhaseIntensity(_inOutData);

// Read the output data stored in _inOutData and display.

For more information about the Converter API, see these classes: