Support display of range folded values

This commit is contained in:
Dan Paulat 2021-11-13 21:24:17 -06:00
parent 73d2b8323b
commit e58b1f5b57
3 changed files with 28 additions and 13 deletions

View file

@ -15,8 +15,9 @@ namespace view
static const std::string logPrefix_ = "[scwx::qt::view::level2_product_view] "; static const std::string logPrefix_ = "[scwx::qt::view::level2_product_view] ";
static constexpr uint32_t VERTICES_PER_BIN = 6; static constexpr uint16_t RANGE_FOLDED = 1u;
static constexpr uint32_t VALUES_PER_VERTEX = 2; static constexpr uint32_t VERTICES_PER_BIN = 6u;
static constexpr uint32_t VALUES_PER_VERTEX = 2u;
static const std::unordered_map<common::Level2Product, static const std::unordered_map<common::Level2Product,
wsr88d::rda::DataBlockType> wsr88d::rda::DataBlockType>
@ -188,22 +189,22 @@ void Level2ProductView::UpdateColorTable()
case common::Level2Product::SpectrumWidth: case common::Level2Product::SpectrumWidth:
case common::Level2Product::CorrelationCoefficient: case common::Level2Product::CorrelationCoefficient:
default: default:
rangeMin = 2; rangeMin = 1;
rangeMax = 255; rangeMax = 255;
break; break;
case common::Level2Product::DifferentialReflectivity: case common::Level2Product::DifferentialReflectivity:
rangeMin = 2; rangeMin = 1;
rangeMax = 1058; rangeMax = 1058;
break; break;
case common::Level2Product::DifferentialPhase: case common::Level2Product::DifferentialPhase:
rangeMin = 2; rangeMin = 1;
rangeMax = 1023; rangeMax = 1023;
break; break;
case common::Level2Product::ClutterFilterPowerRemoved: case common::Level2Product::ClutterFilterPowerRemoved:
rangeMin = 8; rangeMin = 1;
rangeMax = 81; rangeMax = 81;
break; break;
} }
@ -218,8 +219,15 @@ void Level2ProductView::UpdateColorTable()
dataRange.begin(), dataRange.begin(),
dataRange.end(), dataRange.end(),
[&](uint16_t i) { [&](uint16_t i) {
float f = (i - offset) / scale; if (i == RANGE_FOLDED)
lut[i - *dataRange.begin()] = p->colorTable_->Color(f); {
lut[i - *dataRange.begin()] = p->colorTable_->rf_color();
}
else
{
float f = (i - offset) / scale;
lut[i - *dataRange.begin()] = p->colorTable_->Color(f);
}
}); });
p->colorTableMin_ = rangeMin; p->colorTableMin_ = rangeMin;
@ -307,8 +315,8 @@ void Level2ProductView::ComputeSweep()
} }
// Compute threshold at which to display an individual bin // Compute threshold at which to display an individual bin
const float scale = momentData0->scale(); const float scale = momentData0->scale();
const float offset = momentData0->offset(); const float offset = momentData0->offset();
const uint16_t snrThreshold = momentData0->snr_threshold_raw(); const uint16_t snrThreshold = momentData0->snr_threshold_raw();
// Azimuth resolution spacing: // Azimuth resolution spacing:
@ -374,7 +382,7 @@ void Level2ProductView::ComputeSweep()
if (dataMomentsArray8 != nullptr) if (dataMomentsArray8 != nullptr)
{ {
uint8_t dataValue = dataMomentsArray8[i]; uint8_t dataValue = dataMomentsArray8[i];
if (dataValue < snrThreshold) if (dataValue < snrThreshold && dataValue != RANGE_FOLDED)
{ {
continue; continue;
} }
@ -387,7 +395,7 @@ void Level2ProductView::ComputeSweep()
else else
{ {
uint16_t dataValue = dataMomentsArray16[i]; uint16_t dataValue = dataMomentsArray16[i];
if (dataValue < snrThreshold) if (dataValue < snrThreshold && dataValue != RANGE_FOLDED)
{ {
continue; continue;
} }

View file

@ -34,6 +34,8 @@ public:
ColorTable(ColorTable&&) noexcept; ColorTable(ColorTable&&) noexcept;
ColorTable& operator=(ColorTable&&) noexcept; ColorTable& operator=(ColorTable&&) noexcept;
boost::gil::rgba8_pixel_t rf_color() const;
boost::gil::rgba8_pixel_t Color(float value) const; boost::gil::rgba8_pixel_t Color(float value) const;
bool IsValid() const; bool IsValid() const;

View file

@ -70,6 +70,11 @@ ColorTable::~ColorTable() = default;
ColorTable::ColorTable(ColorTable&&) noexcept = default; ColorTable::ColorTable(ColorTable&&) noexcept = default;
ColorTable& ColorTable::operator=(ColorTable&&) noexcept = default; ColorTable& ColorTable::operator=(ColorTable&&) noexcept = default;
boost::gil::rgba8_pixel_t ColorTable::rf_color() const
{
return p->rfColor_;
}
boost::gil::rgba8_pixel_t ColorTable::Color(float value) const boost::gil::rgba8_pixel_t ColorTable::Color(float value) const
{ {
boost::gil::rgba8_pixel_t color; boost::gil::rgba8_pixel_t color;
@ -198,7 +203,7 @@ void ColorTable::ProcessLine(const std::vector<std::string>& tokenList)
// Step: number // Step: number
p->step_ = std::stol(tokenList[1]); p->step_ = std::stol(tokenList[1]);
} }
else if (tokenList[0] == "RF") else if (tokenList[0] == "RF:")
{ {
// RF: R G B [A] // RF: R G B [A]
p->rfColor_ = ParseColor(tokenList, 1, p->colorMode_); p->rfColor_ = ParseColor(tokenList, 1, p->colorMode_);