WPOCT Software Developer's Kit (SDK)
SDK For using Wasatch Photonics OCT Spectrometers
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
WPCamera Class Reference

Class that converts a scanned image from one format to another. More...

#include <WPCamera.h>

Inheritance diagram for WPCamera:
Inheritance graph
[legend]
Collaboration diagram for WPCamera:
Collaboration graph
[legend]

Public Member Functions

 WPCamera ()
 Constructor.
 
virtual ~WPCamera ()
 Destructor.
 
bool IsInitialized () const override
 Is the camera library initialized?
 
bool IsOpened () const override
 Is the camera opened?
 
bool IsAcquiring () const override
 Is the camera currently acquiring?
 
bool AreParametersSet () const override
 Are camera parameters set?
 
IWPOCTCamera::ErrorCode GetLastError () const override
 Gets the result of the most current operation.
 
IWPOCTCamera::CurrentStates GetCurrentState () const override
 Gets the current status of the camera. More...
 
int GetScanWidth () const override
 Get the width of an image.
 
int GetScanHeight () const override
 Get the height of an image.
 
bool GetScanWidthAndHeight (int *width, int *height) const override
 Get the width and height of a scan.
 
int GetNumBuffers () const override
 Get the number of image buffers.
 
int GetLinesLost () const override
 Get the number of lines lost in the last frame.
 
int GetTriggersMissed () const override
 Get the number of triggers missed in the last frame.
 
long long GetImageSize () const
 Get the size of an image.
 
int GetCameraType () const override
 Get the camera type.
 
int GetAcquisitionTimeout () const override
 Get the acquisition timeout in milliseconds.
 
int GetResourceIndex () const override
 Get the resource index of the frame grabber.
 
const char * GetCameraFileName () const override
 Get the name of the camera configuration file.
 
bool SetScanHeight (int value) override
 Set the height of an image.
 
bool SetNumBuffers (int value) override
 Set the number of image buffers.
 
bool SetCameraFileName (const char *name) override
 Set the name of the camera configuration file.
 
bool SetAcquisitionTimeout (int value) override
 Set the acquisition timeout in milliseconds.
 
bool SetResourceIndex (int value) override
 Set the resource index of the frame grabber.
 
bool AcquireFramesWriteToDisk (const char *baseFilePath, int numFrames, bool keepMemoryAllocated) override
 Write consecutive image acquisitions to memory. When finished write all to disk. More...
 
bool AcquireWriteFramesToMemory (unsigned short **data, int numFrames) override
 Write consecutive image acquisitions to memory pointed to by data supplied by this dll.
 
bool AcquireWriteFramesToMemory (unsigned short *data, int numFrames) override
 Write consecutive image acquisitions to memory pointed to by data supplied by the application.
 
- Public Member Functions inherited from IWPOCTCamera
virtual int GetCameraWidth () const =0
 Get the width of the camera in pixels. More...
 
virtual int GetNumCameras () const =0
 Get the number of cameras in system.
 
virtual const char * GetCameraID (int index)=0
 Get the camera ID string. More...
 
virtual float GetLinePeriod () const =0
 Gets the time between the start of line scans in microseconds. More...
 
virtual float GetExposureTime () const =0
 Gets the time of the camera in microseconds. More...
 
virtual int GetTriggerMode () const =0
 Get the trigger mode (internal, external with auto exposure, or external with specified exposure). More...
 
virtual int GetNumBitsInPixel () const =0
 Gets the number of bits used in a pixel (typically 10, 12, or 16). More...
 
virtual int GetNumBytesInPixel () const =0
 Get the size of a padded pixel in bytes (typically 2).
 
virtual bool SetLinePeriod (float value)=0
 Sets the period between lines in microseconds. More...
 
virtual bool SetExposureTime (float value)=0
 Sets the exposure time in microseconds. More...
 
virtual bool SetTriggerMode (int value)=0
 Sets the trigger mode of the camera. More...
 
virtual bool InitializeLibrary ()=0
 Opens the camera library. More...
 
virtual bool ShutDownLibrary ()=0
 Shuts down the camera library. More...
 
virtual bool Open (const char *id)=0
 Opens the camera specified by the id. More...
 
virtual bool Open (int id)=0
 Opens the camera specified by the id. More...
 
