The Resonon API is no longer being updated or maintained. We recommend customers move to using the camera vendors' SDKs.
Documentation on how to do so is available here.
Resonon API  3.12 [Deprecated]
C++ API for controlling Resonon hyperspectral imagers
Public Member Functions | List of all members
Resonon::PikaAllied Class Reference

A class for imagers based on Allied Vimba Cameras. More...

#include "resonon_imager_allied.h"

Inheritance diagram for Resonon::PikaAllied:
Resonon::ResononImagerBase

Public Member Functions

 PikaAllied ()
 PikaAllied is a class for Resonon Imagers that make use of Allied Vision Cameras via Allied's Vimba API. More...
 
virtual ~PikaAllied ()
 
void connect (const char *camera_serial_number=NULL)
 Connect to camera. More...
 
void disconnect ()
 Disconnect from a camera and free allocated resources. More...
 
void start ()
 Begin grabbing frames from the imager. More...
 
void stop ()
 Stop grabbing frames from the imager. More...
 
void get_imager_type (char *buffer, int buffer_size)
 Get a string identifying the type of imager being controlled by this class. More...
 
void get_serial_number (char *buffer, int buffer_size)
 Get a string identifying the serial number of the connected imager. More...
 
void get_camera_serial_number (char *buffer, int buffer_size)
 Get a string identifying the serial number of the camera embedded in the imager. More...
 
void generate_configuration_report (char *buffer, int buffer_size)
 Generates a report on the imager's internal settings. More...
 
float get_coeff_a ()
 Gets the first imager spectral calibration coefficient stored in camera memory. More...
 
float get_coeff_b ()
 Gets the second imager spectral calibration coefficient stored in camera memory. More...
 
float get_coeff_c ()
 Gets the third imager spectral calibration coefficient stored in camera memory. More...
 
double get_wavelength_at_band (const int band)
 Get the wavelength of the imager at the requested band number. More...
 
int get_frame_buffer_size_in_bytes ()
 Get the size of the buffer required to get a single frame from the imager, in bytes, according to current windowing, binning, and bit depth settings. More...
 
unsigned short * get_frame (unsigned short *buffer)
 Get a single frame from the imager and copy it to the provided buffer. More...
 
std::uint64_t get_last_timestamp ()
 Get the timestamp of the last image returned by PikaAllied::get_frame() in camera ticks (nanoseconds). More...
 
std::uint64_t ticks_per_second ()
 Get the number of camera ticks per second, for converting values returned by PikaAllied::get_last_timestamp() to seconds. More...
 
int get_band_count ()
 Get the number of bands (spectral dimension) provided by the imager. More...
 
int get_sample_count ()
 Get the number of samples (spatial dimension) provided by the imager. More...
 
void set_framerate (const double frames_per_second)
 Set the imager framerate in frames per second. More...
 
double get_framerate ()
 Get the current requested framerate in frames per second. More...
 
double get_min_framerate ()
 Get the minimum value that the framerate can be set to. More...
 
double get_max_framerate ()
 Get the maximum value that the framerate can be set to. More...
 
double get_min_integration_time ()
 Get the minimum integration time supported by the camera. More...
 
double get_max_integration_time ()
 Get the maximum integration time supported by the camera. More...
 
void set_integration_time (const double milliseconds)
 Set the integration time in milliseconds. More...
 
double get_integration_time ()
 Get the current integration time in milliseconds. More...
 
void set_internal_trigger ()
 Set the camera to internally triggered mode. More...
 
void set_external_trigger (unsigned int signal_line, bool rising_edge=true)
 Set the camera to externally triggered mode. More...
 
bool is_trigger_external ()
 Return true if the camera is in external trigger mode, false if the camera is in internal trigger mode. More...
 
- Public Member Functions inherited from Resonon::ResononImagerBase
 ResononImagerBase ()
 
virtual ~ResononImagerBase ()
 
int get_nearest_band_to_wavelength (const double wavelength)
 Return the band number that is closest to the requested wavelength from the current windowing settings. More...
 
virtual void set_spectral_bin (int new_spectral_bin)
 Set the binning in the spectral dimension, if supported by the camera. More...
 
virtual int get_spectral_bin ()
 Get the current spectral binning setting. More...
 
virtual int get_min_spectral_bin ()
 Get the minimum spectral binning setting. More...
 
virtual int get_max_spectral_bin ()
 Get the maximum spectral binning setting. More...
 
