From d13706c175ceaafcf7b4d89043739e06f7ed96f7 Mon Sep 17 00:00:00 2001 From: Jared Males Date: Sat, 11 Nov 2023 15:12:31 -0700 Subject: [PATCH] overhaul of raw data handling, now have local image for processing; fixed colorbars; started fixing sat handling; removed debug trace --- src/images/mzmqImage.cpp | 15 - src/rtimvBase.cpp | 567 +++++++++++++++++--------------------- src/rtimvBase.hpp | 31 ++- src/rtimvGraphicsView.hpp | 2 +- src/rtimvImage.hpp | 13 - src/rtimvMainWindow.cpp | 301 ++------------------ 6 files changed, 293 insertions(+), 636 deletions(-) diff --git a/src/images/mzmqImage.cpp b/src/images/mzmqImage.cpp index 7f192fa..0802530 100644 --- a/src/images/mzmqImage.cpp +++ b/src/images/mzmqImage.cpp @@ -314,11 +314,8 @@ void mzmqImage::imageThreadExec() if( nx != new_nx || ny != new_ny || atype != new_atype || !m_imageAttached) { - DEBUG_TRACE_CRUMB std::lock_guard guard(*m_accessMutex); - DEBUG_TRACE_CRUMB - if(m_data) //This can't be a call to detach due to mutex { m_imageAttached = false; @@ -375,8 +372,6 @@ void mzmqImage::imageThreadExec() xe = xrif_allocate(xrif); m_imageAttached = true; - - DEBUG_TRACE_CRUMB } atype = new_atype; @@ -511,32 +506,22 @@ int mzmqImage::update() void mzmqImage::detach() { - DEBUG_TRACE_ANCHOR(mzmqImage::detach begin) - std::lock_guard guard(*m_accessMutex); - DEBUG_TRACE_CRUMB - m_imageAttached = false; if(m_data) delete m_data; m_data = nullptr; m_lastCnt0 = -1; - - DEBUG_TRACE_ANCHOR(mzmqImage::detach end) } bool mzmqImage::valid() { - DEBUG_TRACE_ANCHOR(mzmqImage::valid begin) - if(m_data && m_imageAttached) { - DEBUG_TRACE_ANCHOR(mzmqImage::valid true) return true; } - DEBUG_TRACE_ANCHOR(mzmqImage::valid false) return false; } diff --git a/src/rtimvBase.cpp b/src/rtimvBase.cpp index 8b85702..77fe55f 100644 --- a/src/rtimvBase.cpp +++ b/src/rtimvBase.cpp @@ -32,7 +32,7 @@ void rtimvBase::startup(const std::vector &shkeys) { m_images.resize(4, nullptr); - for (size_t i = 0; i < m_images.size(); ++i) + for(size_t i = 0; i < m_images.size(); ++i) { if(shkeys.size() > i) { @@ -131,8 +131,6 @@ bool rtimvBase::imageValid(size_t n) void rtimvBase::setImsize(uint32_t x, uint32_t y) { - DEBUG_TRACE_ANCHOR(rtimvBase::setImsize start) - //Always have at least one pixel if(x == 0) x = 1; if(y == 0) y = 1; @@ -142,45 +140,34 @@ void rtimvBase::setImsize(uint32_t x, uint32_t y) m_nx = x; m_ny = y; - DEBUG_TRACE_VAL(m_nx) - DEBUG_TRACE_VAL(m_ny) - if(m_calData != nullptr) { - DEBUG_TRACE_CRUMB - delete[] m_calData; m_calData = nullptr; } - DEBUG_TRACE_CRUMB - + if(m_satData != nullptr) + { + delete[] m_satData; + m_satData = nullptr; + } + m_calData = new float[m_nx*m_ny]; + m_satData = new uint8_t[m_nx*m_ny]; if(m_qim != nullptr) { - DEBUG_TRACE_CRUMB - delete m_qim; m_qim = nullptr; } - DEBUG_TRACE_CRUMB - m_qim = new QImage(m_nx, m_ny, QImage::Format_Indexed8); - DEBUG_TRACE_CRUMB - load_colorbar(current_colorbar, false); //have to load into newly create image - DEBUG_TRACE_CRUMB - postSetImsize(); - DEBUG_TRACE_CRUMB } - - DEBUG_TRACE_ANCHOR(rtimvBase::setImsize end) } void rtimvBase::postSetImsize() @@ -200,8 +187,6 @@ uint32_t rtimvBase::ny() void rtimvBase::updateImages() { - DEBUG_TRACE_ANCHOR(rtimvBase::updateImages begin) - static bool connected = false; int doupdate = RTIMVIMAGE_NOUPDATE; @@ -209,13 +194,10 @@ void rtimvBase::updateImages() if(m_images[0] != nullptr) { - DEBUG_TRACE_CRUMB doupdate = m_images[0]->update(); } - DEBUG_TRACE_CRUMB - - for (size_t i = 1; i < m_images.size(); ++i) + for(size_t i = 1; i < m_images.size(); ++i) { if(m_images[i] != nullptr) { @@ -227,48 +209,32 @@ void rtimvBase::updateImages() } } - DEBUG_TRACE_CRUMB - if(doupdate >= RTIMVIMAGE_IMUPDATE || supportUpdate >= RTIMVIMAGE_IMUPDATE) { - DEBUG_TRACE_CRUMB - changeImdata(true); - DEBUG_TRACE_CRUMB - if(!connected) { - DEBUG_TRACE_CRUMB onConnect(); connected = true; - DEBUG_TRACE_CRUMB } } - DEBUG_TRACE_CRUMB if(!connected) { - DEBUG_TRACE_CRUMB updateNC(); - DEBUG_TRACE_ANCHOR(rtimvBase::updateImages early) return; } if(doupdate == RTIMVIMAGE_FPSUPDATE) { - DEBUG_TRACE_CRUMB updateFPS(); } - DEBUG_TRACE_CRUMB - if(doupdate == RTIMVIMAGE_AGEUPDATE) { updateAge(); } - - DEBUG_TRACE_ANCHOR(rtimvBase::updateImages end) } void rtimvBase::imageTimeout(int to) @@ -280,7 +246,7 @@ void rtimvBase::imageTimeout(int to) m_imageTimer.stop(); - for (size_t i = 0; i < m_images.size(); ++i) + for(size_t i = 0; i < m_images.size(); ++i) { if(m_images[i] != nullptr) { @@ -408,6 +374,13 @@ float rtimvBase::calPixel( uint32_t x, return m_calData[y * m_nx + x]; } +uint8_t rtimvBase::satPixel( uint32_t x, + uint32_t y + ) +{ + return m_satData[y * m_nx + x]; +} + // https://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color/56678483#56678483 template realT sRGBtoLinRGB(int rgb) @@ -443,74 +416,112 @@ void rtimvBase::load_colorbar( int cb, bool update ) { - DEBUG_TRACE_ANCHOR(rtimvBase::load_colorbar start) - if(!m_qim) { - DEBUG_TRACE_ANCHOR(rtimvBase::load_colorbar early-null) + return; } - if(m_qim) + current_colorbar = cb; + switch (cb) { - current_colorbar = cb; - switch (cb) + case colorbarJet: + m_minColor = 0; + m_maxColor = load_colorbar_jet(m_qim); + m_maskColor = m_maxColor + 1; + m_satColor = m_maxColor + 2; + m_nanColor = m_maskColor; + warning_color = QColor("white"); + break; + case colorbarHot: + m_minColor = 0; + m_maxColor = load_colorbar_hot(m_qim); + m_maskColor = m_maxColor + 1; + m_satColor = m_maxColor + 2; + m_nanColor = m_maskColor; + warning_color = QColor("cyan"); + break; + case colorbarBone: + m_minColor = 0; + m_maxColor = load_colorbar_bone(m_qim); + m_maskColor = m_maxColor + 1; + m_satColor = m_maxColor + 2; + m_nanColor = m_maskColor; + warning_color = QColor("red"); + break; + case colorbarRed: + m_minColor = 0; + m_maxColor = 253; + m_maskColor = m_maxColor + 1; + m_satColor = m_maxColor + 2; + m_nanColor = m_maskColor; + for(int i = m_minColor; i <= m_maxColor; i++) { - case colorbarJet: - m_minColor = 0; - m_maxColor = load_colorbar_jet(m_qim); - m_maskColor = m_maxColor + 1; - m_satColor = m_maxColor + 2; - m_nanColor = m_maskColor; - warning_color = QColor("white"); - break; - case colorbarHot: - m_minColor = 0; - m_maxColor = load_colorbar_hot(m_qim); - m_maskColor = m_maxColor + 1; - m_satColor = m_maxColor + 2; - m_nanColor = m_maskColor; - warning_color = QColor("cyan"); - break; - case colorbarBone: - m_minColor = 0; - m_maxColor = load_colorbar_bone(m_qim); - m_maskColor = m_maxColor + 1; - m_satColor = m_maxColor + 2; - m_nanColor = m_maskColor; - warning_color = QColor("lime"); - break; - default: - m_minColor = 0; - m_maxColor = 253; - m_maskColor = m_maxColor + 1; - m_satColor = m_maxColor + 2; - m_nanColor = m_maskColor; - for (int i = m_minColor; i <= m_maxColor; i++) - { - int c = (((float)i) / 253. * 255.) + 0.5; - m_qim->setColor(i, qRgb(c, c, c)); - } - m_qim->setColor(254, qRgb(0, 0, 0)); - m_qim->setColor(255, qRgb(255, 0, 0)); - - warning_color = QColor("lime"); - break; + int c = (((float)i) / 253. * 255.) + 0.5; + m_qim->setColor(i, qRgb(c, 0, 0)); } - - m_lightness.resize(256); - - for (int n = 0; n < 256; ++n) + m_qim->setColor(254, qRgb(0, 0, 0)); + m_qim->setColor(255, qRgb(0, 255, 0)); + warning_color = QColor("red"); + break; + case colorbarGreen: + m_minColor = 0; + m_maxColor = 253; + m_maskColor = m_maxColor + 1; + m_satColor = m_maxColor + 2; + m_nanColor = m_maskColor; + for(int i = m_minColor; i <= m_maxColor; i++) { - m_lightness[n] = QColor(m_qim->color(n)).lightness(); + int c = (((float)i) / 253. * 255.) + 0.5; + m_qim->setColor(i, qRgb(0, c, 0)); } - - if(update) + m_qim->setColor(254, qRgb(0, 0, 0)); + m_qim->setColor(255, qRgb(255, 0, 0)); + warning_color = QColor("red"); + break; + case colorbarBlue: + m_minColor = 0; + m_maxColor = 253; + m_maskColor = m_maxColor + 1; + m_satColor = m_maxColor + 2; + m_nanColor = m_maskColor; + for(int i = m_minColor; i <= m_maxColor; i++) { - changeImdata(); + int c = (((float)i) / 253. * 255.) + 0.5; + m_qim->setColor(i, qRgb(0, 0, c)); } + m_qim->setColor(254, qRgb(0, 0, 0)); + m_qim->setColor(255, qRgb(255, 0, 0)); + warning_color = QColor("red"); + break; + default: + m_minColor = 0; + m_maxColor = 253; + m_maskColor = m_maxColor + 1; + m_satColor = m_maxColor + 2; + m_nanColor = m_maskColor; + for(int i = m_minColor; i <= m_maxColor; i++) + { + int c = (((float)i) / 253. * 255.) + 0.5; + m_qim->setColor(i, qRgb(c, c, c)); + } + m_qim->setColor(254, qRgb(0, 0, 0)); + m_qim->setColor(255, qRgb(255, 0, 0)); + + warning_color = QColor("red"); + break; + } + + m_lightness.resize(256); + + for(int n = 0; n < 256; ++n) + { + m_lightness[n] = QColor(m_qim->color(n)).lightness(); } - DEBUG_TRACE_ANCHOR(rtimvBase::load_colorbar end) + if(update) + { + changeImdata(); + } } void rtimvBase::set_cbStretch(int ct) @@ -688,100 +699,90 @@ int calcPixIndex_square(float pixval, float mindat, float maxdat, int mincol, in void rtimvBase::changeImdata(bool newdata) { - DEBUG_TRACE_ANCHOR(rtimvBase::changeImdata start) - - float tmp_min; - float tmp_max; - - int idx; - float imval; + if(m_amChangingimdata) //this means we're already in this function! + { + return; + } if(m_images[0] == nullptr) { - DEBUG_TRACE_ANCHOR(rtimvBase::changeImdata early-null) return; } - DEBUG_TRACE_CRUMB - if(!m_images[0]->valid()) { - DEBUG_TRACE_ANCHOR(rtimvBase::changeImdata early-not-valid) return; } - DEBUG_TRACE_CRUMB + m_amChangingimdata = true; bool resized = false; //Here we realize we need to resize if(m_images[0]->nx() != m_nx || m_images[0]->ny() != m_ny || !m_qim) { - amChangingimdata = true; - - DEBUG_TRACE_CRUMB - //Need to lock a mutex here setImsize(m_images[0]->nx(), m_images[0]->ny()); - DEBUG_TRACE_CRUMB - resized = true; } - DEBUG_TRACE_CRUMB - if(resized || newdata) //need to copy new data to m_calData { - std::unique_lock lock(m_rawMutex); //, std::try_to_lock); - if(!lock.owns_lock()) - { - DEBUG_TRACE_ANCHOR(rtimvBase::changeImdata early-no-lock) - return; - } - - DEBUG_TRACE_CRUMB - + std::unique_lock lock(m_rawMutex); + // Get the pixel calculating function float (*_pixel)(rtimvBase *, size_t) = rawPixel(); if(_pixel == nullptr) { - DEBUG_TRACE_ANCHOR(rtimvBase::changeImdata early-null_pixel) + m_amChangingimdata = false; + return; } - DEBUG_TRACE_CRUMB - if(m_nx != m_images[0]->nx() || m_ny != m_images[0]->ny()) { - DEBUG_TRACE_ANCHOR(rtimvBase::changeImdata early-size-mismatch) + m_amChangingimdata = false; return; } - DEBUG_TRACE_CRUMB - for(uint64_t n=0; n < m_nx*m_ny; ++n) { + //Check for saturation + if(pixel_noCal(this,n) >= m_satLevel) + { + m_satData[n] = 1; + ++m_saturated; + } + else + { + m_satData[n] = 0; + } + + //Fill in calibrated value m_calData[n] = _pixel(this, n); } } - DEBUG_TRACE_CRUMB - if(resized || newdata || m_autoScale) { - DEBUG_TRACE_CRUMB - - // Need to set these at the beginning imdat_min = std::numeric_limits::max(); imdat_max = -std::numeric_limits::max(); - for (uint32_t i = 0; i < m_ny; ++i) + if(colorBoxActive) { - for (uint32_t j = 0; j < m_nx; ++j) + colorBox_min = std::numeric_limits::max(); + colorBox_max = -std::numeric_limits::max(); + } + + float imval; + + for(uint32_t j = 0; j < m_ny; ++j) + { + for(uint32_t i = 0; i < m_nx; ++i) { - imval = calPixel(j,i); + imval = calPixel(i,j); if(!std::isfinite(imval)) { @@ -790,12 +791,27 @@ void rtimvBase::changeImdata(bool newdata) if(imval > imdat_max) { - imdat_max = calPixel(j,i);//_pixel(this, i * m_nx + j); + imdat_max = imval; } if(imval < imdat_min) { - imdat_min = calPixel(j,i);//_pixel(this, i * m_nx + j); + imdat_min = imval; + } + + if(colorBoxActive) + { + if(i >= colorBox_i0 && i < colorBox_i1 && j >= colorBox_j0 && j < colorBox_j1) + { + if(imval < colorBox_min) + { + colorBox_min = imval; + } + if(imval > colorBox_max) + { + colorBox_max = imval; + } + } } } } @@ -807,26 +823,35 @@ void rtimvBase::changeImdata(bool newdata) imdat_min = 0; } - mindat(imdat_min); - maxdat(imdat_max); - } + if(colorBoxActive) + { + if(!std::isfinite(colorBox_max) || !std::isfinite(colorBox_min)) + { + // It should be impossible for them to be infinite by themselves unless it's all NaNs in the box. + colorBox_max = 0; + colorBox_min = 0; + } - DEBUG_TRACE_CRUMB + mindat(colorBox_min); + maxdat(colorBox_max); + } + else + { + mindat(imdat_min); + maxdat(imdat_max); + } + } if(!m_qim) { - amChangingimdata = false; + m_amChangingimdata = false; return; } - DEBUG_TRACE_CRUMB - - amChangingimdata = true; + /* Here is where we color the pixmap*/ - DEBUG_TRACE_CRUMB - // Get the color index calculating function int (*_index)(float, float, float, int, int); switch (m_cbStretch) @@ -847,169 +872,75 @@ void rtimvBase::changeImdata(bool newdata) _index = calcPixIndex_linear; } - DEBUG_TRACE_CRUMB - - if(!newdata && !resized) //This is just a recolor + if(m_mindat == m_maxdat) { - DEBUG_TRACE_CRUMB - if(m_mindat == m_maxdat) //Constant + float imval; + for(uint32_t i = 0; i < m_ny; ++i) { - for (uint32_t i = 0; i < m_ny; ++i) + for(uint32_t j = 0; j < m_nx; ++j) { - for (uint32_t j = 0; j < m_nx; ++j) + imval = calPixel(j,i); + if(!std::isfinite(imval)) { - m_qim->setPixel(j, m_ny - i - 1, 0); + m_qim->setPixel(j, m_ny - i - 1, m_nanColor); + continue; } - } - } - else - { - for (uint32_t i = 0; i < m_ny; ++i) - { - for (uint32_t j = 0; j < m_nx; ++j) - { - //idx = i * m_nx + j; - imval = calPixel(j,i);// _pixel(this, idx); - if(!std::isfinite(imval)) - { - m_qim->setPixel(j, m_ny - i - 1, m_nanColor); - continue; - } - m_qim->setPixel(j, m_ny - i - 1, _index(imval, m_mindat, m_maxdat, m_minColor, m_maxColor)); - } + m_qim->setPixel(j, m_ny - i - 1, 0); } } } else { - DEBUG_TRACE_CRUMB - - // Update statistics - tmp_min = std::numeric_limits::max(); - tmp_max = -std::numeric_limits::max(); - saturated = 0; - - if(colorBoxActive) - { - colorBox_min = std::numeric_limits::max(); - colorBox_max = -std::numeric_limits::max(); - } - - DEBUG_TRACE_CRUMB - - if(m_mindat == m_maxdat) + float imval; + for(uint32_t i = 0; i < m_ny; ++i) { - DEBUG_TRACE_CRUMB - - for (uint32_t i = 0; i < m_ny; ++i) + for(uint32_t j = 0; j < m_nx; ++j) { - for (uint32_t j = 0; j < m_nx; ++j) - { - //idx = i * m_nx + j; - imval = calPixel(j,i); //_pixel(this, idx); // m_imData[idx]; - - if(!std::isfinite(imval)) - { - m_qim->setPixel(j, m_ny - i - 1, m_nanColor); - continue; - } - - if(imval > tmp_max) - tmp_max = imval; - if(imval < tmp_min) - tmp_min = imval; + imval = calPixel(j,i); - if(imval >= sat_level) - saturated++; - - if(colorBoxActive) - { - if(i >= colorBox_i0 && i < colorBox_i1 && j >= colorBox_j0 && j < colorBox_j1) - { - if(imval < colorBox_min) - colorBox_min = imval; - if(imval > colorBox_max) - colorBox_max = imval; - } - } - m_qim->setPixel(j, m_ny - i - 1, 0); - } - } - } - else - { - DEBUG_TRACE_CRUMB - - for (uint32_t i = 0; i < m_ny; ++i) - { - for (uint32_t j = 0; j < m_nx; ++j) + if(!std::isfinite(imval)) { - imval = calPixel(j,i); - - if(!std::isfinite(imval)) - { - m_qim->setPixel(j, m_ny - i - 1, m_nanColor); - continue; - } - - if(imval > tmp_max) - tmp_max = imval; - if(imval < tmp_min) - tmp_min = imval; - - if(imval >= sat_level) - saturated++; - - if(colorBoxActive) - { - if(i >= colorBox_i0 && i < colorBox_i1 && j >= colorBox_j0 && j < colorBox_j1) - { - if(imval < colorBox_min) - colorBox_min = imval; - if(imval > colorBox_max) - colorBox_max = imval; - } - } - - int idxVal = _index(imval, m_mindat, m_maxdat, m_minColor, m_maxColor); - m_qim->setPixel(j, m_ny - i - 1, idxVal); + m_qim->setPixel(j, m_ny - i - 1, m_nanColor); + continue; } + + int idxVal = _index(imval, m_mindat, m_maxdat, m_minColor, m_maxColor); + m_qim->setPixel(j, m_ny - i - 1, idxVal); } } - - imdat_max = tmp_max; - imdat_min = tmp_min; } + - if(m_applyMask && m_images[2] != nullptr) + + if(m_applySatMask) { - if(m_images[2]->nx() == m_images[0]->nx() || m_images[2]->ny() == m_images[0]->ny()) + //Leave this here so later we can clean this up and move up to an image connection logical block + if(m_images[3] != nullptr) { - for (uint32_t i = 0; i < m_ny; ++i) + if(m_images[3]->nx() == m_images[0]->nx() || m_images[3]->ny() == m_images[0]->ny()) { - for (uint32_t j = 0; j < m_nx; ++j) + for(uint64_t n = 0; n < m_nx*m_ny; ++n) { - idx = i * m_nx + j; - if(m_images[2]->pixel(idx) == 0) - m_qim->setPixel(j, m_ny - i - 1, m_maskColor); + ///\todo yikes need safe way to get out the mask data here. This isn't mutexed. + + if(m_images[3]->pixel(n) == 1) + { + m_satData[n] = 1; + } } } } - } - if(m_applySatMask && m_images[3] != nullptr) - { - if(m_images[3]->nx() == m_images[0]->nx() || m_images[3]->ny() == m_images[0]->ny()) + for(uint32_t j = 0; j < m_ny; ++j) { - for (uint32_t i = 0; i < m_ny; ++i) + for(uint32_t i = 0; i < m_nx; ++i) { - for (uint32_t j = 0; j < m_nx; ++j) + if(satPixel(i,j) == 1) { - idx = i * m_nx + j; - if(m_images[3]->pixel(idx) == 1) - m_qim->setPixel(j, m_ny - i - 1, m_satColor); + m_qim->setPixel(i, m_ny - j - 1, m_satColor); } + } } } @@ -1023,11 +954,8 @@ void rtimvBase::changeImdata(bool newdata) } postChangeImdata(); - amChangingimdata = false; - - DEBUG_TRACE_ANCHOR(rtimvBase::changeImdata end) - + m_amChangingimdata = false; } //void rtimvBase::changeImdata(bool newdata) @@ -1038,10 +966,6 @@ void rtimvBase::postChangeImdata() void rtimvBase::zoomLevel(float zl) { - DEBUG_TRACE_ANCHOR(rtimvBase::zoomLevel begin) - - DEBUG_TRACE_VAL(zl) - if(zl < m_zoomLevelMin) { zl = m_zoomLevelMin; @@ -1054,11 +978,7 @@ void rtimvBase::zoomLevel(float zl) m_zoomLevel = zl; - DEBUG_TRACE_VAL(m_zoomLevel) - post_zoomLevel(); - - DEBUG_TRACE_ANCHOR(rtimvBase::zoomLevel end) } void rtimvBase::post_zoomLevel() @@ -1081,14 +1001,23 @@ void rtimvBase::setUserBoxActive(bool usba) } if(colorBox_i0 < 0) + { colorBox_i0 = 0; - if(colorBox_i0 >= (int64_t)m_nx) + } + else if(colorBox_i0 >= (int64_t) m_nx) + { colorBox_i0 = (int64_t)m_nx - (colorBox_i1 - colorBox_i0); + } if(colorBox_i1 <= 0) + { colorBox_i1 = 0 + (colorBox_i1 - colorBox_i0); - if(colorBox_i1 > (int64_t)m_nx) + } + + if(colorBox_i1 > (int64_t )m_nx) + { colorBox_i1 = (int64_t)m_nx - 1; + } if(colorBox_j0 > colorBox_j1) { @@ -1098,35 +1027,37 @@ void rtimvBase::setUserBoxActive(bool usba) } if(colorBox_j0 < 0) + { colorBox_j0 = 0; - if(colorBox_j0 >= (int64_t)m_nx) - colorBox_j0 = (int64_t)m_ny - (colorBox_j1 - colorBox_j0); + } + else if(colorBox_j0 >= (int64_t) m_nx) + { + colorBox_j0 = (int64_t) m_ny - (colorBox_j1 - colorBox_j0); + } if(colorBox_j1 <= 0) + { colorBox_j1 = 0 + (colorBox_j1 - colorBox_j0); - if(colorBox_j1 > (int64_t)m_ny) - colorBox_j1 = (int64_t)m_ny - 1; + } - /*{//mutex scope - std::unique_lock lock(m_rawMutex, std::try_to_lock); - if(!lock.owns_lock()) - { - return; - }*/ - - //pixelF _pixel = pixel(); + if(colorBox_j1 > (int64_t) m_ny) + { + colorBox_j1 = (int64_t) m_ny - 1; + } colorBox_min = std::numeric_limits::max(); colorBox_max = -std::numeric_limits::max(); - for (int i = colorBox_i0; i < colorBox_i1; i++) + + for(int i = colorBox_i0; i < colorBox_i1; i++) { - for (int j = colorBox_j0; j < colorBox_j1; j++) + for(int j = colorBox_j0; j < colorBox_j1; j++) { - //idx = j * m_nx + i; - imval = calPixel(j,i); //_pixel(this, idx); // m_imData[idx]; + imval = calPixel(i,j); if(!std::isfinite(imval)) + { continue; + } if(imval < colorBox_min) colorBox_min = imval; @@ -1134,7 +1065,6 @@ void rtimvBase::setUserBoxActive(bool usba) colorBox_max = imval; } } - //} //release mutex here. if(colorBox_min == std::numeric_limits::max() && colorBox_max == -std::numeric_limits::max()) // If all nans { @@ -1144,11 +1074,16 @@ void rtimvBase::setUserBoxActive(bool usba) mindat(colorBox_min); maxdat(colorBox_max); + colorBoxActive = usba; + set_colorbar_mode(minmaxbox); + changeImdata(false); + return; } + colorBoxActive = usba; } diff --git a/src/rtimvBase.hpp b/src/rtimvBase.hpp index 4471bdb..ae10b69 100644 --- a/src/rtimvBase.hpp +++ b/src/rtimvBase.hpp @@ -195,6 +195,7 @@ protected slots: bool m_applySatMask {false}; float * m_calData {nullptr}; + uint8_t * m_satData {nullptr}; ///Mutex for locking access to memory std::mutex m_rawMutex; @@ -261,6 +262,10 @@ protected slots: uint32_t y ); + uint8_t satPixel( uint32_t x, + uint32_t y + ); + ///@} /** @name Colorbar Selection @@ -396,26 +401,24 @@ protected slots: QPixmap m_qpm; /// -//#define DEBUG_TRACE - -#ifdef DEBUG_TRACE -#define DEBUG_TRACE_CRUMB std::cerr << __FILE__ << " " << __LINE__ << std::endl; -#define DEBUG_TRACE_ANCHOR(anchor) std::cerr << __FILE__ << " " << __LINE__ << " " << #anchor << std::endl; -#define DEBUG_TRACE_VAL(val) std::cerr << __FILE__ << " " << __LINE__ << " " << #val << "=" << val << std::endl; -#else -#define DEBUG_TRACE_CRUMB -#define DEBUG_TRACE_ANCHOR(anchor) -#define DEBUG_TRACE_VAL(val) -#endif - - #define RTIMVIMAGE_NOUPDATE (0) #define RTIMVIMAGE_AGEUPDATE (1) #define RTIMVIMAGE_IMUPDATE (2) diff --git a/src/rtimvMainWindow.cpp b/src/rtimvMainWindow.cpp index d5cda04..516b4d7 100644 --- a/src/rtimvMainWindow.cpp +++ b/src/rtimvMainWindow.cpp @@ -148,22 +148,20 @@ rtimvMainWindow::~rtimvMainWindow() void rtimvMainWindow::setupConfig() { config.add("image.key", "", "image.key", argType::Required, "image", "key", false, "string", "The main image key. Specifies the protocol, location, and name of the main image."); - config.add("image.shmim_name", "", "image.shmim_name", argType::Required, "image", "shmim_name", false, "string", "Same as image.key. Deprecated -- do not use for new configs."); config.add("dark.key", "", "dark.key", argType::Required, "dark", "key", false, "string", "The dark image key. Specifies the protocol, location, and name of the dark image."); - config.add("dark.shmim_name", "", "dark.shmim_name", argType::Required, "dark", "shmim_name", false, "string", "Same as dark.key. Deprecated -- do not use for new configs."); config.add("mask.key", "", "mask.key", argType::Required, "mask", "key", false, "string", "The mask image key. Specifies the protocol, location, and name of the mask image."); - config.add("mask.shmim_name", "", "mask.shmim_name", argType::Required, "mask", "shmim_name", false, "string", "Same as mask.key. Deprecated -- do not use for new configs."); config.add("satMask.key", "", "satMask.key", argType::Required, "satMask", "key", false, "string", "The saturation mask image key. Specifies the protocol, location, and name of the saturation mask image."); - config.add("satMask.shmim_name", "", "satMask.shmim_name", argType::Required, "satMask", "shmim_name", false, "string", "Same as satMask.key. Deprecated -- do not use for new configs."); - + config.add("autoscale", "", "autoscale", argType::True, "", "autoscale", false, "bool", "Set to turn autoscaling on at startup"); config.add("nofpsgage", "", "nofpsgage", argType::True, "", "nofpsgage", false, "bool", "Set to turn the fps gage off at startup"); - config.add("darksub", "", "darksub", argType::True, "", "darksub", false, "bool", "Set to false to turn off on at startup. If a dark is supplied, darksub is otherwise on."); + config.add("darksub", "", "darksub", argType::True, "", "darksub", false, "bool", "Set to false to turn off dark subtraction at startup. If a dark is supplied, darksub is otherwise on."); config.add("targetXc", "", "targetXc", argType::Required, "", "targetXc", false, "float", "The fractional x-coordinate of the target, 0<= x <=1"); config.add("targetYc", "", "targetYc", argType::Required, "", "targetYc", false, "float", "The fractional y-coordinate of the target, 0<= y <=1"); + config.add("satLevel", "", "satLevel", argType::Required, "", "satLevel", false, "float", "The saturation level for this camera"); + config.add("masksat", "", "masksat", argType::True, "", "masksat", false, "bool", "Set to false to turn off sat-masking at startup. If a satMaks is supplied, masksat is otherwise on."); config.add("mouse.pointerCoords", "", "mouse.pointerCoords", argType::Required, "mouse", "pointerCoords", false, "bool", "Show or don't show the pointer coordinates. Default is true."); config.add("mouse.staticCoords", "", "mouse.staticCoords", argType::Required, "mouse", "staticCoords", false, "bool", "Show or don't show the static coordinates at bottom of display. Default is false."); @@ -197,17 +195,13 @@ void rtimvMainWindow::loadConfig() //Check for use of deprecated shmim_name keyword by itself, but use key if available - if(!config.isSet("image.key")) config(imKey, "image.shmim_name"); - else config(imKey, "image.key"); + config(imKey, "image.key"); - if(!config.isSet("dark.key")) config(darkKey, "dark.shmim_name"); - else config(darkKey, "dark.key"); + config(darkKey, "dark.key"); - if(!config.isSet("mask.key")) config(maskKey, "mask.shmim_name"); - else config(maskKey, "mask.key"); + config(maskKey, "mask.key"); - if(!config.isSet("satMask.key")) config(satMaskKey, "satMask.shmim_name"); - else config(satMaskKey, "satMask.key"); + config(satMaskKey, "satMask.key"); //Populate the key vector, a "" means no image specified keys.resize(4); @@ -254,6 +248,19 @@ void rtimvMainWindow::loadConfig() config(m_targetXc, "targetXc"); config(m_targetYc, "targetYc"); + float satLevelDefault = m_satLevel; + config(m_satLevel, "satLevel"); + + //If we set a sat level or mask, apply it + if(m_satLevel != satLevelDefault || satMaskKey != "") + { + m_applySatMask = true; + } + + //except turn it off if requested + config(m_applySatMask, "masksat"); + + config(m_showToolTipCoords, "mouse.pointerCoords"); config(m_showStaticCoords, "mouse.staticCoords"); @@ -265,47 +272,30 @@ void rtimvMainWindow::loadConfig() void rtimvMainWindow::onConnect() { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::onConnect begin) - setWindowTitle(m_title.c_str()); - DEBUG_TRACE_CRUMB - squareDown(); - - DEBUG_TRACE_ANCHOR(rtimvMainWindow::onConnect end) } void rtimvMainWindow::postSetImsize() { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::postSetImsize begin) - m_screenZoom = std::min( (float) ui.graphicsView->viewport()->width()/(float)m_nx, (float)ui.graphicsView->viewport()->height()/(float)m_ny ); - DEBUG_TRACE_VAL(m_screenZoom) - if(m_qpmi) { - DEBUG_TRACE_CRUMB delete m_qpmi; m_qpmi = nullptr; } - DEBUG_TRACE_CRUMB - if(imcp) { - DEBUG_TRACE_CRUMB - QTransform transform; float viewZoom = (float)imcp->ui.viewView->width()/(float)m_nx; transform.scale(viewZoom, viewZoom); imcp->ui.viewView->setTransform(transform); } - - DEBUG_TRACE_CRUMB //resize the boxes float w; @@ -352,62 +342,39 @@ void rtimvMainWindow::postSetImsize() sl->setPenWidth(2*RTIMV_TOOLLINEWIDTH_DEFAULT /m_screenZoom); ++ulit; } - - DEBUG_TRACE_CRUMB setTarget(); - - DEBUG_TRACE_ANCHOR(rtimvMainWindow::postSetImsize end) } void rtimvMainWindow::post_zoomLevel() { - DEBUG_TRACE_ANCHOR(rtimvBase::post_zoomLevel begin) - QTransform transform; - DEBUG_TRACE_VAL(m_screenZoom) - ui.graphicsView->screenZoom(m_screenZoom); - DEBUG_TRACE_VAL(m_screenZoom) - transform.scale(m_zoomLevel*m_screenZoom, m_zoomLevel*m_screenZoom); - DEBUG_TRACE_VAL(transform.m11()) - ui.graphicsView->setTransform(transform); - DEBUG_TRACE_CRUMB - if(imcp) { - DEBUG_TRACE_CRUMB transform.scale(pointerOverZoom, pointerOverZoom); imcp->ui.pointerView->setTransform(transform); } - DEBUG_TRACE_CRUMB change_center(); - DEBUG_TRACE_CRUMB char zlstr[16]; snprintf(zlstr,16, "%0.1fx", m_zoomLevel); ui.graphicsView->zoomText(zlstr); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - - DEBUG_TRACE_ANCHOR(rtimvBase::post_zoomLevel end) - } void rtimvMainWindow::postChangeImdata() { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::postChangeImdata begin) - - if(saturated) + if(m_saturated && !m_applySatMask) { ui.graphicsView->warningText("Saturated!"); } @@ -416,29 +383,18 @@ void rtimvMainWindow::postChangeImdata() ui.graphicsView->warningText(""); } - DEBUG_TRACE_CRUMB - if(!m_qpmi) //This happens on first time through { - DEBUG_TRACE_CRUMB m_qpmi = m_qgs->addPixmap(m_qpm); - DEBUG_TRACE_VAL(m_qpmi) - //So we need to initialize the viewport center, etc. - DEBUG_TRACE_CRUMB center(); - DEBUG_TRACE_CRUMB } else { - DEBUG_TRACE_CRUMB m_qpmi->setPixmap(m_qpm); - DEBUG_TRACE_CRUMB } - DEBUG_TRACE_CRUMB - if(m_colorBox) m_qpmi->stackBefore(m_colorBox); if(m_statsBox) m_qpmi->stackBefore(m_statsBox); if(m_objCenH) m_qpmi->stackBefore(m_objCenH); @@ -447,11 +403,8 @@ void rtimvMainWindow::postChangeImdata() if(m_northArrow) m_qpmi->stackBefore(m_northArrow); if(m_northArrowTip) m_qpmi->stackBefore(m_northArrowTip); - DEBUG_TRACE_CRUMB - if(imcp) { - DEBUG_TRACE_CRUMB if(imcp->ViewViewMode == ViewViewEnabled) { if(!imcp->qpmi_view) imcp->qpmi_view = imcp->qgs_view->addPixmap(m_qpm); @@ -461,28 +414,18 @@ void rtimvMainWindow::postChangeImdata() } } - DEBUG_TRACE_CRUMB - updateMouseCoords(); //This is to update the pixel val box if set. - DEBUG_TRACE_CRUMB - if(imcp) { - DEBUG_TRACE_CRUMB imcp->update_panel(); } - DEBUG_TRACE_CRUMB - if(imStats) { - DEBUG_TRACE_CRUMB imStats->setImdata(); } - DEBUG_TRACE_ANCHOR(rtimvMainWindow::postChangeImdata end) - } void rtimvMainWindow::launchControlPanel() @@ -501,11 +444,8 @@ void rtimvMainWindow::launchControlPanel() void rtimvMainWindow::centerNorthArrow() { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::centerNorthArrow begin) - if(m_northArrow && m_northArrowTip) { - DEBUG_TRACE_CRUMB m_northArrow->setLine(ui.graphicsView->xCen(), ui.graphicsView->yCen()-.1*m_ny/m_zoomLevel, ui.graphicsView->xCen(), ui.graphicsView->yCen()+.1*m_ny/m_zoomLevel); m_northArrow->setTransformOriginPoint ( QPointF(ui.graphicsView->xCen(),ui.graphicsView->yCen()) ); @@ -523,25 +463,17 @@ void rtimvMainWindow::centerNorthArrow() m_northArrowTip->setPen(qp); } - DEBUG_TRACE_CRUMB - updateNorthArrow(); - - DEBUG_TRACE_ANCHOR(rtimvMainWindow::centerNorthArrow end) } void rtimvMainWindow::updateNorthArrow() { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::updateNorthArrow begin) - if(m_northArrow && m_northArrowTip) { float ang = northAngle(); m_northArrow->setRotation(ang); m_northArrowTip->setRotation(ang); } - - DEBUG_TRACE_ANCHOR(rtimvMainWindow::updateNorthArrow end) } float rtimvMainWindow::northAngle() @@ -614,23 +546,12 @@ void rtimvMainWindow::setPointerOverZoom(float poz) void rtimvMainWindow::change_center(bool movezoombox) { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::change_center begin) - - DEBUG_TRACE_VAL(ui.graphicsView->xCen()); - DEBUG_TRACE_VAL(ui.graphicsView->yCen()); - ui.graphicsView->centerOn((qreal) ui.graphicsView->xCen(), (qreal) ui.graphicsView->yCen()); - DEBUG_TRACE_CRUMB - centerNorthArrow(); - DEBUG_TRACE_CRUMB - if(imcp) { - DEBUG_TRACE_CRUMB - imcp->viewLineVert->setLine(ui.graphicsView->xCen(), 0, ui.graphicsView->xCen(), m_ny); imcp->viewLineHorz->setLine(0, ui.graphicsView->yCen(), m_nx, ui.graphicsView->yCen()); @@ -649,70 +570,43 @@ void rtimvMainWindow::change_center(bool movezoombox) imcp->update_panel(); } - DEBUG_TRACE_ANCHOR(rtimvMainWindow::change_center end) - } void rtimvMainWindow::set_viewcen(float x, float y, bool movezoombox) { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::set_viewcen begin) - if(m_qpmi == nullptr) { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::set_viewcen early-null) return; } - DEBUG_TRACE_CRUMB - - DEBUG_TRACE_VAL(x) - DEBUG_TRACE_VAL(y) - DEBUG_TRACE_VAL(m_qpmi->boundingRect().width()) - DEBUG_TRACE_VAL(m_qpmi->boundingRect().height()) - QPointF sp( x* m_qpmi->boundingRect().width(), y*m_qpmi->boundingRect().height() ); - DEBUG_TRACE_CRUMB - QPointF vp = ui.graphicsView->mapFromScene(sp); - DEBUG_TRACE_CRUMB - ui.graphicsView->mapCenterToScene(vp.x(), vp.y()); - DEBUG_TRACE_CRUMB - change_center(movezoombox); - - DEBUG_TRACE_ANCHOR(rtimvMainWindow::set_viewcen end) } void rtimvMainWindow::squareDown() { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::squareDown begin) - double imrat = ((double)nx())/ny(); double winrat = ((double) width())/height(); ///\todo make threshold responsive to current dimensions so we don't enter loops. if( fabs( 1.0 - imrat/winrat) < 0.01) { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::squareDown noop) return; } if(width() <= height()) { - DEBUG_TRACE_CRUMB resize(width(), width()/imrat); } else { - DEBUG_TRACE_CRUMB resize(height()*imrat, height()); } - - DEBUG_TRACE_ANCHOR(rtimvMainWindow::squareDown end) } void rtimvMainWindow::squareUp() @@ -738,28 +632,20 @@ void rtimvMainWindow::squareUp() void rtimvMainWindow::resizeEvent(QResizeEvent *) { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::resizeEvent begin) - if(m_nx == 0 || m_ny == 0) { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::resizeEvent early) ui.graphicsView->setGeometry(0,0,width(), height()); return; } m_screenZoom = std::min((float)width()/(float)m_nx,(float)height()/(float)m_ny); - DEBUG_TRACE_VAL(m_screenZoom) - change_center(); ui.graphicsView->setGeometry(0,0,width(), height()); - DEBUG_TRACE_CRUMB - post_zoomLevel(); - DEBUG_TRACE_ANCHOR(rtimvMainWindow::resizeEvent end) } void rtimvMainWindow::mouseMoveEvent(QMouseEvent *e) @@ -789,55 +675,33 @@ void rtimvMainWindow::nullMouseCoords() void rtimvMainWindow::updateMouseCoords() { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::updateMouseCoords begin) - - /*std::unique_lock lock(m_accessMutex, std::try_to_lock); - if(!lock.owns_lock()) - { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::updateMouseCoords no-lock) - return; - }*/ - int64_t idx_x, idx_y; //image size are uint32_t, so this allows signed comparison without overflow issues if(!m_qpmi) return; - DEBUG_TRACE_CRUMB - if(ui.graphicsView->mouseViewX() < 0 || ui.graphicsView->mouseViewY() < 0) { - DEBUG_TRACE_CRUMB nullMouseCoords(); } - DEBUG_TRACE_CRUMB - QPointF pt = ui.graphicsView->mapToScene(ui.graphicsView->mouseViewX(),ui.graphicsView->mouseViewY()); - DEBUG_TRACE_CRUMB float mx = pt.x(); float my = pt.y(); if( mx < 0 || mx > m_qpmi->boundingRect().width() || my < 0 || my > m_qpmi->boundingRect().height() ) { - DEBUG_TRACE_CRUMB nullMouseCoords(); } if(m_userItemSelected) { - DEBUG_TRACE_CRUMB nullMouseCoords(); - DEBUG_TRACE_CRUMB userItemMouseCoords(m_userItemMouseViewX, m_userItemMouseViewY); } - DEBUG_TRACE_CRUMB - if(!m_nullMouseCoords) { - DEBUG_TRACE_CRUMB - idx_x = ((int64_t)(mx-0)); if(idx_x < 0) idx_x = 0; if(idx_x > (int64_t) m_nx-1) idx_x = m_nx-1; @@ -847,32 +711,8 @@ void rtimvMainWindow::updateMouseCoords() if(idx_y < 0) idx_y = 0; if(idx_y > (int64_t) m_ny-1) idx_y = m_ny-1; - DEBUG_TRACE_CRUMB -/* - //pixelF _pixel = nullptr; - float val = 0; - - DEBUG_TRACE_CRUMB - //_pixel = pixel(); - - DEBUG_TRACE_CRUMB - - if(_pixel != nullptr) - { - DEBUG_TRACE_CRUMB - DEBUG_TRACE_VAL(m_nx) - DEBUG_TRACE_VAL(m_images[0]->nx()); - DEBUG_TRACE_VAL(m_ny) - DEBUG_TRACE_VAL(m_images[0]->ny()); - DEBUG_TRACE_VAL(idx_x) - DEBUG_TRACE_VAL(idx_y) - val = _pixel(this, (int)(idx_y*m_nx) + (int)(idx_x)); - } -*/ float val = calPixel(idx_x, idx_y); - DEBUG_TRACE_CRUMB - if(m_showStaticCoords) { ui.graphicsView->textCoordX(mx-0.5); @@ -880,12 +720,8 @@ void rtimvMainWindow::updateMouseCoords() ui.graphicsView->textPixelVal( val ); } - DEBUG_TRACE_CRUMB - if(m_showToolTipCoords) { - DEBUG_TRACE_CRUMB - char valStr[32]; char posStr[32]; @@ -899,28 +735,19 @@ void rtimvMainWindow::updateMouseCoords() } snprintf(posStr, sizeof(posStr), "%0.2f %0.2f", mx-0.5, m_qpmi->boundingRect().height() - my-0.5 ); ui.graphicsView->showMouseToolTip(valStr, posStr, QPoint(ui.graphicsView->mouseViewX(),ui.graphicsView->mouseViewY())); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_mouseCoords); - DEBUG_TRACE_CRUMB } - DEBUG_TRACE_CRUMB - if(imcp) { - DEBUG_TRACE_CRUMB imcp->updateMouseCoords(mx, my, val ); } } - DEBUG_TRACE_CRUMB - //Adjust bias and contrast if(rightClickDragging) { - DEBUG_TRACE_CRUMB - float dx = ui.graphicsView->mouseViewX() - rightClickStart.x(); float dy = ui.graphicsView->mouseViewY() - rightClickStart.y(); @@ -929,10 +756,9 @@ void rtimvMainWindow::updateMouseCoords() bias(biasStart + dbias*.5*(imdat_max+imdat_min)); contrast(contrastStart + dcontrast*(imdat_max-imdat_min)); - if(!amChangingimdata) changeImdata(); + if(!m_amChangingimdata) changeImdata(); } - DEBUG_TRACE_ANCHOR(rtimvMainWindow::updateMouseCoords end) } //rtimvMainWindow::updateMouseCoords bool rtimvMainWindow::showToolTipCoords() @@ -1013,10 +839,8 @@ void rtimvMainWindow::updateFPS() void rtimvMainWindow::updateAge() { - //Check the font luminance to make sure it is visibleDEBUG_TRACE_CRUMB - DEBUG_TRACE_CRUMB + //Check the font luminance to make sure it is visible fontLuminance(); - DEBUG_TRACE_CRUMB if(m_showFPSGage && m_images[0] != nullptr ) @@ -1084,9 +908,7 @@ void rtimvMainWindow::userBoxItemSize(StretchBox * sb) ui.graphicsView->m_userItemSize->resize(textSize.width()+5,textSize.height()+5); ui.graphicsView->m_userItemSize->move(qr.x(), qr.y()); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_userItemSize); - DEBUG_TRACE_CRUMB } void rtimvMainWindow::userBoxItemCoords(StretchBox * sb) @@ -1122,9 +944,7 @@ void rtimvMainWindow::userCircleItemSize(StretchCircle * sc) ui.graphicsView->m_userItemSize->resize(textSize.width()+5,textSize.height()+5); ui.graphicsView->m_userItemSize->move(qr.x(), qr.y()); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_userItemSize); - DEBUG_TRACE_CRUMB } void rtimvMainWindow::userCircleItemCoords(StretchCircle * sc) @@ -1198,12 +1018,8 @@ void rtimvMainWindow::userItemMouseCoords( float mx, QSize textSize = fm.size(0, str.c_str()); ui.graphicsView->m_userItemMouseCoords->setGeometry(mx, my, textSize.width()+5,textSize.height()+5); - DEBUG_TRACE_CRUMB - fontLuminance(ui.graphicsView->m_userItemMouseCoords); - DEBUG_TRACE_CRUMB - } void rtimvMainWindow::userBoxItemMouseCoords(StretchBox * sb) @@ -1375,16 +1191,12 @@ void rtimvMainWindow::targetVisible(bool tv) if(tv) { ui.graphicsView->zoomText("target on"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } else { ui.graphicsView->zoomText("target off"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } } m_targetVisible = tv; @@ -2004,16 +1816,12 @@ void rtimvMainWindow::setAutoScale( bool as ) if(m_autoScale) { ui.graphicsView->zoomText("autoscale on"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } else { ui.graphicsView->zoomText("autoscale off"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } } @@ -2031,23 +1839,13 @@ void rtimvMainWindow::toggleAutoScale() void rtimvMainWindow::center() { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::center begin) - set_viewcen(.5, .5); - DEBUG_TRACE_CRUMB - post_zoomLevel(); - DEBUG_TRACE_CRUMB - ui.graphicsView->zoomText("centered"); - DEBUG_TRACE_CRUMB - fontLuminance(ui.graphicsView->m_zoomText); - - DEBUG_TRACE_ANCHOR(rtimvMainWindow::center begin) } void rtimvMainWindow::toggleColorBox() @@ -2088,9 +1886,7 @@ void rtimvMainWindow::toggleColorBox() setUserBoxActive(true); } ui.graphicsView->zoomText("color box scale"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } else { @@ -2104,9 +1900,7 @@ void rtimvMainWindow::toggleColorBox() setUserBoxActive(false); } ui.graphicsView->zoomText("global scale"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } } @@ -2135,9 +1929,7 @@ void rtimvMainWindow::toggleStatsBox() { doHideStatsBox(); ui.graphicsView->zoomText("stats off"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB if(imcp) { imcp->statsBoxButtonState = false; @@ -2148,9 +1940,7 @@ void rtimvMainWindow::toggleStatsBox() { doLaunchStatsBox(); ui.graphicsView->zoomText("stats on"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB if(imcp) { imcp->statsBoxButtonState = true; @@ -2176,18 +1966,14 @@ void rtimvMainWindow::toggleNorthArrow() m_northArrow->setVisible(false); m_northArrowTip->setVisible(false); ui.graphicsView->zoomText("North Off"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } else { m_northArrow->setVisible(true); m_northArrowTip->setVisible(true); ui.graphicsView->zoomText("North On"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } } @@ -2198,17 +1984,13 @@ void rtimvMainWindow::showFPSGage( bool sfg ) if(m_showFPSGage) { ui.graphicsView->zoomText("fps gage on"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } else { ui.graphicsView->fpsGageText(""); ui.graphicsView->zoomText("fps gage off"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } } @@ -2230,16 +2012,12 @@ void rtimvMainWindow::setDarkSub( bool ds ) if(m_subtractDark) { ui.graphicsView->zoomText("dark sub. on"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } else { ui.graphicsView->zoomText("dark sub. off"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } changeImdata(false); } @@ -2262,16 +2040,12 @@ void rtimvMainWindow::setApplyMask( bool am ) if(m_applyMask) { ui.graphicsView->zoomText("mask on"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } else { ui.graphicsView->zoomText("mask off"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } changeImdata(false); } @@ -2294,16 +2068,12 @@ void rtimvMainWindow::setApplySatMask( bool as ) if(m_applySatMask) { ui.graphicsView->zoomText("sat mask on"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } else { ui.graphicsView->zoomText("sat mask off"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } changeImdata(false); @@ -2330,17 +2100,13 @@ void rtimvMainWindow::toggleLogLinear() { set_cbStretch(stretchLinear); ui.graphicsView->zoomText("linear stretch"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } else { set_cbStretch(stretchLog); ui.graphicsView->zoomText("log stretch"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } } @@ -2350,17 +2116,13 @@ void rtimvMainWindow::toggleTarget() { targetVisible(false); ui.graphicsView->zoomText("target off"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } else { targetVisible(true); ui.graphicsView->zoomText("target on"); - DEBUG_TRACE_CRUMB fontLuminance(ui.graphicsView->m_zoomText); - DEBUG_TRACE_CRUMB } } @@ -2594,15 +2356,6 @@ void rtimvMainWindow::fontLuminance( QTextEdit* qte, bool print ) { - /*std::unique_lock lock(m_accessMutex, std::try_to_lock); - if(!lock.owns_lock()) - { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::fontLuminance early-no-lock) - return; - }*/ - - DEBUG_TRACE_ANCHOR(rtimvMainWindow::fontLuminance(QTextEdit *, bool) begin) - QPointF ptul = ui.graphicsView->mapToScene(qte->x(),qte->y()); QPointF ptlr = ui.graphicsView->mapToScene(qte->x()+qte->width(),qte->y()+qte->height()); @@ -2650,16 +2403,12 @@ void rtimvMainWindow::fontLuminance( QTextEdit* qte, qte->setTextBackgroundColor(QColor(0,0,0,m_opacityMax)); } - DEBUG_TRACE_ANCHOR(rtimvMainWindow::fontLuminance(QTextEdit *, bool) end) - return; } void rtimvMainWindow::fontLuminance() { - DEBUG_TRACE_ANCHOR(rtimvMainWindow::fontLuminance() begin) - fontLuminance(ui.graphicsView->m_fpsGage); fontLuminance(ui.graphicsView->m_zoomText); @@ -2686,8 +2435,6 @@ void rtimvMainWindow::fontLuminance() fontLuminance(ui.graphicsView->m_saveBox); - DEBUG_TRACE_ANCHOR(rtimvMainWindow::fontLuminance() end) - return; }