2 #include "PixelmapperFrameSaw.h"
3 #include "helpers/ScopeImage.h"
4 #include "helpers/ScopeMultiImage.h"
9 PixelmapperFrameSaw::PixelmapperFrameSaw()
10 : PixelmapperBasic(ScannerTypeHelper::Regular, ScannerVectorTypeHelper::Sawtooth) {
14 PixelmapperResult result(Nothing);
16 const uint32_t multiplier = _currentavgcount;
17 const uint32_t divisor = std::max<uint32_t>(1, _currentavgcount + 1);
18 const uint32_t halfdivisor = std::max<uint32_t>(1, divisor >> 2);
24 for ( uint32_t c = 0 ; c < _chunk->NChannels() ; c++ ) {
27 std::vector<uint16_t>*
const dataptr(imagedata.GetData());
29 chunkit = _chunk->lastmapped[c];
31 channelend = std::begin(_chunk->data)+(c+1)*_chunk->PerChannel();
35 auto lookupend = std::end(*
lookup);
36 for ( ; (lookit != lookupend) && (chunkit != channelend) ; lookit++, chunkit++ ) {
38 n = (
static_cast<uint32_t
>(dataptr->operator[](*lookit)) * multiplier) +
static_cast<uint32_t
>(*chunkit);
39 dataptr->operator[](*lookit) =
static_cast<uint16_t
>( n / divisor + ((n%divisor)>halfdivisor?1u:0u) );
42 _chunk->lastmapped[c] = chunkit;
45 if ( lookit ==
lookup->end() ) {
47 result = PixelmapperResult(result | FrameComplete);
52 if ( chunkit == channelend )
53 result = PixelmapperResult(result | EndOfChunk);
std::vector< uint16_t >::iterator iterator
Iterator over the data vector.
PixelmapperResult LookupChunk(DaqChunkPtr const _chunk, const uint16_t &_currentavgcount) override
Maps a chunk via the lookup vector.
Gives RAII safe access (read&write) to the pixeldata of a ScopeImage.
This is the include file for standard system include files, or project specific include files that ar...
std::shared_ptr< const std::vector< std::size_t > > lookup
for position lookup
ScopeMultiImagePtr current_frame
pointer to the current frame to be mapped into
std::vector< std::size_t >::const_iterator lastlookup
last position in lookup where we looked up last time
Various helper functions and classes for Scope.