virtual int get_start_band ()
 Get the start of the user-defined spectral window. More...
 
virtual void set_start_band (int band)
 Set the first band in the user-defined spectral window. More...
 
virtual int get_min_start_band ()
 Get the minimum band number allowed for the start of the spectral window at current settings. More...
 
virtual int get_max_start_band ()
 Get the maximum band number allowed for the start of the spectral window at current settings. More...
 
virtual int get_inc_start_band ()
 Get the increment for valid value of the start of the spectral window at current settings. More...
 
virtual int get_end_band ()
 Get the end of the user-defined spectral window. More...
 
virtual void set_end_band (int band)
 Set the end of the user-defined spectral window. More...
 
virtual int get_min_end_band ()
 Get the minimum band number allowed for the end of the user-defined spectral window at current settings. More...
 
virtual int get_max_end_band ()
 Get the maximum band number allowed for the end of the user-defined spectral window at current settings. More...
 
virtual int get_inc_end_band ()
 Get the increment for valid value of the end of the user-defined spectral window at current settings. More...
 
virtual int get_start_sample ()
 Get the start of the user-defined spatial window. More...
 
virtual void set_start_sample (int sample)
 Set the first sample in the user-defined spatial window. More...
 
virtual int get_min_start_sample ()
 Get the minimum sample number allowed for the start of the spatial window at current settings. More...
 
virtual int get_max_start_sample ()
 Get the maximum sample number allowed for the start of the spatial window at current settings. More...
 
virtual int get_inc_start_sample ()
 Get the increment for valid value of the start of the spatial window at current settings. More...
 
virtual int get_end_sample ()
 Get the end of the user-defined spatial window. More...
 
virtual void set_end_sample (int sample)
 Set the end of the user-defined spatial window. More...
 
virtual int get_min_end_sample ()
 Get the minimum sample number allowed for the end of the user-defined spatial window at current settings. More...
 
virtual int get_max_end_sample ()
 Get the maximum sample number allowed for the end of the user-defined spatial window at current settings. More...
 
virtual int get_inc_end_sample ()
 Get the increment for valid value of the end of the user-defined spatial window at current settings. More...
 
virtual void set_gain (const double gain)
 Sets the camera gain. More...
 
virtual double get_gain ()
 Gets the camera gain setting. More...
 
virtual double get_min_gain ()
 Gets the camera minimum gain setting. More...
 
virtual double get_max_gain ()
 Gets the camera maximum gain setting. More...
 

Detailed Description

A class for imagers based on Allied Vimba Cameras.

Examples:
record_pika_allied_datacube.cpp.

Constructor & Destructor Documentation

◆ PikaAllied()

PikaAllied::PikaAllied ( )

PikaAllied is a class for Resonon Imagers that make use of Allied Vision Cameras via Allied's Vimba API.

Only one instance of this class is allowed.

◆ ~PikaAllied()

PikaAllied::~PikaAllied ( )
virtual
Exceptions
std::runtime_errorif there is an error while disconnecting from the camera.

Member Function Documentation

◆ connect()

void PikaAllied::connect ( const char *  camera_serial_number = NULL)
virtual

Connect to camera.

This method will attempt to connect to the first camera found on the system.

Parameters
[in]camera_serial_numberThe serial number of the camera to connect (this is not the imager serial number). If NULL connect to the first camera found.
Exceptions
std::runtime_errorif camera cannot be initialized or an unexpected camera is found. Use std::runtime_error.what() for more details.

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ disconnect()

void PikaAllied::disconnect ( )
virtual

Disconnect from a camera and free allocated resources.

Exceptions
std::runtime_errorif there is an error while disconnecting from the camera

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ generate_configuration_report()

void PikaAllied::generate_configuration_report ( char *  buffer,
int  buffer_size 
)
virtual

Generates a report on the imager's internal settings.

Parameters
[in,out]bufferA character buffer to receive the report. Recommended size is 1,000 bytes.
[in]buffer_sizeThe size of the passed character buffer, to prevent overruns.
Exceptions
std::runtime_errorif no imager is connected.

Implements Resonon::ResononImagerBase.

◆ get_band_count()

int PikaAllied::get_band_count ( )
virtual

Get the number of bands (spectral dimension) provided by the imager.

Returns
Current number of bands
Exceptions
std::runtime_errorif camera error occurs

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ get_camera_serial_number()

