2 #include "PixelmapperFrameResonanceSW.h"
3 #include "parameters\Framescan.h"
4 #include "helpers\DaqChunkResonance.h"
5 #include "helpers\ScopeImage.h"
6 #include "helpers\ScopeMultiImageResonanceSW.h"
10 PixelmapperFrameResonanceSW::PixelmapperFrameResonanceSW()
11 : PixelmapperBasic(ScannerTypeHelper::Resonance, ScannerVectorTypeHelper::ResonanceBiDi)
16 PixelmapperResult result(Nothing);
18 const uint32_t multiplier = _currentavgcount;
19 const uint32_t divisor = std::max<uint32_t>(1, _currentavgcount + 1);
20 const uint32_t halfdivisor = std::max<uint32_t>(1, divisor >> 2);
24 const uint32_t xturnpixelsright = tmp->XTurnPixelsRight();
25 const uint32_t ximagepixels = tmp->XImagePixels();
26 const uint32_t cutofflines = tmp->YCutoffLines();
27 const uint32_t scanlines = tmp->YScanLines();
28 const uint32_t ytotallines = tmp->YTotalLines();
29 const uint32_t xtotalpixels = tmp->XTotalPixels();
30 const uint32_t totalpixels = tmp->TotalPixels();
31 const uint32_t totalimagepixels = tmp->XImagePixels()*tmp->YImageLines();
43 for ( uint32_t c = 0 ; c < _chunk->NChannels() ; c++ ) {
46 std::vector<uint16_t>*
const dataptr(imagedata.GetData());
49 std::vector<uint16_t>*
const averageddataptr(averagedimagedata.GetData());
52 chunkit = _chunk->lastmapped[c];
53 syncit = _chunk->lastsyncsig[c];
55 channelend = std::begin(_chunk->data)+(c+1)*_chunk->PerChannel();
66 }
while ( (chunkit+1 != channelend) && !( *syncit == 1 && *(syncit+1) == 0 ));
74 for ( i =
current_frame->LastX(c); (chunkit != channelend) && (i < (xtotalpixels - xturnpixelsright)); i++, syncit++, chunkit++ ) {
75 if ( (l >= cutofflines) && (l < scanlines) && (i >= xturnpixelsleft) ) {
77 dataptr->operator[](imagepos) = *chunkit;
80 n = (
static_cast<uint32_t
>(averageddataptr->operator[](imagepos)) * multiplier) + static_cast<uint32_t>(*chunkit);
81 averageddataptr->operator[](imagepos) = static_cast<uint16_t>( n / divisor + ((n%divisor)>halfdivisor?1u:0u) );
90 for ( i =
current_frame->LastX(c); chunkit != channelend; i++, syncit++, chunkit++ ) {
93 if ( (chunkit+1 != channelend) && ( *syncit == 1 && *(syncit+1) == 0 ) ) {
95 for ( uint32_t x = 0; x < ((i>=xtotalpixels-xturnpixelsright)?(xtotalpixels-xturnpixelsright):i); x++ ) {
96 if ( (l >= cutofflines) && (l < scanlines) && (x >= xturnpixelsleft) ) {
100 dataptr->operator[](imagepos) =
current_frame->CurrentLineData()->at(c).at(i - x - 1);
103 n = (
static_cast<uint32_t
>(averageddataptr->operator[](imagepos)) * multiplier) + static_cast<uint32_t>(
current_frame->CurrentLineData()->at(c).at(i - x - 1));
104 averageddataptr->operator[](imagepos) = static_cast<uint16_t>( n / divisor + ((n%divisor)>halfdivisor?1u:0u) );
116 if( chunkit == channelend ) {
118 result = PixelmapperResult(result | EndOfChunk);
121 if ( (l >= cutofflines) && (l < scanlines) ) {
123 imagepos = (l-cutofflines+2) * ximagepixels;
125 imagepos = (l-cutofflines+1) * ximagepixels;
127 forthline = !forthline;
131 _chunk->SetLastMapped(c, chunkit);
132 _chunk->SetLastSyncSig(c, syncit);
135 if ( l >= ytotallines ) {
141 result = PixelmapperResult(result | FrameComplete);
parameters::ScannerVectorFrameBasic * svparameters
current scanner vector parameter set (needs to be pointer for dynamic_cast in derived classes and bec...
ScopeMultiImageResonanceSWPtr current_frame
pointer to the current frame to be mapped into (for SW resonance mapping, different type than the one...
std::vector< bool >::iterator iteratorSync
Iterator over the sync vector.
std::vector< uint16_t >::iterator iterator
Iterator over the data vector.
Parameters for a ScannerVectorFrameResonance.
Gives RAII safe access (read&write) to the pixeldata of a ScopeImage.
void SetCurrentAveragedFrame(ScopeMultiImageResonanceSWPtr const _current_averaged_frame)
Sets pointer to the current averaged (displayed) frame to be mapped into.
This is the include file for standard system include files, or project specific include files that ar...
ScopeMultiImageResonanceSWPtr current_averaged_frame
pointer to the current averaged frame to be mapped into
PixelmapperResult LookupChunk(DaqChunkResonancePtr const _chunk, const uint16_t &_currentavgcount) override
Maps a chunk.
bool firstchunk
true only for mapping first chunk
uint32_t XTurnPixelsLeft() const