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

fix bug in stop and exit

parent fa4eac03
No related branches found
No related tags found
No related merge requests found
Demo/Demo.gif

9 MiB

#ifndef WORKER_H #ifndef WORKER_H
#define WORKER_H #define WORKER_H
#include <atomic>
#include <QObject> #include <QObject>
#include <QThread> #include <QThread>
#include "reconstruction.h" #include "reconstruction.h"
...@@ -12,15 +13,18 @@ class Worker : public QThread ...@@ -12,15 +13,18 @@ class Worker : public QThread
RecoImage* image; RecoImage* image;
void run() override; void run() override;
ulong localCounts=0; ulong localCounts=0;
bool stopped=true; std::atomic<bool> stopped;
bool exitted=false; std::atomic<bool> exitted;
public: public:
// explicit Worker(QObject *parent = nullptr); // explicit Worker(QObject *parent = nullptr);
Worker(QObject *parent, const Setup* config_, RecoImage* image_) : Worker(QObject *parent, const Setup* config_, RecoImage* image_) :
QThread(parent), QThread(parent),
config(config_), config(config_),
image(image_) image(image_)
{} {
stopped=true;
exitted=false;
}
//signals: //signals:
......
# Simple GUI application for back projection image reconstruction # Simple GUI application for back projection image reconstruction
## Use ## Prerequisites
- Install [ROOT](https://root.cern/install/) (v6.22 or above), `qmake` and `make`. - Install [ROOT v6](https://root.cern/install/).
- Compile: - Install qt5 development packages
```bash
sudo apt-get install qt5-default qtdeclarative5-dev
```
## Build
```bash ```bash
mkdir -p build mkdir -p build
cd build cd build
qmake CONFIG+=realease ../imagerQt.pro qmake -config release ../imagerQt.pro
make make
``` ```
- Run: ## Run
```bash ```bash
cd .. cd ..
build/ImagerQt build/ImagerQt
......
...@@ -58,6 +58,7 @@ void Worker::handleStop() ...@@ -58,6 +58,7 @@ void Worker::handleStop()
void Worker::stopExecution() void Worker::stopExecution()
{ {
exitted = true; exitted = true;
qDebug() << "Exiting thread signal received.";
} }
void Worker::handleClear() void Worker::handleClear()
......
...@@ -71,6 +71,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin ...@@ -71,6 +71,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
DISTFILES += \ DISTFILES += \
.gitignore \ .gitignore \
Demo/Demo.gif \
README.md README.md
RESOURCES += \ RESOURCES += \
......
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