void PikaAllied::get_camera_serial_number ( char *  buffer,
int  buffer_size 
)
virtual

Get a string identifying the serial number of the camera embedded in the imager.

Parameters
[in,out]bufferA character buffer to receive the serial number cstring.
[in]buffer_sizeThe size of the passed character buffer, to prevent overruns.
Exceptions
std::runtime_errorif no imager is connected.

Implements Resonon::ResononImagerBase.

◆ get_coeff_a()

float PikaAllied::get_coeff_a ( )
virtual

Gets the first imager spectral calibration coefficient stored in camera memory.

Returns
the first imager spectral calibration coefficient
Exceptions
std::runtime_errorif the imager is not connected.

Implements Resonon::ResononImagerBase.

◆ get_coeff_b()

float PikaAllied::get_coeff_b ( )
virtual

Gets the second imager spectral calibration coefficient stored in camera memory.

Returns
the second imager spectral calibration coefficient
Exceptions
std::runtime_errorif the imager is not connected.

Implements Resonon::ResononImagerBase.

◆ get_coeff_c()

float PikaAllied::get_coeff_c ( )
virtual

Gets the third imager spectral calibration coefficient stored in camera memory.

Returns
the third imager spectral calibration coefficient
Exceptions
std::runtime_errorif the imager is not connected.

Implements Resonon::ResononImagerBase.

◆ get_frame()

unsigned short * PikaAllied::get_frame ( unsigned short *  buffer)
virtual

Get a single frame from the imager and copy it to the provided buffer.

Space for the data must be previously allocated. Use PikaAllied::get_frame_buffer_size_in_bytes() to get the required size of the buffer. Data type is unsigned short. This call retrieves the most recent frame received from the camera. If no frame has been received this call blocks until a frame becomes available. PikaAllied::start() must be called before retrieving frames.

Parameters
[in,out]bufferA pointer to the buffer to which frame data should be copied.
Returns
A pointer to the buffer containing the latest frame (the same pointer passed in as buffer).
Exceptions
std::runtime_errorIf camera has been improperly configured, frame capture has not been started, or a camera error occurs. Use std::runtime_error.what() to get details.

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ get_frame_buffer_size_in_bytes()

int PikaAllied::get_frame_buffer_size_in_bytes ( )
virtual

Get the size of the buffer required to get a single frame from the imager, in bytes, according to current windowing, binning, and bit depth settings.

Returns
Current frame size in bytes
Exceptions
std::runtime_errorif camera error occurs

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ get_framerate()

double PikaAllied::get_framerate ( )
virtual

Get the current requested framerate in frames per second.

For PikaAllied cameras the exposure time is honored over the framerate. That is, if the exposure time is longer than 1/framerate, the achieved framerate will be less than the requested framerate. See Framerate and Integration Time for additional considerations.

Returns
Current framerate in frames per second.
Exceptions
std::runtime_errorif a camera error occurs.

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ get_imager_type()

void PikaAllied::get_imager_type ( char *  buffer,
int  buffer_size 
)
virtual

Get a string identifying the type of imager being controlled by this class.

For Pika NIR imagers based on the Allied Goldeye cameras, this string is "PikaNIR" for 320 pixel resolution imagers, or "PikaNIR640" for 640 pixel resolution imagers.

Parameters
bufferA character buffer to receive the imager type cstring.
buffer_sizeThe size of the passed character buffer, to prevent overruns.

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ get_integration_time()

double PikaAllied::get_integration_time ( )
virtual

Get the current integration time in milliseconds.

Returns
Current integration time in milliseconds.
Exceptions
std::runtime_errorif a camera error occurs.

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ get_last_timestamp()

std::uint64_t PikaAllied::get_last_timestamp ( )
virtual

Get the timestamp of the last image returned by PikaAllied::get_frame() in camera ticks (nanoseconds).

Returns
The timestamp of the last image.

Implements Resonon::ResononImagerBase.

◆ get_max_framerate()

double PikaAllied::get_max_framerate ( )
virtual

Get the maximum value that the framerate can be set to.

See Framerate and Integration Time for additional considerations.

Returns
Maximum allowable framerate.
Exceptions
std::runtime_errorif a camera error occurs.

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ get_max_integration_time()

double PikaAllied::get_max_integration_time ( )
virtual

Get the maximum integration time supported by the camera.

Returns
maximum supported integration time in milliseconds.
Exceptions
std::runtime_errorif a camera error occurs.

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ get_min_framerate()

