|
|
@ -213,12 +213,10 @@ MainWindow::MainWindow(QWidget* parent) |
|
|
|
lcdStyle(ui->lcd_biteCounter); |
|
|
|
lcdStyle(ui->lcd_adcCounter); |
|
|
|
|
|
|
|
dynamicContrastMinLogInput = MIN_LOG_INPUT_DEFAULT; |
|
|
|
dynamicContrastMaxLogInput = MAX_LOG_INPUT_DEFAULT; |
|
|
|
dynamicContrastGain = GAIN_DEFAULT; |
|
|
|
contrastNumber = CONTRAST_NUM_DEFAULT; |
|
|
|
|
|
|
|
readDynamicContrastParameters(dynamicContrastParams); |
|
|
|
ui->plot_2->axisRect()->setupFullAxesBox(true); |
|
|
|
ui->plot_2->xAxis->setLabel("Line"); |
|
|
|
ui->plot_2->yAxis->setLabel("Point"); |
|
|
|
ui->plot_2->clearGraphs(); |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
@ -236,6 +234,8 @@ MainWindow::MainWindow(QWidget* parent) |
|
|
|
|
|
|
|
_trx.setTrxFanRpm(fan1, static_cast<quint8>(ui->sb_Fan1Pwm->value())); |
|
|
|
_trx.setTrxFanRpm(fan2, static_cast<quint8>(ui->sb_Fan2Pwm->value())); |
|
|
|
|
|
|
|
on_btn_dynConSetParams_clicked(); |
|
|
|
} |
|
|
|
catch(const char* exception) |
|
|
|
{ |
|
|
@ -1485,7 +1485,7 @@ const QString MainWindow::enum2String(ePg state) const |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void MainWindow::dynamicContrastCsvRead(const QString &path) |
|
|
|
void MainWindow::dynamicContrastCsvRead(const QString& path) |
|
|
|
{ |
|
|
|
QFile csvReadFile(path); |
|
|
|
|
|
|
@ -1504,7 +1504,7 @@ void MainWindow::dynamicContrastCsvRead(const QString &path) |
|
|
|
data.clear(); |
|
|
|
line = csvReadFile.readLine(); |
|
|
|
auto sl = line.split(','); |
|
|
|
foreach(auto &str, sl) |
|
|
|
foreach(auto& str, sl) |
|
|
|
{ |
|
|
|
data.push_back(str.toFloat()); |
|
|
|
} |
|
|
@ -1552,6 +1552,11 @@ void MainWindow::on_btn_dynConSetParams_clicked() |
|
|
|
if(ui->tb_contrastNum->text().length() > 0) |
|
|
|
{ |
|
|
|
contrastNumber = static_cast<quint8>(ui->tb_contrastNum->text().toUShort()); |
|
|
|
if(contrastNumber < 1 || contrastNumber > 12) |
|
|
|
{ |
|
|
|
qDebug() << "Dynamic Contrast is out of range."; |
|
|
|
contrastNumber = CONTRAST_NUM_DEFAULT; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
@ -1560,7 +1565,7 @@ void MainWindow::on_btn_dynConSetParams_clicked() |
|
|
|
|
|
|
|
readDynamicContrastParameters(dynamicContrastParams); |
|
|
|
} |
|
|
|
catch(SonoException &e) |
|
|
|
catch(SonoException& e) |
|
|
|
{ |
|
|
|
qDebug() << e.what(); |
|
|
|
} |
|
|
@ -1573,7 +1578,7 @@ void MainWindow::on_chk_dynamicContrast_clicked(bool checked) |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void MainWindow::readDynamicContrastParameters(DynamicContrastParameters ¶ms) |
|
|
|
void MainWindow::readDynamicContrastParameters(DynamicContrastParameters& params) |
|
|
|
{ |
|
|
|
params.gain = log2(pow(10.0f, (dynamicContrastGain / 20.0f))) * pow(2.0f, 11.0f); |
|
|
|
params.max_output_level = MAX_OUTPUT_LEVEL; |
|
|
@ -1582,9 +1587,17 @@ void MainWindow::readDynamicContrastParameters(DynamicContrastParameters ¶ms |
|
|
|
params.app_max_log_input_level = dynamicContrastMaxLogInput * pow(2.0f, 11.0f); |
|
|
|
params.app_min_log_input_level = dynamicContrastMinLogInput * pow(2.0f, 11.0f); |
|
|
|
|
|
|
|
qDebug() << "gain: " << params.gain; |
|
|
|
qDebug() << "max_output_level: " << params.max_output_level; |
|
|
|
qDebug() << "min_output_level: " << params.min_output_level; |
|
|
|
qDebug() << "max_log_input_level: " << params.max_log_input_level; |
|
|
|
qDebug() << "app_max_log_input_level:" << params.app_max_log_input_level; |
|
|
|
qDebug() << "app_min_log_input_level:" << params.app_min_log_input_level; |
|
|
|
|
|
|
|
dynamicContrastCsvRead(_dynContrCurvesPath); |
|
|
|
params.const_piecewise_y = dynamicTotalData.at(contrastNumber - 1); |
|
|
|
QList<float> piecewise_x; |
|
|
|
for (auto i = 0; i < 256; i++) |
|
|
|
for(auto i = 0; i < dynamicTotalData.at(0).length(); i++) |
|
|
|
{ |
|
|
|
piecewise_x.push_back(i); |
|
|
|
} |
|
|
@ -2146,9 +2159,6 @@ void MainWindow::show3d() |
|
|
|
quint16 line(0), point(0); |
|
|
|
|
|
|
|
ui->plot_2->clearGraphs(); |
|
|
|
ui->plot_2->axisRect()->setupFullAxesBox(true); |
|
|
|
ui->plot_2->xAxis->setLabel("Line"); |
|
|
|
ui->plot_2->yAxis->setLabel("Point"); |
|
|
|
|
|
|
|
if(plotFrame.size() != 0) |
|
|
|
{ |
|
|
@ -2219,8 +2229,8 @@ void MainWindow::show3d() |
|
|
|
qDebug() << "mPoint" << mPoint; |
|
|
|
|
|
|
|
_colorMap->data()->clear(); |
|
|
|
_colorMap->data()->setSize(line, point); |
|
|
|
_colorMap->data()->setRange(QCPRange(1, line), QCPRange(1, point)); |
|
|
|
_colorMap->data()->setSize(line, point + 1); |
|
|
|
_colorMap->data()->setRange(QCPRange(1, line), QCPRange(1, point + 1)); |
|
|
|
|
|
|
|
quint32 max = 0; |
|
|
|
auto indx = 0; |
|
|
@ -2232,7 +2242,7 @@ void MainWindow::show3d() |
|
|
|
|
|
|
|
for(auto ln = 0; ln < lnPacket; ln += 1) |
|
|
|
{ |
|
|
|
for(auto pnt = 0; pnt < point; pnt += 1) |
|
|
|
for(auto pnt = 0; pnt < (point + 1); pnt += 1) |
|
|
|
{ |
|
|
|
indx = (ln * point + pnt) * 4 + 160; |
|
|
|
auto val = ((static_cast<quint32>(plotPacket[indx])) & 0x000000FF) | |
|
|
@ -2250,7 +2260,14 @@ void MainWindow::show3d() |
|
|
|
val = static_cast<quint32>(DynamicContrast(val, dynamicContrastParams)); |
|
|
|
} |
|
|
|
|
|
|
|
_colorMap->data()->setCell(lnSum + ln, pnt, double(val)); |
|
|
|
if(pnt == point) |
|
|
|
{ |
|
|
|
_colorMap->data()->setCell(lnSum + ln, pnt, double(255)); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
_colorMap->data()->setCell(lnSum + ln, pnt, double(val)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
lnSum = lnSum + lnPacket; |
|
|
@ -2263,13 +2280,19 @@ void MainWindow::show3d() |
|
|
|
colorScale->setType(QCPAxis::atRight); |
|
|
|
_colorMap->setColorScale(colorScale); |
|
|
|
colorScale->axis()->setLabel("Number"); |
|
|
|
_colorMap->setGradient((QCPColorGradient::gpJet)); |
|
|
|
QCPMarginGroup* marginGroup = new QCPMarginGroup(ui->plot_2); |
|
|
|
ui->plot_2->axisRect()->setMarginGroup(QCP::msBottom | QCP::msTop, marginGroup); |
|
|
|
colorScale->setMarginGroup(QCP::msBottom | QCP::msTop, marginGroup); |
|
|
|
} |
|
|
|
_colorMap->setGradient((QCPColorGradient::gpJet)); |
|
|
|
_colorMap->rescaleDataRange(); |
|
|
|
if(_isDynamicContrast) |
|
|
|
{ |
|
|
|
_colorMap->setGradient((QCPColorGradient::gpGrayscale)); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
_colorMap->setGradient((QCPColorGradient::gpJet)); |
|
|
|
} |
|
|
|
_colorMap->rescaleDataRange(false); |
|
|
|
|
|
|
|
ui->plot_2->rescaleAxes(true); |
|
|
|
ui->plot_2->replot(); |
|
|
|