Skip to content

Commit

Permalink
Update gen. icon; style
Browse files Browse the repository at this point in the history
  • Loading branch information
issakomi committed May 18, 2024
1 parent e10366a commit caabbef
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 38 deletions.
2 changes: 1 addition & 1 deletion GUI/aliza.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ void Aliza::add_histogram(ImageVariant * v, QProgressDialog * pb, bool check_set
t->start();
while (!t->isFinished())
{
delay1(10);
delay1(100);
if (pb && pb->wasCanceled())
{
t->exit(0);
Expand Down
12 changes: 6 additions & 6 deletions GUI/histogramgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ template<typename T> QString calculate_histogramm(
return QString(ex.GetDescription());
}
//
int tmp0 = 1;
int tmp0{1};
const HistogramType * h = histogram_generator->GetOutput();
for (unsigned int x = 0; x < bins_size; ++x)
{
Expand Down Expand Up @@ -144,7 +144,7 @@ template<typename T> QString calculate_histogramm_rgb(
return QString("bins_size > histogram->GetSize()[2]");
}
//
int tmp0 = 1;
int tmp0{1};
for (unsigned int x = 0; x < bins_size; ++x)
{
const int f0 = histogram->GetFrequency(x, 0);
Expand Down Expand Up @@ -240,7 +240,7 @@ QString HistogramGen::gen_pixmap_scalar()
QPen pen; pen.setColor(fgcolor);
pen.setWidth(3);
const unsigned int pixmap_w = bins_size < 2048 ? 2048 : bins_size;
const unsigned int pixmap_h = 1024;
const unsigned int pixmap_h{1024u};
pixmap = QPixmap(pixmap_w, pixmap_h);
if (pixmap.isNull())
{
Expand All @@ -252,8 +252,8 @@ QString HistogramGen::gen_pixmap_scalar()
painter.begin(&pixmap);
painter.setPen(pen);
painter.setBrush(brush);
double first_x = 0.0;
double last_x = 0.0;
double first_x{};
double last_x{};
for (unsigned int x = 0; x < bins_size; ++x)
{
const double x_ = pixmap_w * x / static_cast<double>(bins_size);
Expand Down Expand Up @@ -301,7 +301,7 @@ QString HistogramGen::gen_pixmap_rgb()
const unsigned long pixmap_w = (bins_size * 3 < 2048)
? 2048
: bins_size * 3; // curr. always 256 bins
const unsigned long pixmap_h = 1024;
const unsigned long pixmap_h{1024u};
pixmap = QPixmap(pixmap_w, pixmap_h);
if (pixmap.isNull())
{
Expand Down
58 changes: 27 additions & 31 deletions GUI/iconutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include <QColor>
#include <QThread>
#include <vector>
#include <chrono>
#include <thread>

class ProcessImageThread_ : public QThread
{
Expand Down Expand Up @@ -149,7 +147,7 @@ template<typename Tin, typename Tout> void extract_icon(
std::vector<ProcessImageThread_*> icon_threads;
if (tmp99 == 0)
{
unsigned int j = 0;
unsigned int j{};
for (int i = 0; i < num_threads; ++i)
{
const int size_0 = size_x;
Expand All @@ -167,8 +165,8 @@ template<typename Tin, typename Tout> void extract_icon(
}
else
{
unsigned int j = 0;
unsigned int block = 64;
unsigned int j{};
unsigned int block{64};
if (static_cast<float>(size_y) / static_cast<float>(block) > 16.0f)
{
block = 128;
Expand All @@ -180,7 +178,7 @@ template<typename Tin, typename Tout> void extract_icon(
for (int i = 0; i < incr; ++i)
{
const int size_0 = size_x;
const int index_0 = 0;
const int index_0{};
const int index_1 = i * block;
ProcessImageThread_ * t__ = new ProcessImageThread_(tmp1,
p,
Expand Down Expand Up @@ -208,16 +206,11 @@ template<typename Tin, typename Tout> void extract_icon(
}

}
//
const size_t threads_size = icon_threads.size();
while (true)
for (size_t i = 0; i < threads_size; ++i)
{
std::this_thread::sleep_for(std::chrono::milliseconds(1));
size_t b__ = 0;
for (size_t i = 0; i < threads_size; ++i)
{
if (icon_threads.at(i)->isFinished()) ++b__;
}
if (b__ == threads_size) break;
icon_threads[i]->wait();
}
for (size_t i = 0; i < threads_size; ++i)
{
Expand All @@ -227,7 +220,8 @@ template<typename Tin, typename Tout> void extract_icon(
icon_threads.clear();
//
QImage tmpi(p, size_x, size_y, 3 * size_x, QImage::Format_RGB888);
bool flip_x = false, flip_y = false;
bool flip_x{};
bool flip_y{};
if (!ivariant->orientation_string.isEmpty() && ivariant->orientation_string.size() >= 3)
{
if (ivariant->orientation_string.at(1) == QChar('I') ||
Expand Down Expand Up @@ -335,7 +329,8 @@ template<typename Tin, typename Tout> void extract_icon_rgb(
if (tmp0.IsNull()) return;
else tmp0->DisconnectPipeline();
//
bool flip_x = false, flip_y = false;
bool flip_x{};
bool flip_y{};
if (!ivariant->orientation_string.isEmpty() && ivariant->orientation_string.size() >= 3)
{
if (ivariant->orientation_string.at(1) == QChar('I') ||
Expand Down Expand Up @@ -375,7 +370,7 @@ template<typename Tin, typename Tout> void extract_icon_rgb(
}
try
{
unsigned long j_ = 0;
unsigned long j_{};
itk::ImageRegionConstIterator<Tout> iterator(tmp0, region);
iterator.GoToBegin();
while (!iterator.IsAtEnd())
Expand All @@ -392,7 +387,7 @@ template<typename Tin, typename Tout> void extract_icon_rgb(
}
catch (const itk::ExceptionObject &)
{
;;
;
}
QImage tmpi(p, size_[0], size_[1], 3 * size_[0], QImage::Format_RGB888);
if (flip_x && flip_y) tmpi = tmpi.mirrored(true, true);
Expand Down Expand Up @@ -476,7 +471,7 @@ template<typename Tin, typename Tout> void extract_icon_rgb(
}
try
{
unsigned long j_ = 0;
unsigned long j_{};
itk::ImageRegionConstIterator<Tout> iterator(tmp0, region);
iterator.GoToBegin();
while(!iterator.IsAtEnd())
Expand All @@ -493,7 +488,7 @@ template<typename Tin, typename Tout> void extract_icon_rgb(
}
catch (const itk::ExceptionObject &)
{
;;
;
}
QImage tmpi(p, size_[0], size_[1], 3 * size_[0], QImage::Format_RGB888);
if (flip_x && flip_y) tmpi = tmpi.mirrored(true, true);
Expand Down Expand Up @@ -586,7 +581,8 @@ template<typename Tin, typename Tout> void extract_icon_rgba(
}
if (tmp0.IsNull()) return;
//
bool flip_x = false, flip_y = false;
bool flip_x{};
bool flip_y{};
if (!ivariant->orientation_string.isEmpty() && ivariant->orientation_string.size() >= 3)
{
if (ivariant->orientation_string.at(1) == QChar('I') ||
Expand Down Expand Up @@ -627,7 +623,7 @@ template<typename Tin, typename Tout> void extract_icon_rgba(
}
try
{
unsigned long j_ = 0;
unsigned long j_{};
itk::ImageRegionConstIterator<Tout> iterator(tmp0, region);
iterator.GoToBegin();
while (!iterator.IsAtEnd())
Expand All @@ -646,7 +642,7 @@ template<typename Tin, typename Tout> void extract_icon_rgba(
}
catch (const itk::ExceptionObject &)
{
;;
;
}
QImage tmpi(p, size_[0], size_[1], 4 * size_[0], QImage::Format_RGBA8888);
if (flip_x && flip_y) tmpi = tmpi.mirrored(true, true);
Expand Down Expand Up @@ -679,7 +675,7 @@ template<typename Tin, typename Tout> void extract_icon_rgba(
}
try
{
unsigned long j_ = 0;
unsigned long j_{};
itk::ImageRegionConstIterator<Tout> iterator(tmp0, region);
iterator.GoToBegin();
while (!iterator.IsAtEnd())
Expand Down Expand Up @@ -711,7 +707,7 @@ template<typename Tin, typename Tout> void extract_icon_rgba(
}
catch (const itk::ExceptionObject &)
{
;;
;
}
QImage tmpi(p, size_[0], size_[1], 3 * size_[0], QImage::Format_RGB888);
if (flip_x && flip_y) tmpi = tmpi.mirrored(true, true);
Expand Down Expand Up @@ -784,7 +780,7 @@ template<typename Tin, typename Tout> void extract_icon_rgba(
}
try
{
unsigned long j_ = 0;
unsigned long j_{};
itk::ImageRegionConstIterator<Tout> iterator(tmp0, region);
iterator.GoToBegin();
while (!iterator.IsAtEnd())
Expand Down Expand Up @@ -816,7 +812,7 @@ template<typename Tin, typename Tout> void extract_icon_rgba(
}
catch (const itk::ExceptionObject &)
{
;;
;
}
QImage tmpi(p, size[0], size[1], 3 * size[0], QImage::Format_RGB888);
if (flip_x && flip_y) tmpi = tmpi.mirrored(true, true);
Expand Down Expand Up @@ -864,7 +860,7 @@ template<typename Tin, typename Tout> void extract_icon_rgba(
}
try
{
unsigned long j_ = 0;
unsigned long j_{};
itk::ImageRegionConstIterator<Tout> iterator(tmp0, region);
iterator.GoToBegin();
while(!iterator.IsAtEnd())
Expand All @@ -883,7 +879,7 @@ template<typename Tin, typename Tout> void extract_icon_rgba(
}
catch (const itk::ExceptionObject &)
{
;;
;
}
QImage tmpi(p, size[0], size[1], 4 * size[0], QImage::Format_RGBA8888);
if (flip_x && flip_y) tmpi = tmpi.mirrored(true, true);
Expand Down Expand Up @@ -916,7 +912,7 @@ template<typename Tin, typename Tout> void extract_icon_rgba(
}
try
{
unsigned long j_ = 0;
unsigned long j_{};
itk::ImageRegionConstIterator<Tout> iterator(tmp0, region);
iterator.GoToBegin();
while(!iterator.IsAtEnd())
Expand All @@ -939,7 +935,7 @@ template<typename Tin, typename Tout> void extract_icon_rgba(
}
catch (const itk::ExceptionObject &)
{
;;
;
}
QImage tmpi(p, size[0], size[1], 3 * size[0], QImage::Format_RGB888);
if (flip_x && flip_y) tmpi = tmpi.mirrored(true, true);
Expand Down

0 comments on commit caabbef

Please sign in to comment.