Scope
scope::ScopeOverlay Class Reference

#include <ScopeOverlay.h>

Inherited by scope::ScopeOverlayResonanceSW.

Public Member Functions

 ScopeOverlay (const uint32_t &_lines=0, const uint32_t &_linewidth=0)
 
virtual void Create (ScopeMultiImageCPtr const _multi, const std::vector< ColorProps > &_color_props)
 
void ToD2Bitmap (ID2D1Bitmap *const _d2bitmap) const
 
void Resize (const uint32_t &_lines, const uint32_t &_linewidth)
 
uint32_t Lines () const
 
uint32_t Linewidth () const
 

Protected Attributes

uint32_t lines
 
uint32_t linewidth
 
std::vector< BGRA8Pixeloverlay
 
std::mutex mutex
 

Detailed Description

Overlay of several gray-scale/uint16_t channels into one BGRA8 image.

Thread-safe.

Definition at line 17 of file ScopeOverlay.h.

Constructor & Destructor Documentation

scope::ScopeOverlay::ScopeOverlay ( const uint32_t &  _lines = 0,
const uint32_t &  _linewidth = 0 
)

overlay will be initialized with 0s

Parameters
[in]_linesinitial y resolution
[in]_linewidthinitial x resolution

Definition at line 11 of file ScopeOverlay.cpp.

Member Function Documentation

void scope::ScopeOverlay::Create ( ScopeMultiImageCPtr const  _multi,
const std::vector< ColorProps > &  _color_props 
)
virtual

Creates an overlay from a multi image with the specified color properties per channel.

Parameters
[in]_multithe multi image to create overlay from
[in]_color_propsthe vector with the ColorProps for each channel

Alternative incarnations I had tried out... ~ 230 ms for 1024x1024 uint32_t size = overlay.size(); for ( uint32_t i = 0 ; i < size ; i++ ) overlay[i] += U16ToBGRA8Histo(pixel->at(i), col, ll, ul);

~1000ms for 1024x1024 This is 4x slower than the simple for loop (why?) auto itch = chimage->GetDataBeginConst(); std::for_each(std::begin(overlay), std::end(overlay), [&](BGRA8Pixel& pix) { pix += U16ToBGRA8Histo(*itch++, col, ll, ul); } ); several seconds (why??? to much overhead???) concurrency::parallel_transform(std::begin(overlay), std::end(overlay), it, std::begin(overlay), [&](BGRA8Pixel& pix, const uint16_t& gray) { return pix + U16ToBGRA8Histo(gray, col, ll, ul); } );

Definition at line 18 of file ScopeOverlay.cpp.

void scope::ScopeOverlay::ToD2Bitmap ( ID2D1Bitmap *const  _d2bitmap) const
Parameters
[in]_d2bitmappointer to the Direct2D bitmap to fill with the overlay

Definition at line 58 of file ScopeOverlay.cpp.

void scope::ScopeOverlay::Resize ( const uint32_t &  _lines,
const uint32_t &  _linewidth 
)
Parameters
[in]_lines,_linewidthnew size

Definition at line 66 of file ScopeOverlay.cpp.

uint32_t scope::ScopeOverlay::Lines ( ) const
Returns
lines/yres in overlay

Definition at line 74 of file ScopeOverlay.cpp.

uint32_t scope::ScopeOverlay::Linewidth ( ) const
Returns
linewidth/xres in overlay

Definition at line 79 of file ScopeOverlay.cpp.

Member Data Documentation

uint32_t scope::ScopeOverlay::lines
protected

number of lines, y resolution

Definition at line 21 of file ScopeOverlay.h.

uint32_t scope::ScopeOverlay::linewidth
protected

width of a line, x resolution

Definition at line 24 of file ScopeOverlay.h.

std::vector<BGRA8Pixel> scope::ScopeOverlay::overlay
protected

vector with pixeldata

Definition at line 27 of file ScopeOverlay.h.

std::mutex scope::ScopeOverlay::mutex
mutableprotected

mutex for protection

Definition at line 30 of file ScopeOverlay.h.


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