Keyword The IMAGE_KEYWORD structure includes :
IMAGE structure The IMAGE structure includes :
Image metadata.
Photon detection events.
Log individual photon events on a 2D camera
Timing resolution = 1 us
Optimized for small size
Max detector size 256 x 256 pix
Max "exposure" time is 2^16 us = 65.535 ms (15.28 Hz)
Wavelength resolution set by keywords in frame:
LAMBDA_MIN, LAMBDA_MAX
lambda = LAMBDA_MIN + (LAMBDA_MAX-LAMBDA_MIN)/256*lambda_index
USAGE: An array of EVENT_UI8_UI8_UI16_UI8 is stored in the IMAGE structure
The array can be 1D (list of events), or 3D (N x 1 x M) for a circular buffer where the z-index (slice) is incremented between each "exposure"
md[0].cnt2 contains the number of events in the last slice written
Detection events do not have to be ordered
Write sequence in circular buffer :
- [1] create IMAGE structure type EVENT_UI8_UI8_UI16_UI8. Size n x 1 x m, where n = max # of event per "exposure", m = number of slices in circular buffer. Note that md[0].size[0]=m, md[0].size[1]=1, md[0].size[2]=m
- [2] set md[0].write=1 (start image write)
- [3] set k=md[0].cnt1=0 (slice index)
- [4] set md[0].cnt2=0 (# of events), ii=0 (event index in current slice)
- [5] store time in local variable (exposure start)
- [6] Write each event in array.EVENT_UI8_UI8_UI16_UI8[k*md[0].size[0]+ii]. After each event, increment ii (event index)
- [7] When "exposure" completed, set md[0].atime to exposure time start (see step [5]), md[0].cnt1=k (last slice written), md[0].cnt2=ii (number of events), set md[0].write=0 (write completed), increment md[0].cnt0, and post all semaphores
- [8] Increment k (if k=md[0].size[2], set k=0), return to step [4]
- Warning
- Array size will define the maximum number of events packed in IMAGE. User is responsible for pushing out IMAGE and starting a new IMAGE or slice when max number of events is reached.
This structure has a fixed size regardless of implementation
- Note
- size = 171 byte = 1368 bit
- an array of IMAGE_KEWORD structures
- an array of IMAGE_METADATA structures (usually only 1 element)
- Note
- size = 136 byte = 1088 bit
This structure has a fixed size regardless of implementation when packed
- Note
- size = 171 byte = 1368 bit when packed
union { ... } __attribute__::array |
data storage array
The array is declared as a union, so that multiple data types can be supported
For 2D image with pixel indices ii (x-axis) and jj (y-axis), the pixel values are stored as array.<TYPE>[ jj * md[0].size[0] + ii ]
image md[0].size[0] is x-axis size, md[0].size[1] is y-axis size
For 3D image with pixel indices ii (x-axis), jj (y-axis) and kk (z-axis), the pixel values are stored as array.<TYPE>[ kk * md[0].size[1] * md[0].size[0] + jj * md[0].size[0] + ii ]
image md[0].size[0] is x-axis size, md[0].size[1] is y-axis size, md[0].size[2] is z-axis size
- Note
- Up to this point, all members of the structure have a fixed memory offset to the start pointpointer to data array
union { ... } __attribute__::array |
data storage array
The array is declared as a union, so that multiple data types can be supported
For 2D image with pixel indices ii (x-axis) and jj (y-axis), the pixel values are stored as array.<TYPE>[ jj * md[0].size[0] + ii ]
image md[0].size[0] is x-axis size, md[0].size[1] is y-axis size
For 3D image with pixel indices ii (x-axis), jj (y-axis) and kk (z-axis), the pixel values are stored as array.<TYPE>[ kk * md[0].size[1] * md[0].size[0] + jj * md[0].size[0] + ii ]
image md[0].size[0] is x-axis size, md[0].size[1] is y-axis size, md[0].size[2] is z-axis size
- Note
- Up to this point, all members of the structure have a fixed memory offset to the start pointpointer to data array
union { ... } __attribute__::atime |
Acquisition time (beginning of exposure.
atime is defined as a union to ensure fixed 16-byte length regardless of struct timespec implementation
Data Type: struct timespec The struct timespec structure represents an elapsed time. It is declared in time.h and has the following members: time_t tv_sec This represents the number of whole seconds of elapsed time. long int tv_nsec This is the rest of the elapsed time (a fraction of a second), represented as the number of nanoseconds. It is always less than one billion.
On (most ?) 64-bit systems: sizeof(struct timespec) = 16 : sizeof(long int) = 8; sizeof(time_t) = 8
- Warning
- sizeof(struct timespec) is implementation-specific, and could be smaller that 16 byte. Users may need to create and manage their own timespec implementation if data needs to be portable across machines.
union { ... } __attribute__::atime |
Acquisition time (beginning of exposure.
atime is defined as a union to ensure fixed 16-byte length regardless of struct timespec implementation
Data Type: struct timespec The struct timespec structure represents an elapsed time. It is declared in time.h and has the following members: time_t tv_sec This represents the number of whole seconds of elapsed time. long int tv_nsec This is the rest of the elapsed time (a fraction of a second), represented as the number of nanoseconds. It is always less than one billion.
On (most ?) 64-bit systems: sizeof(struct timespec) = 16 : sizeof(long int) = 8; sizeof(time_t) = 8
- Warning
- sizeof(struct timespec) is implementation-specific, and could be smaller that 16 byte. Users may need to create and manage their own timespec implementation if data needs to be portable across machines.