Bruxton Corporation SIDX 7 sample program description, AcquireContinuous.
This is a simple continuous acquisition sample. The following sections describe each of the main IGOR Pro functions.
CameraOpen opens the SIDX root, then opens the camera. On each open, SIDX returns a handle: an SIDX root handle for SIDX itself, and an SIDX camera handle for the camera. Use these handles in further SIDX calls.
CameraOpen ends by writing the open handle values into IGOR Pro global variables (notice 'Variable/G'). A more elegant solution is to write the handles into a data structure, but of course this depends on the program design.
- SIDXRootOpen creates an SIDX root handle. A call to SIDXRootOpen can include an SIDX software license code. If the caller provides no SIDX software license code, SIDX looks for a software license file in the location specified in the SIDX installation instructions. This sample program does not provide an SIDX software license code, so the software license file must exist.
- SIDXRootCameraScan finds a camera, if one is connected. SIDXRootCameraScan locates each supported camera driver installed on the system, and instructs the driver to scan for connected cameras. If scanning for cameras is slow, check to see if an installed camera driver is having trouble connecting to a camera. On most computers, only one camera driver will be installed, and only one camera. If the scan does not find any cameras, check to ensure that the camera is connected and powered on.
- SIDXRootCameraScanGetName obtains the name of the first camera (notice 'Variable sidx_camera_index = 0'). A more elaborate program could deal with multiple cameras, or select a specific camera. To do this, call SIDXRootCameraScanGetCount to determine how many cameras were found by SIDXRootCameraScan. then use SIDXRootCameraScanGetName with each index value successively to list the camera names.
- SIDXRootCameraOpenName opens the camera by name, returning a camera handle.
CameraSetUp writes settings into the camera for acquisition. The camera settings, for example, exposure duration, ROI, and binning, can only be written before starting acquisition.
- SIDXCameraBufferCountSet sets the size of the buffer used to hold incoming images, in units of images. The default value, 50, means that SIDX will allocate a buffer sufficient for 50 images. The buffer should be large enough to accommodate the images that can arrive each time the IGOR Pro script polls for more images. A typical microscope camera has an image size on the order of 10MB, and can read camera data at 50MB/s. A buffer of 50 images holds a few seconds of images, and occupies less than 1GB. This is usually adequate.
- SIDXCameraExposeSet sets the exposure interval. This is also the place where triggering, binning, gain, and other acquisition settings would be written. SIDX will write the closest value it can to the camera. For example, if the program specifies an acquisition interval of 0.005025s (5.025ms), and the camera has a timer resolution of 10us, then SIDX will write the value 0.005030s (5.030ms). Call SIDXCameraExposeGetValue to determine the actual value used.
- SIDXCameraAcquireImageSetLimit specifies how many images to acquire before stopping. The most common limit value is '0', meaning acquire until either SIDXAcquireAbort or SIDXAcquireStop is called.
- SIDXCameraAcquireOpen creates an acquire handle to manage acquisition. After this call, the acquisition parameters cannot be changed until SIDXCameraAcquireClose is called.
If your application requires a large buffer, consider using the 64-bit release of IGOR Pro. A 32-bit application can access something less than 4GB memory total, while a 64-bit application is effectively limited only by the amount of memory on the computer. On 64-bit systems, SIDX supports both 64-bit and 32-bit applications. This sample is written using IGOR Pro, which offers both 64-bit and 32-bit programs, with the 32-bit IGOR Pro being the default. Consider installing the 64-bit release of IGOR Pro if you need large buffers.
CameraAcquire performs the acquisition. This implementation polls SIDX for new images, and displays the newest image. This is suitable, for example, for focusing.
- SIDXAcquireStart starts the acquisition.
- SIDXAcquireGetStatus obtains the current acquisition status, to determine if acquisition has stopped due to an error. Your application must call SIDXAcquireGetStatus frequently enough for SIDX to service any incoming images. SIDXAcquireGetStatus not only returns the status, it also reads in any images that have been acquired by the camera.
- SIDXAcquireImageGetCount obtains the current count of images. If this value is the same as the previous call to SIDXAcquireImageGetCount, then no new images are present. If this value is greater than the previous call to SIDXAcquireImageGetCount, then new images are available in the SIDX image acquisition buffer.
- SIDXAcquireReadSetPosition sets the image number at which to read. If the application does not call SIDXAcquireReadSetPosition, then the acquisition will read all images in sequence. In this case, intermediate images are of no interest, so they are skipped.
- SIDXAcquireRead reads out the current image. The call to SIDXAcquireRead creates a new IGOR Pro wave, replacing any previous wave with the specified wave name. Notice that in the sample, the wave name is in an IGOR Pro string variable. The call prefixes the '$' operator to the string variable, '$sidx_image_name'. The '$' causes IGOR Pro to interpret the string as a reference. So, instead of writing a wave with the name 'sidx_image_name', IGOR Pro writes a wave with the name specified by the variable, in this case the text 'SIDXImage'.
- SIDXAcquireAbort terminates acquisition.
After terminating acquisition, SIDXAcquireClose could be called to close the acquisition handle. In this case, the calling main function closes all handles, so that is not needed.
This function closes all open handles, in sequence: SIDX acquire, SIDX camera, SIDX root.