Skip to content

Commit

Permalink
Small code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hvanruys committed Aug 13, 2018
1 parent 5b242f1 commit c89488b
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 29 deletions.
4 changes: 3 additions & 1 deletion core/avhrrsatellite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ void AVHRRSatellite::AddSegmentsToList(QFileInfoList fileinfolist)

for(int i = 0; i < opts.geosatellites.count(); i++)
{
//seglgeo.at(i)->setImagePath("");

//qDebug() << fileInfo.fileName().mid( opts.geosatellites.at(i).indexsearchstring, opts.geosatellites.at(i).searchstring.length() ) << "???" << opts.geosatellites.at(i).searchstring;
if (fileInfo.fileName().mid( opts.geosatellites.at(i).indexsearchstring, opts.geosatellites.at(i).searchstring.length()) == opts.geosatellites.at(i).searchstring && fileInfo.isFile())
{
Expand Down Expand Up @@ -1949,7 +1951,7 @@ QStringList AVHRRSatellite::GetOverviewSegmentsDatahubSLSTR()
QStringList AVHRRSatellite::GetOverviewSegmentsGeo(int geoindex)
{
QStringList strlist;
strlist << " " << QString(opts.geosatellites.at(geoindex).fullname) << QString("%1").arg(this->segmentlistmapgeo.at(geoindex).count());
strlist << seglgeo.at(geoindex)->getImagePath() << QString(opts.geosatellites.at(geoindex).fullname) << QString("%1").arg(this->segmentlistmapgeo.at(geoindex).count());

return strlist;
}
Expand Down
2 changes: 0 additions & 2 deletions core/formgeostationary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,8 +903,6 @@ void FormGeostationary::slotCreateRGBrecipe(int recipe)

qDebug() << "CreateRGBrecipe = " << recipe;

//CreateRGBrecipeImageThread(recipe);

SegmentListGeostationary *sl;
QString tex;

Expand Down
76 changes: 76 additions & 0 deletions core/formgeostationary.ui
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,82 @@
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1005</width>
<height>257</height>
</rect>
</property>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>40</x>
<y>20</y>
<width>89</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>170</x>
<y>20</y>
<width>113</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>20</x>
<y>70</y>
<width>136</width>
<height>125</height>
</rect>
</property>
<property name="title">
<string>GroupBox</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="radioButton">
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_2">
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_3">
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
Expand Down
2 changes: 1 addition & 1 deletion core/formimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2062,7 +2062,7 @@ void FormImage::recalculateCLAHE(QVector<QString> spectrumvector, QVector<bool>
else if(sl->getKindofImage() == "VIS_IR" && (sl->getGeoSatellite() == eGeoSatellite::FY2E || sl->getGeoSatellite() == eGeoSatellite::FY2G ))
{
pixelsRed = new quint16[npix];
memcpy(pixelsRed, imageptrs->ptrRed[0], 2288 * 2288 * sizeof(quint16));
memcpy(pixelsRed, imageptrs->ptrRed[0], npix * sizeof(quint16));
}
else if(sl->getKindofImage() == "VIS_IR" && (sl->getGeoSatellite() == eGeoSatellite::GOES_16 ))
{
Expand Down
1 change: 0 additions & 1 deletion core/formtoolbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ void FormToolbox::setValuePrgBar(int val)

void FormToolbox::setValueProgressBar(int val)
{
qDebug() << "FormToolbox::setValueProgressBar(int val) " << val;
ui->pbProgress->setValue(val);
//this->update();
}
Expand Down
8 changes: 4 additions & 4 deletions core/formtoolbox.ui
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>4</number>
<number>3</number>
</property>
<property name="tabBarAutoHide">
<bool>false</bool>
Expand Down Expand Up @@ -5524,7 +5524,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-98</y>
<y>0</y>
<width>430</width>
<height>529</height>
</rect>
Expand Down Expand Up @@ -6290,8 +6290,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>444</width>
<height>410</height>
<width>326</width>
<height>264</height>
</rect>
</property>
<attribute name="label">
Expand Down
30 changes: 21 additions & 9 deletions core/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,20 +556,32 @@ void Options::InitializeGeo()
geo.longitudelimit2 = settingsgeo.value("longitudelimit2").toDouble();
geo.protocol = settingsgeo.value("protocol").toString();
geo.rss = settingsgeo.value("rss").toBool();
if(geo.rss)

if(i < 4) // only Meteosat-11,-10,-9,-8
{
geo.imagewidth = 3712;
geo.imageheight = 1392;
geo.maxsegments = 3;
geo.maxsegmentshrv = 9;
if(geo.rss)
{
geo.imagewidth = 3712;
geo.imageheight = 1392;
geo.maxsegments = 3;
geo.maxsegmentshrv = 9;
}
else
{
geo.imagewidth = 3712;
geo.imageheight = 3712;
geo.maxsegments = 8;
geo.maxsegmentshrv = 24;
}
}
else
{
geo.imagewidth = 3712;
geo.imageheight = 3712;
geo.maxsegments = 8;
geo.maxsegmentshrv = 24;
geo.imagewidth = settingsgeo.value("imagewidth").toInt();
geo.imageheight = settingsgeo.value("imageheight").toInt();
geo.maxsegments = settingsgeo.value("maxsegments").toInt();
geo.maxsegmentshrv = settingsgeo.value("maxsegmentshrv").toInt();
}

geo.searchstring = settingsgeo.value("searchstring").toString();
geo.indexsearchstring = settingsgeo.value("indexsearchstring").toInt();
geo.filepattern = settingsgeo.value("filepattern").toString();
Expand Down
58 changes: 47 additions & 11 deletions core/segmentlistgeostationary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,7 @@ void SegmentListGeostationary::ComposeSegmentImageHDFInThread(QStringList fileli
this->SetupContrastStretch( stat_min[0], 0, stat_max[0], 255);
valcontrastred = ContrastStretch(rc);
}
*(imageptrs->ptrRed[0] + line * npix + pixelx) = valcontrastred;

}
else if(kindofimage == "HRV")
Expand Down Expand Up @@ -2350,9 +2351,9 @@ void SegmentListGeostationary::ComposeHRV()



//imageptrs->CLAHE(pixelsRed, 3712, 3712, 0, 1023, 16, 16, 256, 15);
//imageptrs->CLAHE(pixelsGreen, 3712, 3712, 0, 1023, 16, 16, 256, 15);
//imageptrs->CLAHE(pixelsBlue, 3712, 3712, 0, 1023, 16, 16, 256, 15);
imageptrs->CLAHE(pixelsRed, 3712, 3712, 0, 1023, 16, 16, 256, 4);
imageptrs->CLAHE(pixelsGreen, 3712, 3712, 0, 1023, 16, 16, 256, 4);
imageptrs->CLAHE(pixelsBlue, 3712, 3712, 0, 1023, 16, 16, 256, 4);

if(opts.geosatellites.at(geoindex).rss)
imageptrs->CLAHE(pixelsHRV, 5568, 5*464, 0, 1023, 16, 16, 256, 4);
Expand Down Expand Up @@ -2949,6 +2950,7 @@ void SegmentListGeostationary::ComposeGeoRGBRecipe(int recipe, QString tex)
void SegmentListGeostationary::ComposeGeoRGBRecipeInThread(int recipe)
{
qDebug() << "start SegmentListGeostationary::ComposeGeoRGBRecipeInThread(int recipe)";
qDebug() << "geoindex = " << geoindex;
emit progressCounter(10);

QStringList redbandlist = imageptrs->rgbrecipes[recipe].Colorvector.at(0).channels;
Expand Down Expand Up @@ -3326,7 +3328,7 @@ void SegmentListGeostationary::ComposeGeoRGBRecipeInThread(int recipe)

QRgb *row_col;
float red, green, blue;
imageptrs->InitializeImageGeostationary(opts.geosatellites.at(0).imagewidth, opts.geosatellites.at(0).imageheight);
imageptrs->InitializeImageGeostationary(opts.geosatellites.at(geoindex).imagewidth, opts.geosatellites.at(geoindex).imageheight);


for(int colorindex = 0; colorindex < 3; colorindex++)
Expand Down Expand Up @@ -3393,9 +3395,48 @@ void SegmentListGeostationary::ComposeGeoRGBRecipeInThread(int recipe)
qDebug() << QString("%1 resultmin = %2 resultmax = %3").arg(colorindex).arg(resultmin[colorindex]).arg(resultmax[colorindex]);


for (int line = 0; line < 3712; line++)
// for (int line = 0; line < 3712; line++)
// {
// row_col = (QRgb*)imageptrs->ptrimageGeostationary->scanLine(3711 - line);
// for (int pixelx = 0; pixelx < 3712; pixelx++)
// {
// int i_image = line * 3712 + pixelx;

// if(result[0][i_image] == FILL_VALUE_F || result[1][i_image] == FILL_VALUE_F || result[2][i_image] == FILL_VALUE_F )
// {
// red = 0.0;
// green = 0.0;
// blue = 0.0;
// }
// else
// {
// if(imageptrs->rgbrecipes[recipe].Colorvector.at(0).inverse.at(0))
// red = 255.0 - 255.0 * pow((result[0][i_image] - resultmin[0]) / (resultmax[0] - resultmin[0]), 1.0/imageptrs->rgbrecipes[recipe].Colorvector.at(0).gamma);
// else
// red = 255.0 * pow((result[0][i_image] - resultmin[0]) / (resultmax[0] - resultmin[0]), 1.0/imageptrs->rgbrecipes[recipe].Colorvector.at(0).gamma);
// if(imageptrs->rgbrecipes[recipe].Colorvector.at(1).inverse.at(0))
// green = 255.0 - 255.0 * pow((result[1][i_image] - resultmin[1]) / (resultmax[1] - resultmin[1]), 1.0/imageptrs->rgbrecipes[recipe].Colorvector.at(1).gamma);
// else
// green = 255.0 * pow((result[1][i_image] - resultmin[1]) / (resultmax[1] - resultmin[1]), 1.0/imageptrs->rgbrecipes[recipe].Colorvector.at(1).gamma);
// if(imageptrs->rgbrecipes[recipe].Colorvector.at(2).inverse.at(0))
// blue = 255 - 255.0 * pow((result[2][i_image] - resultmin[2]) / (resultmax[2] - resultmin[2]), 1.0/imageptrs->rgbrecipes[recipe].Colorvector.at(2).gamma);
// else
// blue = 255.0 * pow((result[2][i_image] - resultmin[2]) / (resultmax[2] - resultmin[2]), 1.0/imageptrs->rgbrecipes[recipe].Colorvector.at(2).gamma);
// }
// int i_image1 = (3711 - line) * 3712 + (3711 - pixelx);

// imageptrs->ptrimageRGBRecipeRed[i_image1] = (quint8)red;
// imageptrs->ptrimageRGBRecipeGreen[i_image1] = (quint8)green;
// imageptrs->ptrimageRGBRecipeBlue[i_image1] = (quint8)blue;

// row_col[3711 - pixelx] = qRgb((int)red, (int)green, (int)blue);
// }
// }


for (int line = (opts.geosatellites.at(geoindex).rss ? 5 * 464 : 0); line < 3712; line++)
{
row_col = (QRgb*)imageptrs->ptrimageGeostationary->scanLine(3711 - line);
row_col = (QRgb*)imageptrs->ptrimageGeostationary->scanLine(opts.geosatellites.at(geoindex).rss ? 8 * 464 - 1 - line : 3711 - line);
for (int pixelx = 0; pixelx < 3712; pixelx++)
{
int i_image = line * 3712 + pixelx;
Expand Down Expand Up @@ -4260,9 +4301,6 @@ void SegmentListGeostationary::CalculateGeoRadiances(bandstorage &bs)
bands[bs.listindex].data[i_image] /= cos(sza[i_image] * D2R);

bands[bs.listindex].data[i_image] = bands[bs.listindex].data[i_image] < 0.0 ? 0.0 : bands[bs.listindex].data[i_image];
if( i_image == 1856 * 3712 + 1856 )
qDebug() << QString("The effective radiance = %1 BRF = %2").arg(R).arg(bands[bs.listindex].data[i_image]);


if(bands[bs.listindex].data[i_image] < bands[bs.listindex].min) bands[bs.listindex].min = bands[bs.listindex].data[i_image];
if(bands[bs.listindex].data[i_image] > bands[bs.listindex].max) bands[bs.listindex].max = bands[bs.listindex].data[i_image];
Expand Down Expand Up @@ -4319,8 +4357,6 @@ void SegmentListGeostationary::CalculateGeoRadiances(bandstorage &bs)
double L = bands[bs.listindex].data[i_image] * bs.slope + bs.offset;

bands[bs.listindex].data[i_image] = (c2 * nu / log(1. + nu3 * c1 / L) - b) / a;
if( i_image == 1856 * 3712 + 1856 )
qDebug() << QString("The effective radiance = %1 the brightense temp = %2").arg(L).arg(bands[bs.listindex].data[i_image]);

if(bands[bs.listindex].data[i_image] < bands[bs.listindex].min) bands[bs.listindex].min = bands[bs.listindex].data[i_image];
if(bands[bs.listindex].data[i_image] > bands[bs.listindex].max) bands[bs.listindex].max = bands[bs.listindex].data[i_image];
Expand Down

0 comments on commit c89488b

Please sign in to comment.