virtual bool Close ()=0
 Closes the camera opened with the Open command. More...
 
virtual bool ReadParameter (unsigned int address, unsigned int *value) const =0
 Reads a parameter or register from the camera and returns the value in the value argument. More...
 
virtual bool WriteParameter (unsigned int address, unsigned int value)=0
 Writes a parameter or register to the camera with the value supplied. More...
 
virtual bool SetParameters ()=0
 Sets the height of the camera buffers and the number of buffers based on values entered with SetScanHeight and SetNumBuffers. More...
 
virtual bool SetParameters (int height, int numBuffers)=0
 Sets the height of the camera buffers and the number of buffers that the camera can use. More...
 
virtual bool StartAcquiring ()=0
 Starts the camera acquiring frames of data. More...
 
virtual bool StopAcquiring (bool flushBuffers)=0
 Stops the camera data acquisition. More...
 
virtual bool ResetDevice ()=0
 Resets the camera or frame grabber. More...
 
virtual bool GetBuffer (void **buffer)=0
 Gets a camera buffer and returns a void pointer to the buffer. More...
 
virtual bool GetBuffer2 (unsigned short **buffer)=0
 Gets a camera buffer and returns the pointer to the buffer. More...
 
virtual bool GetBufferCopy (unsigned short *buffer)=0
 Gets a camera buffer and copies it into the buffer supplied. More...
 
virtual bool GetBufferAndIndex (void **buffer, int **index, unsigned long *frameNumber)=0
 Gets a camera buffer and returns a void pointer to the buffer. More...
 
virtual bool GetBufferAndIndex2 (unsigned short **buffer, int **index, unsigned long *frameNumber)=0
 Gets a camera buffer and returns a void pointer to the buffer. More...
 
virtual bool AbortGetBuffer ()=0
 Cancel the GetBuffer call. More...
 
virtual bool RequeueBuffer ()=0
 Requeues the most recent camera buffer obtained so it can be used again. More...
 
virtual bool RequeueBuffer (int *bufferHandle)=0
 Requeues the camera buffer pointed to by the bufferHandle so it can be used again. More...
 
virtual bool FlushBuffers ()=0
 Flushes all camera buffers so they can be used by the camera for acquisition. More...
 
virtual void Dispose ()
 
virtual bool IsInitialized ()
 
virtual bool IsOpened ()
 
virtual bool AreParametersSet ()
 
virtual bool IsAcquiring ()
 
virtual int GetScanWidth ()
 
virtual int GetScanHeight ()
 
virtual bool GetScanWidthAndHeight (ref int width, ref int height)
 
virtual int GetCameraWidth ()
 
virtual int GetNumCameras ()
 
virtual string GetCameraID (int index)
 
virtual int GetNumBuffers ()
 
virtual int GetLinesLost ()
 
virtual int GetTriggersMissed ()
 
virtual float GetLinePeriod ()
 
virtual float GetExposureTime ()
 
virtual int GetTriggerMode ()
 
virtual int GetCameraType ()
 
virtual int GetNumBitsInPixel ()
 
virtual int GetNumBytesInPixel ()
 
virtual int GetAcquisitionTimeout ()
 
virtual int GetResourceIndex ()
 
virtual string GetCameraFileName ()
 
virtual bool SetLinePeriod (float value)
 
virtual bool SetExposureTime (float value)
 
virtual bool SetTriggerMode (int value)
 
virtual bool SetCameraFileName (string name)
 
virtual bool InitializeLibrary ()
 
virtual bool ShutDownLibrary ()
 
virtual bool Open (string id)
 
virtual bool Open (int id)
 
virtual bool Close ()
 
virtual bool ReadParameter (uint address, ref uint value)
 
virtual bool WriteParameter (uint address, uint value)
 
virtual bool SetParameters ()
 
virtual bool SetParameters (int height, int numBuffers)
 
virtual bool StartAcquiring ()
 
virtual bool StopAcquiring (bool flushBuffers)
 
virtual bool GetBuffer (ref global::System.IntPtr buffer)
 
virtual bool GetBuffer2 (ref global::System.IntPtr buffer)
 
unsafe bool GetBufferCopy (ushort[] buffer)
 
virtual bool GetBufferAndIndex (ref global::System.IntPtr buffer, ref global::System.IntPtr index, ref ulong frameNumber)
 
virtual bool GetBufferAndIndex2 (ref global::System.IntPtr buffer, ref global::System.IntPtr index, ref ulong frameNumber)
 
virtual bool AbortGetBuffer ()
 
virtual bool RequeueBuffer ()
 
virtual bool RequeueBuffer (ref int bufferHandle)
 
virtual bool FlushBuffers ()
 
virtual bool ResetDevice ()
 
virtual bool AcquireFramesWriteToDisk (string baseFilePath, int numFrames, bool keepMemoryAllocated)
 
unsafe bool AcquireWriteFramesToMemory (ref global::System.IntPtr data, int numFrames)
 
unsafe bool AcquireWriteFramesToMemory (ushort[] data, int numFrames)
 
virtual IWPOCTCamera.ErrorCode GetLastError ()
 
virtual IWPOCTCamera.CurrentStates GetCurrentState ()
 

Protected Member Functions

virtual bool DeleteResources ()
 
void OutputDebugMsg (const wchar_t *str) const
 
void OutputDebugMsg (const char *str) const
 
string FormSeriesBaseFileName (const char *baseFilePath)
 
string FormSeriesFinalFileName (size_t index, const char *extension)
 
string GetFilledDigits (int number, int totalDigits)
 Gets the string prefixed with zeros so the string is a certain length. More...
 

Static Protected Member Functions

template<typename T >
static bool SaveMemoryToBinFile (const char *fname, long long size, const T *data)
 

Protected Attributes

int _id
 
unsigned int _scanWidth
 The width of an scan.
 
unsigned int _scanHeight
 The height of an scan.
 
std::atomic< ErrorCode_lastError
 The most recent error code.
 
std::atomic< CurrentStates_currentState
 
int _numBuffers
 
std::atomic< int > _linesLost
 
std::atomic< int > _triggersMissed
 
std::atomic< int > _acquisitionTimeout
 
std::atomic< bool > _acquiringSeries
 
std::atomic< bool > _abortAcquisition
 
std::atomic< long > _dongleVal
 Dongle check return value.
 
int _resourceIndex
 
CameraType _cameraType
 
vector< unsigned short > _acquisitionData
 
std::string _cameraFileName
 
std::string _seriesBaseFileName
 
- Protected Attributes inherited from IWPOCTCamera
bool swigCMemOwn
 

Additional Inherited Members

- Public Types inherited from IWPOCTCamera
enum  ErrorCode {
  NoError = 0 , InitializeLibraryError = 1 , ShutdownLibraryError = 2 , UpdateCameraListError = 3 ,
  GetCameraInfoError = 4 , OpenCameraError = 5 , CloseCameraError = 6 , MemoryAllocationError = 7 ,
  ProcessingError = 8 , ReadParameterError = 9 , SetParameterError = 10 , StartAcquiringError = 11 ,
  StopAcquiringError = 12 , GetBufferError = 13 , BufferCompletedWithZeros = 14 , AbortGetBufferError = 15 ,
  RequeueBufferError = 16 , FlushBufferError = 17 , TimeoutError = 18 , CameraFileError = 19 ,
  DongleNotFound = 20 , NumErrors = 21 , DLLExpired = 22 , NoError = 0 ,
  InitializeLibraryError = 1 , ShutdownLibraryError = 2 , UpdateCameraListError = 3 , GetCameraInfoError = 4 ,
  OpenCameraError = 5 , CloseCameraError = 6 , MemoryAllocationError = 7 , ProcessingError = 8 ,
  ReadParameterError = 9 , SetParameterError = 10 , StartAcquiringError = 11 , StopAcquiringError = 12 ,
  GetBufferError = 13 , BufferCompletedWithZeros = 14 , AbortGetBufferError = 15 , RequeueBufferError = 16 ,
  FlushBufferError = 17 , TimeoutError = 18 , CameraFileError = 19 , DongleNotFound = 20 ,
  NumErrors = 21 , DLLExpired = 22
}
 The following are error codes that are used within the camera. More...
 
enum  CameraType {
  NoCamera = 0 , USB3 = 1 , CameraLink = 2 , NI1433 = 3 ,
  NumCameras = 4 , NoCamera = 0 , USB3 = 1 , CameraLink = 2 ,
  NI1433 = 3 , NumCameras = 4
}
 The following are the camera types that are used in GetOCTCamera and GetCameraType. More...
 
