mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 17:20:04 +00:00
Handle coded thresholds
This commit is contained in:
parent
cc36922e99
commit
cf3c780abf
1 changed files with 66 additions and 43 deletions
|
|
@ -174,52 +174,75 @@ void Level3ProductView::UpdateColorTable()
|
||||||
lut.resize(numberOfLevels - rangeMin);
|
lut.resize(numberOfLevels - rangeMin);
|
||||||
lut.shrink_to_fit();
|
lut.shrink_to_fit();
|
||||||
|
|
||||||
std::for_each(std::execution::par_unseq,
|
std::for_each(
|
||||||
dataRange.begin(),
|
std::execution::par_unseq,
|
||||||
dataRange.end(),
|
dataRange.begin(),
|
||||||
[&](uint16_t i)
|
dataRange.end(),
|
||||||
{
|
[&](uint16_t i)
|
||||||
if (i == RANGE_FOLDED && threshold > RANGE_FOLDED)
|
{
|
||||||
{
|
const size_t lutIndex = i - *dataRange.begin();
|
||||||
lut[i - *dataRange.begin()] = p->colorTable_->rf_color();
|
float f;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float f;
|
|
||||||
|
|
||||||
// Different products use different scale/offset
|
// Different products use different scale/offset formulas
|
||||||
// formulas
|
if (numberOfLevels > 16)
|
||||||
if (numberOfLevels > 16)
|
{
|
||||||
{
|
if (i == RANGE_FOLDED && threshold > RANGE_FOLDED)
|
||||||
switch (descriptionBlock->product_code())
|
{
|
||||||
{
|
lut[lutIndex] = p->colorTable_->rf_color();
|
||||||
case 159:
|
}
|
||||||
case 161:
|
else
|
||||||
case 163:
|
{
|
||||||
case 167:
|
switch (descriptionBlock->product_code())
|
||||||
case 168:
|
{
|
||||||
case 170:
|
case 159:
|
||||||
case 172:
|
case 161:
|
||||||
case 173:
|
case 163:
|
||||||
case 174:
|
case 167:
|
||||||
case 175:
|
case 168:
|
||||||
case 176:
|
case 170:
|
||||||
f = (i - offset) / scale;
|
case 172:
|
||||||
break;
|
case 173:
|
||||||
|
case 174:
|
||||||
|
case 175:
|
||||||
|
case 176:
|
||||||
|
f = (i - offset) / scale;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
f = i * scale + offset;
|
f = i * scale + offset;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
f = descriptionBlock->data_level_threshold(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
lut[i - *dataRange.begin()] = p->colorTable_->Color(f);
|
lut[lutIndex] = p->colorTable_->Color(f);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uint16_t th = descriptionBlock->data_level_threshold(i);
|
||||||
|
if ((th & 0x8000u) == 0)
|
||||||
|
{
|
||||||
|
// If bit 0 is zero, then the LSB is numeric
|
||||||
|
f = static_cast<float>(th);
|
||||||
|
lut[lutIndex] = p->colorTable_->Color(f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If bit 0 is one, then the LSB is coded
|
||||||
|
uint16_t lsb = th & 0x00ffu;
|
||||||
|
|
||||||
|
switch (lsb)
|
||||||
|
{
|
||||||
|
case 3: // RF
|
||||||
|
lut[lutIndex] = p->colorTable_->rf_color();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // Ignore other values
|
||||||
|
lut[lutIndex] = boost::gil::rgba8_pixel_t {0, 0, 0, 0};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
p->colorTableMin_ = rangeMin;
|
p->colorTableMin_ = rangeMin;
|
||||||
p->colorTableMax_ = rangeMax;
|
p->colorTableMax_ = rangeMax;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue