Skip to content
Snippets Groups Projects
Commit fa4eac03 authored by mingf2's avatar mingf2
Browse files

fix bug in save/saveas

parent 3b8c1fb3
No related branches found
No related tags found
No related merge requests found
......@@ -111,7 +111,7 @@ public:
// queue capacity
ulong capacity=1024;
// max number of cones to process
ulong maxN=1000;
ulong maxN=10000;
};
class Cone
......
......@@ -50,7 +50,7 @@ MainWindow::MainWindow(QWidget *parent) :
// update every 0.1 second
QTimer *timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, QOverload<>::of(&MainWindow::redraw));
timer->start(100);
timer->start(1000);
setWindowTitle(tr("Back projection"));
ui->canvas->Canvas()->Modified();
......@@ -99,6 +99,8 @@ MainWindow::~MainWindow()
delete ui;
if (image)
delete image;
if (countsText)
delete countsText;
if (config)
delete config;
for (int i = 0; i < longitudes.size(); ++i) {
......@@ -226,12 +228,11 @@ bool MainWindow::handleSaveAs()
QString fileName = QFileDialog::getSaveFileName(this,
tr("Save Image"), "",
tr("PNG file (*.png);;ROOT file (*.root);;C file (*.C);;text file (*.txt)"));
if (fileName.isEmpty())
return false;
else {
if (saveCanvas(fileName))
curFile = fileName;
if (!fileName.isEmpty() && saveCanvas(fileName)){
curFile = fileName;
return true;
}
return false;
}
bool MainWindow::saveCanvas(const QString& fileName)
......@@ -240,7 +241,7 @@ bool MainWindow::saveCanvas(const QString& fileName)
QString ext=fileInfo.completeSuffix();
bool saved=false;
if (ext == "root" || ext == "png" || ext == "C") {
// qDebug() << "Save as " << ext << " file.";
qDebug() << "Save as " << ext << " file.";
image->mMutex.lock();
ui->canvas->Canvas()->SaveAs(fileName.toLocal8Bit().constData());
image->mMutex.unlock();
......
......@@ -164,6 +164,10 @@ int RecoImage::addConesNormalized(std::vector<Cone>::const_iterator first,
{
for (int j = 0; j < config->phiBins; j++)
{
// if (i==0&&j==0)
// {
// std::cout << omp_get_num_threads() << '\n';
// }
ray = k->apex - config->xbs[i][j];
beta = getCosAngle(ray, k->axis);
sgmb2 = std::pow((ray/(ray*ray) + k->axis/(k->axis*k->axis)-
......
......@@ -31,10 +31,13 @@ void Worker::run()
cones[i]=Cone(line);
i++;
}
if (exitted)
break;
localCounts+=i;
// update image
image->updateImage(cones.cbegin(), cones.cbegin()+i, true);
if (exitted || line.isNull() || localCounts >= config->maxN)
// if (exitted || in.atEnd() || localCounts >= config->maxN)
if (exitted || localCounts >= config->maxN)
break;
}
}
......
......@@ -47,14 +47,18 @@ FORMS += \
QMAKE_LFLAGS += -fopenmp
QMAKE_CXXFLAGS += -fopenmp
#QMAKE_CXXFLAGS += -fsanitize=address
#QMAKE_LFLAGS += -fsanitize=address
LIBS += -fopenmp
INCLUDEPATH += \
$(ROOTSYS)/include \
$$(ROOTSYS)/include \
$$PWD/Headers
LIBS += \
-L$(ROOTSYS)/lib -lCore -lImt -lRIO -lNet -lHist -lGraf \
-L$$(ROOTSYS)/lib -lCore -lImt -lRIO -lNet -lHist -lGraf \
-lGraf3d -lGpad -lTree -lTreePlayer -lRint -lPostscript -lMatrix \
-lPhysics -lMathCore -lThread -lMultiProc -pthread -lm -ldl -rdynamic
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment