Struct AcquisitionBuffer

Source
pub struct AcquisitionBuffer { /* private fields */ }
Expand description

Buffer that is used by the camera to transfer images to the host system.

The AcquisitionBuffer is the primary way to communicate with the camera while it is actively acquiring images. It is generated when the image acquisition is started and destroyed when the image acquisition is stopped.

Important difference to the C/C++ xiAPI: The AcquisitionBuffer temporarily consumes the Camera during acquisition, to prevent any interactions that may change parameters that are fixed while the image acquisition is running. Trying to change an parameter that is not changeable during acquisition is therefore an error at compile time (as opposed to runtime in C/C++).

Implementations§

Source§

impl AcquisitionBuffer

Source

pub fn stop_acquisition(self) -> Result<Camera, XI_RETURN>

Stop the image acquisition.

This function consumes the acquisition buffer and returns the contained camera. All resources acquired when creating this AcquisitionBuffer using Camera::start_acquisition() will be freed again.

When this is called, the camera will stop acquiring images and images previously acquired but not retrieved from the acquisition buffer can no longer be accessed.

Source

pub fn next_image<'a, T>( &'a self, timeout: Option<u32>, ) -> Result<Image<'a, T>, XI_RETURN>

Get the next image.

Returns an Image which refers to memory in this AcquisitionBuffer. The image will have a reference with the same lifetime as the AcquisitionBuffer making sure that it is always “safe” to use (However, it may still be overwritten in unsafe buffer mode).

Source

pub fn software_trigger(&mut self) -> Result<(), XI_RETURN>

Send a software trigger signal to the camera.

Trigger source has to be set to XI_TRG_SOFTWARE for this to take effect

§Examples
    let mut cam = xiapi::open_device(None)?;
    cam.set_trg_source(xiapi_sys::XI_TRG_SOURCE::XI_TRG_SOFTWARE)?;
    let mut acq_buffer = cam.start_acquisition()?;
    acq_buffer.software_trigger()?;
    let img = acq_buffer.next_image::<u8>(None)?;

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.