double PikaAllied::get_min_framerate ( )
virtual

Get the minimum value that the framerate can be set to.

See Framerate and Integration Time for additional considerations.

Returns
Minimum allowable framerate.
Exceptions
std::runtime_errorif a camera error occurs.

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ get_min_integration_time()

double PikaAllied::get_min_integration_time ( )
virtual

Get the minimum integration time supported by the camera.

Returns
Minimum supported integration time in milliseconds.
Exceptions
std::runtime_errorif a camera error occurs.

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ get_sample_count()

int PikaAllied::get_sample_count ( )
virtual

Get the number of samples (spatial dimension) provided by the imager.

Returns
Current number of samples
Exceptions
std::runtime_errorif camera error occurs

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ get_serial_number()

void PikaAllied::get_serial_number ( char *  buffer,
int  buffer_size 
)
virtual

Get a string identifying the serial number of the connected imager.

Parameters
[in,out]bufferA character buffer to receive the serial number cstring.
[in]buffer_sizeThe size of the passed character buffer, to prevent overruns.
Exceptions
std::runtime_errorif no imager is connected.

Implements Resonon::ResononImagerBase.

◆ get_wavelength_at_band()

double PikaAllied::get_wavelength_at_band ( const int  band)
virtual

Get the wavelength of the imager at the requested band number.

Band numbers always start at 0 and end at the total number of bands available on the camera. To get all supplied wavelengths loop from 0 to PikaAllied::get_band_count() - 1.

Parameters
bandThe band number for which to calculate wavelength.
Returns
The calculated wavelength(nm).
Exceptions
std::domain_errorif band is invalid (band < 0 or band >= number of bands)

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ is_trigger_external()

bool PikaAllied::is_trigger_external ( )
virtual

Return true if the camera is in external trigger mode, false if the camera is in internal trigger mode.

Exceptions
std::runtime_errorif camera error occurs

Reimplemented from Resonon::ResononImagerBase.

◆ set_external_trigger()

void PikaAllied::set_external_trigger ( unsigned int  signal_line,
bool  rising_edge = true 
)
virtual

Set the camera to externally triggered mode.

Parameters
signal_lineThe signal trigger source. Valid values are 1 for line 1 and 2 for line 2.
rising_edgeSet to true to trigger on the rising edge or false to trigger on the falling edge.
Exceptions
std::runtime_errorif camera error occurs or an invalid signal_line is specified.

Reimplemented from Resonon::ResononImagerBase.

◆ set_framerate()

void PikaAllied::set_framerate ( const double  frames_per_second)
virtual

Set the imager framerate in frames per second.

For PikaAllied cameras, the exposure time is honored over the framerate. That is, if the exposure time is longer than 1/framerate, the achieved framerate will be less than the requested framerate. See Framerate and Integration Time for additional considerations.

Parameters
frames_per_secondRequested framerate in frames per second.
Exceptions
std::runtime_errorif a camera error occurs.

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ set_integration_time()

void PikaAllied::set_integration_time ( const double  milliseconds)
virtual

Set the integration time in milliseconds.

For PikaAllied cameras the integration time is honored over the framerate. That is, if the integration time is longer than 1/framerate, the achieved framerate will be less than the requested framerate. See Framerate and Integration Time for additional considerations.

Parameters
millisecondsRequested integration time in milliseconds.
Exceptions
std::runtime_errorif a camera error occurs.

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ set_internal_trigger()

void PikaAllied::set_internal_trigger ( )
virtual

Set the camera to internally triggered mode.

Exceptions
std::runtime_errorif camera error occurs

Reimplemented from Resonon::ResononImagerBase.

◆ start()

void PikaAllied::start ( )
virtual

Begin grabbing frames from the imager.

This method must be called before calling PikaAllied::get_frame().

Exceptions
std::runtime_errorif camera error occurs

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ stop()

void PikaAllied::stop ( )
virtual

Stop grabbing frames from the imager.

Exceptions
std::runtime_errorif camera error occurs

Implements Resonon::ResononImagerBase.

Examples:
record_pika_allied_datacube.cpp.

◆ ticks_per_second()

std::uint64_t PikaAllied::ticks_per_second ( )
virtual

Get the number of camera ticks per second, for converting values returned by PikaAllied::get_last_timestamp() to seconds.

Implements Resonon::ResononImagerBase.