enum  CurrentStates {
  Idle = 0 , LibraryInitialized = 1 , CameraOpened = 2 , ParametersSet = 4 ,
  CameraAcquiring = 8 , Idle = 0 , LibraryInitialized = 1 , CameraOpened = 2 ,
  ParametersSet = 4 , CameraAcquiring = 8
}
 Current states of the camera (more than one can be active) The following are status codes that are used within the camera. More...
 
enum class  ErrorCode {
  NoError = 0 , InitializeLibraryError = 1 , ShutdownLibraryError = 2 , UpdateCameraListError = 3 ,
  GetCameraInfoError = 4 , OpenCameraError = 5 , CloseCameraError = 6 , MemoryAllocationError = 7 ,
  ProcessingError = 8 , ReadParameterError = 9 , SetParameterError = 10 , StartAcquiringError = 11 ,
  StopAcquiringError = 12 , GetBufferError = 13 , BufferCompletedWithZeros = 14 , AbortGetBufferError = 15 ,
  RequeueBufferError = 16 , FlushBufferError = 17 , TimeoutError = 18 , CameraFileError = 19 ,
  DongleNotFound = 20 , NumErrors = 21 , DLLExpired = 22 , NoError = 0 ,
  InitializeLibraryError = 1 , ShutdownLibraryError = 2 , UpdateCameraListError = 3 , GetCameraInfoError = 4 ,
  OpenCameraError = 5 , CloseCameraError = 6 , MemoryAllocationError = 7 , ProcessingError = 8 ,
  ReadParameterError = 9 , SetParameterError = 10 , StartAcquiringError = 11 , StopAcquiringError = 12 ,
  GetBufferError = 13 , BufferCompletedWithZeros = 14 , AbortGetBufferError = 15 , RequeueBufferError = 16 ,
  FlushBufferError = 17 , TimeoutError = 18 , CameraFileError = 19 , DongleNotFound = 20 ,
  NumErrors = 21 , DLLExpired = 22
}
 
enum class  CameraType {
  NoCamera = 0 , USB3 = 1 , CameraLink = 2 , NI1433 = 3 ,
  NumCameras = 4 , NoCamera = 0 , USB3 = 1 , CameraLink = 2 ,
  NI1433 = 3 , NumCameras = 4
}
 
enum class  CurrentStates {
  Idle = 0 , LibraryInitialized = 1 , CameraOpened = 2 , ParametersSet = 4 ,
  CameraAcquiring = 8 , Idle = 0 , LibraryInitialized = 1 , CameraOpened = 2 ,
  ParametersSet = 4 , CameraAcquiring = 8
}
 
- Static Public Member Functions inherited from IWPOCTCamera
static IWPOCTCamera GetOCTCamera (IWPOCTCamera.CameraType cameraType)
 
static IWPOCTCamera.ErrorCode GetLastAttemptError ()
 
static bool DestroyOCTCamera (IWPOCTCamera camera)
 
static bool DestroyOCTCamera ()
 

Detailed Description

Class that converts a scanned image from one format to another.

This class is the implementation of IWPOCTCamera.

Member Function Documentation

◆ AcquireFramesWriteToDisk()

bool WPCamera::AcquireFramesWriteToDisk ( const char *  baseFilePath,
int  numFrames,
bool  keepMemoryAllocated 
)
overridevirtual

Write consecutive image acquisitions to memory. When finished write all to disk.

This will write consecutive frames to memory, and then to disk.

It will stop the user from getting images while it acquires.

Implements IWPOCTCamera.

◆ GetCurrentState()

IWPOCTCamera::CurrentStates WPCamera::GetCurrentState ( ) const
overridevirtual

Gets the current status of the camera.

Note
More than one can be active at the same time.

Implements IWPOCTCamera.

◆ GetFilledDigits()

std::string WPCamera::GetFilledDigits ( int  number,
int  totalDigits 
)
protected

Gets the string prefixed with zeros so the string is a certain length.

Parameters
numberThe number to convert to a string.
totalDigitsThe total length to make the string.
Returns

The documentation for this class was generated from the following files: