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 constexpr uint32_t VERTICES_PER_BIN = 6;
static constexpr uint32_t VALUES_PER_VERTEX = 2;
static constexpr uint16_t RANGE_FOLDED = 1u;
static constexpr uint32_t VERTICES_PER_BIN = 6u;
static constexpr uint32_t VALUES_PER_VERTEX = 2u;
static const std::unordered_map<common::Level2Product,
wsr88d::rda::DataBlockType>
@ -188,22 +189,22 @@ void Level2ProductView::UpdateColorTable()
case common::Level2Product::SpectrumWidth:
case common::Level2Product::CorrelationCoefficient:
default:
rangeMin = 2;
rangeMin = 1;
rangeMax = 255;
break;
case common::Level2Product::DifferentialReflectivity:
rangeMin = 2;
rangeMin = 1;
rangeMax = 1058;
break;
case common::Level2Product::DifferentialPhase:
rangeMin = 2;
rangeMin = 1;
rangeMax = 1023;
break;
case common::Level2Product::ClutterFilterPowerRemoved:
rangeMin = 8;
rangeMin = 1;
rangeMax = 81;
break;
}
@ -218,8 +219,15 @@ void Level2ProductView::UpdateColorTable()
dataRange.begin(),
dataRange.end(),
[&](uint16_t i) {
if (i == RANGE_FOLDED)
{
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;
@ -374,7 +382,7 @@ void Level2ProductView::ComputeSweep()
if (dataMomentsArray8 != nullptr)
{
uint8_t dataValue = dataMomentsArray8[i];
if (dataValue < snrThreshold)
if (dataValue < snrThreshold && dataValue != RANGE_FOLDED)
{
continue;
}
@ -387,7 +395,7 @@ void Level2ProductView::ComputeSweep()
else
{
uint16_t dataValue = dataMomentsArray16[i];
if (dataValue < snrThreshold)
if (dataValue < snrThreshold && dataValue != RANGE_FOLDED)
{
continue;
}

View file

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

View file

@ -70,6 +70,11 @@ ColorTable::~ColorTable() = default;
ColorTable::ColorTable(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 color;
@ -198,7 +203,7 @@ void ColorTable::ProcessLine(const std::vector<std::string>& tokenList)
// Step: number
p->step_ = std::stol(tokenList[1]);
}
else if (tokenList[0] == "RF")
else if (tokenList[0] == "RF:")
{
// RF: R G B [A]
p->rfColor_ = ParseColor(tokenList, 1, p->colorMode_);