AxsunOCTCapture  3.0.0.0
Captures and buffers streamed imaged data from the Axsun Ethernet/PCIe DAQ and displays or retrieves images to a client application on request.
AxsunOCTCapture.h
Go to the documentation of this file.
1 // AxsunOCTCapture.h
2 // Copyright 2019 Axsun Technologies
31 #ifndef AXSUNOCTCAPTURE_H
32 #define AXSUNOCTCAPTURE_H
33 
34 // includes
35 #include "AxsunCommonEnums.h"
36 
37 #ifdef __cplusplus
38 #include <cstdint> // for integer typedefs
39 #else
40 #include <stdint.h> // for integer typedefs
41 #endif // __cplusplus
42 
43 #ifdef __GNUC__
44 #include <stddef.h> // for size_t on linux
45 #endif // __GNUC__
46 
47 
49 struct AxCaptureSession;
50 
52 typedef struct AxCaptureSession* AOChandle;
53 
55 typedef enum {
57  U8,
59  U16,
61  U32,
66 } AxDataType;
67 
69 typedef enum {
70  SEPIA,
71  GREYSCALE,
72  INV_GREYSCALE,
73  USER_COLORMAP
74 } AxColormap;
75 
77 typedef enum {
83  BMP,
86 } AxFileType;
87 
89 typedef enum {
99 
101 typedef enum {
110 } AxInterface;
111 
113 typedef enum {
145 
147 typedef struct { // for analog waveform generation control
149  uint32_t X_increments;
151  uint32_t Y_increments;
153  double X_range;
155  double Y_range;
157  double X_shift;
159  double Y_shift;
161  double Y_idle;
163  double X_phase;
165  double rotate;
166 } scan_params_t;
167 
169 typedef struct { // for analog waveform generation control
175  double * linear_pattern;
177  double * raster_pattern;
178 } ext_pattern_t;
179 
181 typedef void(__cdecl *AxConnectScannerCallbackFunction_t)(void*);
182 
183 #ifdef _WINDOWS
184 #include "WinSock2.h" // for struct timeval
185 #pragma pack(push)
186 #pragma pack(1) // forces packing of data in AxPacket structure: sizeof(AxPacket) must be 34 bytes on Windows OS
187 #endif // _WINDOWS
188 
189 typedef struct {
190  uint16_t ascanLength;
191  uint16_t dataTypeCode;
192  uint16_t statusFlags;
194  uint32_t frameNumber;
195  uint32_t packetNumber;
196  uint16_t framesPacketNumber;
198  uint32_t imageNumber;
199  uint16_t syncOffsetInFrame;
200  uint16_t syncOffsetInAscan;
201  uint8_t subsamp;
202  uint8_t RFU;
203  struct timeval packetTimeStamp;
204 #ifdef __GNUC__
205 } __attribute__((packed, aligned(1))) AxPacket;
206 #endif // __GNUC__
207 #ifdef _WINDOWS
208 } AxPacket;
209 #pragma pack(pop)
210 #endif // _WINDOWS
211 
212 
213 #ifdef __cplusplus
214 extern "C" {
215 #endif
216  EXPORT
226  AxErr axStartSession(AOChandle* session, float capacity_MB);
227  EXPORT
236  AxErr axSelectInterface(AOChandle session, AxInterface which_interface);
237  EXPORT
245  AxErr axStopSession(AOChandle session);
246  EXPORT
255  void axGetErrorString(AxErr errorcode, char* message_out);
256  EXPORT
266  AxErr axGetMessage(AOChandle session, char* message_out);
267  EXPORT
281  AxErr axGetStatus(AOChandle session, uint32_t * imaging, uint32_t * last_packet_in, uint32_t * last_frame_in, uint32_t *last_image_in, uint32_t * droppedPackets_, uint32_t *frames_since_sync);
282  EXPORT
291  AxErr axGetDataRate(AOChandle session, double * datarate_Mbps);
292  EXPORT
304  AxErr axGetImageInfo(AOChandle session, int64_t requested_image_number, uint32_t * returned_image_number, uint32_t * required_buffer_size);
305  EXPORT
322  AxErr axGetImageInfoAdv(AOChandle session, int64_t requested_image_number, uint32_t * returned_image_number, int32_t * height, int32_t * width, AxDataType *data_type_out, uint32_t * required_buffer_size, uint8_t * force_trig, uint8_t * trig_too_fast);
323  EXPORT
338  AxErr axRequestImage(AOChandle session, int64_t requested_image_number, uint32_t * returned_image_number, int32_t * height, int32_t * width, AxDataType *data_type_out, uint8_t * image_data_out, uint32_t output_buf_len);
339  EXPORT
359  AxErr axRequestImageAdv(AOChandle session, int64_t requested_image_number, uint8_t * image_data_out, AxPacket * metadata_out, int32_t * height, int32_t * width, AxDataType *data_type_out, uint32_t output_buf_len, uint8_t average_number, AxRequestMode req_mode, uint8_t * force_trig, uint8_t * trig_too_fast);
360  EXPORT
374  AxErr axImageRequestSize(AOChandle session, uint32_t start_Ascan, uint32_t total_Ascans);
375  EXPORT
391  AxErr axGetFrameInfoAdv(AOChandle session, int64_t requested_frame_number, uint32_t * returned_frame_number, int32_t * height, int32_t * width, AxDataType *data_type_out, uint32_t * required_buffer_size);
392  EXPORT
408  AxErr axRequestFrameAdv(AOChandle session, int64_t requested_frame_number, uint8_t * frame_data_out, AxPacket * metadata_out, int32_t * height, int32_t * width, AxDataType *data_type_out, uint32_t output_buf_len);
409  EXPORT
423  AxErr axGetCompressedJPEGInfo(AOChandle session, int64_t requested_frame_number, uint32_t * returned_frame_number, uint32_t * required_buffer_size);
424  EXPORT
440  AxErr axRequestCompressedJPEG(AOChandle session, int64_t requested_frame_number, uint8_t * JPEG_data_out, AxPacket * metadata_out, uint32_t output_buf_len);
441  EXPORT
459  AxErr axSetupDisplay(AOChandle session, uint8_t window_style, int32_t w_left, int32_t w_top, int32_t w_width, int32_t w_height, uintptr_t parent_window_handle);
460  EXPORT
470  AxErr axUpdateWindowStyle(AOChandle session, uint8_t window_style);
471  EXPORT
481  AxErr axSelectInterpolation(AOChandle session, uint8_t interpolation);
482  EXPORT
495  AxErr axDisplayImage(AOChandle session, int64_t requested_image_number, uint32_t * returned_image_number, int32_t * height, int32_t * width);
496  EXPORT
506  AxErr axSelectColormap(AOChandle session, AxColormap colors);
507  EXPORT
518  AxErr axLoadUserColormap(AOChandle session, uint8_t * user_colormap_in);
519  EXPORT
536  AxErr axScanConvert(AOChandle session, uint8_t convert, uint8_t interpolation, float inner_radius, float outer_radius, float crop_inner, float crop_outer);
537  EXPORT
550  AxErr axUpdateView(AOChandle session, int32_t w_left, int32_t w_top, int32_t w_width, int32_t w_height);
551  EXPORT
564  AxErr axCropRect(AOChandle session, float crop_left, float crop_top, float crop_bottom, float crop_right);
565  EXPORT
576  AxErr axAdjustBrightnessContrast(AOChandle session, float brightness, float contrast);
577  EXPORT
586  AxErr axHideWindow(AOChandle session, uint32_t hidden);
587  EXPORT
605  AxErr axSetTrigTimeout(AOChandle session, uint32_t framesUntilForceTrig_);
606  EXPORT
618  AxErr axDownsampling(AOChandle session, uint8_t downsampling_state);
619  EXPORT
631  AxErr axSaveFile(AOChandle session, const char * path_file, uint8_t full_buffer, int32_t * packets_written);
632  EXPORT
642  AxErr axLoadFile(AOChandle session, const char * path_file, int32_t * packets_read);
643  EXPORT
654  AxErr axClearBuffer(AOChandle session);
655  EXPORT
667  AxErr axResizeBuffer(AOChandle session, float capacity_MB);
668  EXPORT
681  AxErr axImagingCntrlPCIe(AOChandle session, int16_t number_of_images);
682  EXPORT
694  AxErr axWriteFPGAreg(AOChandle session, uint16_t regnum, uint16_t regval);
695  EXPORT
707  AxErr axWriteFPGAregBIT(AOChandle session, uint16_t regnum, uint8_t bitnum, uint8_t bitval);
708  EXPORT
719  EXPORT
730  AxErr axReadFPGAreg(AOChandle session, uint16_t regnum, uint16_t *regval);
731  EXPORT
746  AxErr axExportImages(AOChandle session, const char* path_directory, int32_t* images_exported, AxFileType file_type);
747  EXPORT
835  AxErr axScanCmd(AxScannerCommand scan_command, double misc_scalar, scan_params_t * scan_parameters, ext_pattern_t * external_scan_pattern, void * RFU);
836  EXPORT
847 
848  EXPORT
854  int32_t axGetLibBuildCfg(void);
855  EXPORT
863  int32_t axGetLibBuildDateTime(char* datetime_str);
864  EXPORT
875  void axGetLibVersion(int32_t * major, int32_t * minor, int32_t * patch, int32_t * build, char* version_str);
876 
877 #ifdef __cplusplus
878 }
879 #endif
880 
881 #endif // AXSUNOCTCAPTURE_H include guard
AxFileType
Available file types to export using axExportImages().
Definition: AxsunOCTCapture.h:77
Structure for packet metadata. (Undocumented members are for internal use only.)
Definition: AxsunOCTCapture.h:189
double Y_range
Definition: AxsunOCTCapture.h:155
AxErr axHideWindow(AOChandle session, uint32_t hidden)
Hide or unhide the OpenGL image display window.
uint32_t ext_X_increments
Definition: AxsunOCTCapture.h:171
double * raster_pattern
Definition: AxsunOCTCapture.h:177
AxErr axImageRequestSize(AOChandle session, uint32_t start_Ascan, uint32_t total_Ascans)
Configure the cropped subset of A-scans to retrieve or display in subsequent calls to axRequestImage ...
Definition: AxsunOCTCapture.h:91
AxErr axCropRect(AOChandle session, float crop_left, float crop_top, float crop_bottom, float crop_right)
Change the rectangular cropping behavior of images displayed in an OpenGL window.
double X_shift
Definition: AxsunOCTCapture.h:157
void(__cdecl * AxConnectScannerCallbackFunction_t)(void *)
A user-provided function to be called upon connection or disconnection of a scanner (DAQmx) device.
Definition: AxsunOCTCapture.h:181
AxErr axGetImageInfo(AOChandle session, int64_t requested_image_number, uint32_t *returned_image_number, uint32_t *required_buffer_size)
Get basic information on an image in the Main Image Buffer.
AxErr axRequestFrameAdv(AOChandle session, int64_t requested_frame_number, uint8_t *frame_data_out, AxPacket *metadata_out, int32_t *height, int32_t *width, AxDataType *data_type_out, uint32_t output_buf_len)
Retrieve a frame from the Main Image Buffer (A frame is 256 A-scans, unsynchronized with Image_sync s...
Definition: AxsunOCTCapture.h:129
AxErr axSelectInterface(AOChandle session, AxInterface which_interface)
Select the data interface (Ethernet, PCIe, or none) for the capture session.
uint32_t X_increments
Definition: AxsunOCTCapture.h:149
Definition: AxsunOCTCapture.h:131
double X_phase
Definition: AxsunOCTCapture.h:163
Definition: AxsunOCTCapture.h:85
AxErr axScanCmd(AxScannerCommand scan_command, double misc_scalar, scan_params_t *scan_parameters, ext_pattern_t *external_scan_pattern, void *RFU)
Control analog output waveform generation for 2 channel (X-Y) scanners.
Definition: AxsunOCTCapture.h:127
AxErr axSelectColormap(AOChandle session, AxColormap colors)
Select the color scheme of images displayed in an OpenGL window.
AxErr axStartSession(AOChandle *session, float capacity_MB)
Start an Axsun Ethernet DAQ imaging session by allocating memory for the Main Image Buffer.
AxErr axRequestImage(AOChandle session, int64_t requested_image_number, uint32_t *returned_image_number, int32_t *height, int32_t *width, AxDataType *data_type_out, uint8_t *image_data_out, uint32_t output_buf_len)
Retrieve an image from the Main Image Buffer into a user buffer.
AxErr axSetTrigTimeout(AOChandle session, uint32_t framesUntilForceTrig_)
Control the behavior of Force Trigger mode.
Definition: AxsunOCTCapture.h:119
AxErr axGetMessage(AOChandle session, char *message_out)
Get a description of the capture session's interface status.
Definition: AxsunOCTCapture.h:117
AxErr axDownsampling(AOChandle session, uint8_t downsampling_state)
Enable or disable 2x downsampling during JPEG decompression.
uint32_t ext_Y_increments
Definition: AxsunOCTCapture.h:173
Definition: AxsunOCTCapture.h:115
AxErr axGetCompressedJPEGInfo(AOChandle session, int64_t requested_frame_number, uint32_t *returned_frame_number, uint32_t *required_buffer_size)
Get un-decompressed size information on a compressed JPEG frame in the Main Image Buffer (A frame is ...
AxErr axPipelineMode(AOChandle session, AxPipelineMode mode)
Configures FPGA registers to output the desired data type & location from the processing pipeline via...
void axGetLibVersion(int32_t *major, int32_t *minor, int32_t *patch, int32_t *build, char *version_str)
Get the library version.
double * linear_pattern
Definition: AxsunOCTCapture.h:175
AxInterface
Available capture interfaces to be selected by axSelectInterface().
Definition: AxsunOCTCapture.h:101
AxErr axRequestCompressedJPEG(AOChandle session, int64_t requested_frame_number, uint8_t *JPEG_data_out, AxPacket *metadata_out, uint32_t output_buf_len)
Retrieve an un-decompressed JPEG frame from the Main Image Buffer (A frame is 256 A-scans,...
Definition: AxsunOCTCapture.h:123
AxErr axReadFPGAreg(AOChandle session, uint16_t regnum, uint16_t *regval)
Read a FPGA register on the Axsun DAQ via the PCIe interface.
AxErr axExportImages(AOChandle session, const char *path_directory, int32_t *images_exported, AxFileType file_type)
Export images from the Main Image Buffer into individual binary files.
void axGetErrorString(AxErr errorcode, char *message_out)
Get a description of a specific AxErr error code.
uint32_t imageNumber
Definition: AxsunOCTCapture.h:198
AxErr
Error codes returned from AxsunOCTCapture or AxsunOCTControl_LW functions. Use axGetErrorString() for...
Definition: AxsunCommonEnums.h:23
int32_t axGetLibBuildDateTime(char *datetime_str)
Get a string describing the time and date that the library was built.
uint32_t frameNumber
Definition: AxsunOCTCapture.h:194
int32_t axGetLibBuildCfg(void)
Get the build configuration of the library.
Definition: AxsunOCTCapture.h:97
Definition: AxsunOCTCapture.h:81
double Y_idle
Definition: AxsunOCTCapture.h:161
Definition: AxsunOCTCapture.h:83
Definition: AxsunOCTCapture.h:121
Definition: AxsunOCTCapture.h:135
AxErr axGetImageInfoAdv(AOChandle session, int64_t requested_image_number, uint32_t *returned_image_number, int32_t *height, int32_t *width, AxDataType *data_type_out, uint32_t *required_buffer_size, uint8_t *force_trig, uint8_t *trig_too_fast)
Advanced function for getting information on an image in the Main Image Buffer.
Definition: AxsunOCTCapture.h:79
Definition: AxsunOCTCapture.h:141
Definition: AxsunOCTCapture.h:61
Definition: AxsunOCTCapture.h:95
AxDataType
Integer data types which may be generated by the Axsun DAQ depending on selected pipeline bypass mode...
Definition: AxsunOCTCapture.h:55
Definition: AxsunOCTCapture.h:109
Definition: AxsunOCTCapture.h:133
AxErr axSetupDisplay(AOChandle session, uint8_t window_style, int32_t w_left, int32_t w_top, int32_t w_width, int32_t w_height, uintptr_t parent_window_handle)
Setup an OpenGL display window for direct rendering of image data.
AxErr axUpdateWindowStyle(AOChandle session, uint8_t window_style)
Change the OpenGL display window style.
Definition: AxsunOCTCapture.h:63
AxErr axRequestImageAdv(AOChandle session, int64_t requested_image_number, uint8_t *image_data_out, AxPacket *metadata_out, int32_t *height, int32_t *width, AxDataType *data_type_out, uint32_t output_buf_len, uint8_t average_number, AxRequestMode req_mode, uint8_t *force_trig, uint8_t *trig_too_fast)
Advanced function for retrieving and/or displaying an image from the Main Image Buffer.
AxErr axSelectInterpolation(AOChandle session, uint8_t interpolation)
Change the OpenGL display interpolation mode.
AxErr axGetStatus(AOChandle session, uint32_t *imaging, uint32_t *last_packet_in, uint32_t *last_frame_in, uint32_t *last_image_in, uint32_t *droppedPackets_, uint32_t *frames_since_sync)
Get imaging mode status and Main Image Buffer statistics.
Structure for passing a user-generated scan pattern to axScanCmd(LOAD_EXT_PATTERN,...
Definition: AxsunOCTCapture.h:169
This header file contains enums and other definitions for integrating AxsunOCTCapture....
AxErr axUpdateView(AOChandle session, int32_t w_left, int32_t w_top, int32_t w_width, int32_t w_height)
Change the OpenGL window size and position.
Definition: AxsunOCTCapture.h:57
AxErr axWriteFPGAregBIT(AOChandle session, uint16_t regnum, uint8_t bitnum, uint8_t bitval)
Write a single bit in an FPGA register on the Axsun DAQ via the PCIe interface.
Definition: AxsunOCTCapture.h:125
AxErr axAdjustBrightnessContrast(AOChandle session, float brightness, float contrast)
Change the brightness and contrast of images displayed in an OpenGL window.
AxErr axResizeBuffer(AOChandle session, float capacity_MB)
Resets the Main Image Buffer with a new size.
Structure for passing rectangular raster scan pattern parameters to axScanCmd(SET_RECT_PATTERN,...
Definition: AxsunOCTCapture.h:147
AxErr axGetDataRate(AOChandle session, double *datarate_Mbps)
Get data transfer rate on the active interface.
uint32_t Y_increments
Definition: AxsunOCTCapture.h:151
double X_range
Definition: AxsunOCTCapture.h:153
AxErr axDisplayImage(AOChandle session, int64_t requested_image_number, uint32_t *returned_image_number, int32_t *height, int32_t *width)
Display an image from the Main Image Buffer directly to an OpenGL window (8-bit image data only).
double rotate
Definition: AxsunOCTCapture.h:165
Definition: AxsunOCTCapture.h:143
Definition: AxsunOCTCapture.h:137
AxErr axScanConvert(AOChandle session, uint8_t convert, uint8_t interpolation, float inner_radius, float outer_radius, float crop_inner, float crop_outer)
Change the polar -> rectangular scan conversion behavior of images displayed in an OpenGL window.
AxErr axLoadUserColormap(AOChandle session, uint8_t *user_colormap_in)
Load a user-defined AxColormap for images displayed in an OpenGL window.
Definition: AxsunOCTCapture.h:59
AxErr axStopSession(AOChandle session)
Stop a capture session and deallocate all resources, including Main Image Buffer and interfaces.
AxErr axGetFrameInfoAdv(AOChandle session, int64_t requested_frame_number, uint32_t *returned_frame_number, int32_t *height, int32_t *width, AxDataType *data_type_out, uint32_t *required_buffer_size)
Get information on a frame in the Main Image Buffer (A frame is 256 A-scans, unsynchronized with Imag...
AxErr axRegisterScannerConnectCallback(AxConnectScannerCallbackFunction_t callback_function, void *userData)
Registers a callback function to be executed following a scanner (DAQmx) device connection or disconn...
AxErr axClearBuffer(AOChandle session)
Clear Main Image Buffer by resetting all data to zero, leaving the buffer size the same.
Definition: AxsunOCTCapture.h:139
AxErr axWriteFPGAreg(AOChandle session, uint16_t regnum, uint16_t regval)
Write a FPGA register on the Axsun DAQ via the PCIe interface.
AxColormap
Available colormaps to select using axSelectColormap().
Definition: AxsunOCTCapture.h:69
double Y_shift
Definition: AxsunOCTCapture.h:159
Definition: AxsunOCTCapture.h:93
AxPipelineMode
DAQ pipeline modes.
Definition: AxsunCommonEnums.h:166
Definition: AxsunOCTCapture.h:103
Definition: AxsunOCTCapture.h:65
struct AxCaptureSession * AOChandle
Axsun OCT Capture handle - a pointer to the opaque structure used to manage created capture sessions.
Definition: AxsunOCTCapture.h:52
AxRequestMode
Available request modes to define behavior of axRequestImageAdv().
Definition: AxsunOCTCapture.h:89
Definition: AxsunOCTCapture.h:107
Definition: AxsunOCTCapture.h:105
AxScannerCommand
Available scanner command types to be executed by axScanCmd().
Definition: AxsunOCTCapture.h:113
AxErr axImagingCntrlPCIe(AOChandle session, int16_t number_of_images)
Control the image streaming behavior of the Axsun PCIe DAQ between Live Imaging, Burst Recording,...
AxErr axLoadFile(AOChandle session, const char *path_file, int32_t *packets_read)
Load contents from file on disk into Main Image Buffer.
AxErr axSaveFile(AOChandle session, const char *path_file, uint8_t full_buffer, int32_t *packets_written)
Save contents of Main Image Buffer to disk.