From e0822440f663acb53b271de23b4d1911d4d6ba4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicent=20Gim=C3=A9nez=20Alventosa?= Date: Thu, 11 Sep 2025 21:02:04 +0200 Subject: [PATCH 1/3] Update CI workflow for CMake and enable DICOM support --- .github/workflows/cmake.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9537978..f3cc3e2 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -21,9 +21,9 @@ jobs: strategy: matrix: os: - - { runner: ubuntu-latest, container: 'quay.io/pypa/manylinux_2_28_x86_64', name: linux } - - { runner: windows-latest, container: '', name: windows } - - { runner: macos-latest, container: '', name: mac } + - { runner: ubuntu-24.04, container: 'quay.io/pypa/manylinux_2_28_x86_64', name: linux } + - { runner: windows-2022, container: '', name: windows } + - { runner: macos-14, container: '', name: mac } container: ${{ matrix.os.container }} steps: - name: Checkout repository @@ -107,7 +107,7 @@ jobs: mkdir build cd build - cmake $ARCH_FLAGS -DCMAKE_BUILD_TYPE=Release -DBUILD_C_BINDS=ON -DWITH_NATIVE=OFF -DWITH_DICOM=OFF -DWITH_MULTI_THREADING=ON -DWITH_EMBEDDED_DB=OFF .. + cmake $ARCH_FLAGS -DCMAKE_BUILD_TYPE=Release -DBUILD_C_BINDS=ON -DWITH_NATIVE=OFF -DWITH_DICOM=ON -DWITH_EMBEDDED_DB=OFF .. cmake --build . --target install --config Release -j 4 working-directory: ${{ github.workspace }}/src/build/PenRed/src From 8ee557c260d607647390fa870b2dc1811e4d0f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicent=20Gim=C3=A9nez=20Alventosa?= Date: Sun, 2 Nov 2025 20:31:54 +0100 Subject: [PATCH 2/3] Add time-dependent geometry visualization support --- src/CMakeLists.txt | 2 +- src/mainwindow.cpp | 95 ++++++++- src/mainwindow.h | 19 ++ src/mainwindow.ui | 77 +++++++- src/pen_geoViewInterface.hh | 381 +++++++++++++++++++----------------- src/viewer.cpp | 54 +++-- src/viewer.h | 10 + 7 files changed, 425 insertions(+), 213 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eb84e9b..7f563eb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,7 +16,7 @@ if(BUILD_VIEW_SHARED_LIB) SOURCE_DIR "${CMAKE_SOURCE_DIR}/PenRed/repo" BINARY_DIR "${CMAKE_SOURCE_DIR}/PenRed" SOURCE_SUBDIR "src" - CMAKE_ARGS -DBUILD_C_BINDS=ON -DWITH_NATIVE=ON -DWITH_DICOM=OFF -DWITH_MULTI_THREADING=ON -DWITH_MPI=OFF -DWITH_LB=OFF -DDEVELOPMENT_WARNINGS=OFF + CMAKE_ARGS -DBUILD_C_BINDS=ON -DWITH_NATIVE=ON -DWITH_DICOM=OFF -DWITH_MPI=OFF -DWITH_LB=OFF -DDEVELOPMENT_WARNINGS=OFF ) install( diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5d3db21..5394c4f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -7,11 +7,18 @@ MainWindow::MainWindow(QWidget *parent) penRedViewer(nullptr), constructViewer(nullptr), destroyViewer(nullptr), - width3D(400), height3D(400), pixelSize3D(0.1) + width3D(400), height3D(400), pixelSize3D(0.1), + playing(false) { //Init viewer colors viewer::resetColors(); + //Create the animation timer + animationTimer = std::make_shared(this); + + animationTimer->setTimerType(Qt::PreciseTimer); + connect(animationTimer.get(), &QTimer::timeout, this, &MainWindow::updateTime); + setWindowTitle("PenRed Geometry Viewer"); ui->setupUi(this); @@ -30,6 +37,11 @@ MainWindow::MainWindow(QWidget *parent) << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).first()) << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first()); + + // Get home directory path + QString homeDir = QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first(); + + saveDialog.setDirectory(homeDir); // Start in home directory saveDialog.setSidebarUrls(urls); saveDialog.setFileMode(QFileDialog::AnyFile); saveDialog.setAcceptMode(QFileDialog::AcceptSave); @@ -37,16 +49,19 @@ MainWindow::MainWindow(QWidget *parent) //Configure load dialogs + loadConfigDialog.setDirectory(homeDir); // Start in home directory loadConfigDialog.setSidebarUrls(urls); loadConfigDialog.setFileMode(QFileDialog::ExistingFile); loadConfigDialog.setAcceptMode(QFileDialog::AcceptOpen); connect(&loadConfigDialog, &QFileDialog::fileSelected, this, &MainWindow::on_loadConfig); + loadQuadricDialog.setDirectory(homeDir); // Start in home directory loadQuadricDialog.setSidebarUrls(urls); loadQuadricDialog.setFileMode(QFileDialog::ExistingFile); loadQuadricDialog.setAcceptMode(QFileDialog::AcceptOpen); connect(&loadQuadricDialog, &QFileDialog::fileSelected, this, &MainWindow::on_loadQuadric); + loadMeshDialog.setDirectory(homeDir); // Start in home directory loadMeshDialog.setSidebarUrls(urls); loadMeshDialog.setFileMode(QFileDialog::ExistingFile); loadMeshDialog.setAcceptMode(QFileDialog::AcceptOpen); @@ -366,11 +381,26 @@ void MainWindow::on_loadConfig(const QString &file){ //Initialize the viewer in another thread QFuture future = QtConcurrent::run([this, file]{ + qInfo() << "Selected configuration file " << file << "\n"; + QFileInfo fileInfo(file); + QString directoryPath = fileInfo.absolutePath(); + QString originalWorkingDir = QDir::currentPath(); + + qInfo() << "Changing directory to " << directoryPath << "\n"; + + // Qt handles the platform-specific implementation + if (!QDir::setCurrent(directoryPath)) { + qWarning() << "Could not change to directory:" << directoryPath << "\n"; + } + + qInfo() << "Loading configuration file"; + int err = penRedViewer->init(file.toStdString().c_str()); if(err != 0){ - printf("Error loading the geometry\n"); - fflush(stdout); + qWarning() << "Error loading the geometry"; } + qInfo() << "Returning to original directory " << originalWorkingDir << "\n"; + QDir::setCurrent(originalWorkingDir); return err; }); @@ -549,6 +579,13 @@ void MainWindow::setActiveViewer(unsigned index){ if(viewersArray[activeViewer] != nullptr) viewersArray[activeViewer]->setStyleSheet("border: none"); + if(activeViewer != index){ + stopAnimation(); + ui->playButton->setIcon(QIcon::fromTheme("media-playback-start")); + if (ui->playButton->icon().isNull()) { + ui->playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); + } + } activeViewer = index; viewersArray[activeViewer]->setStyleSheet("border: 5px outset rgb(0,128,255); border-radius: 4px;"); @@ -586,6 +623,9 @@ void MainWindow::updateViewerInfo(){ ui->lookY->setText(QString::number(pviewer->readCamera3DY(), 'e', 5)); ui->lookZ->setText(QString::number(pviewer->readCamera3DZ(), 'e', 5)); + ui->Tedit->setValue(pviewer->readTime()); + ui->TStepEdit->setValue(pviewer->readDTime()); + updateKey(); } @@ -656,6 +696,55 @@ void MainWindow::on_Zedit_editingFinished() } } +void MainWindow::on_Tedit_valueChanged(double arg1){ + if(viewersArray[activeViewer] != nullptr){ + viewersArray[activeViewer]->setTime(arg1); + updateKey(); + } +} + +void MainWindow::on_playButton_released(){ + if(viewersArray[activeViewer] != nullptr){ + toggleAnimation(); + updateKey(); + } +} + +void MainWindow::updateTime() { + if(viewersArray[activeViewer] != nullptr){ + if(isPlaying()){ + viewersArray[activeViewer]->increaseTime(); + ui->Tedit->setValue(viewersArray[activeViewer]->readTime()); + } + } +} + +void MainWindow::toggleAnimation(){ + if(isPlaying()){ + animationTimer->stop(); + ui->playButton->setIcon(QIcon::fromTheme("media-playback-start")); + if (ui->playButton->icon().isNull()) { + ui->playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); + } + } else { + animationTimer->start(500); //Update every 500 ms + ui->playButton->setIcon(QIcon::fromTheme("media-playback-pause")); + + // Fallback if theme icon not available + if(ui->playButton->icon().isNull()) { + ui->playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPause)); + } + } + playing = !playing; +} + +void MainWindow::on_TStepEdit_valueChanged(double arg1){ + if(viewersArray[activeViewer] != nullptr){ + viewersArray[activeViewer]->setDTime(arg1); + updateKey(); + } +} + void MainWindow::on_matBodyViewButton_released() { if(viewersArray[activeViewer] != nullptr){ diff --git a/src/mainwindow.h b/src/mainwindow.h index c8e16f4..5bb12e1 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -63,6 +63,12 @@ private slots: void on_Zedit_editingFinished(); + void on_Tedit_valueChanged(double arg1); + + void on_TStepEdit_valueChanged(double arg1); + + void on_playButton_released(); + void on_matBodyViewButton_released(); void on_perspectiveSelector_currentIndexChanged(int index); @@ -143,6 +149,10 @@ private slots: unsigned width3D, height3D; double pixelSize3D; + std::shared_ptr animationTimer; + bool playing; + + Ui::MainWindow *ui; void setActiveViewer(unsigned index); @@ -166,5 +176,14 @@ private slots: void loadViewerColors(const QString &file); void saveViewerColors(const QString &file); + void updateTime(); + void toggleAnimation(); + inline bool isPlaying(){ return playing; } + inline void stopAnimation(){ + if(isPlaying()){ + toggleAnimation(); + } + } + }; #endif // MAINWINDOW_H diff --git a/src/mainwindow.ui b/src/mainwindow.ui index bacc01c..16371cd 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -27,7 +27,7 @@ - Qt::LeftToRight + Qt::LayoutDirection::LeftToRight true @@ -67,7 +67,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -80,7 +80,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -97,7 +97,7 @@ - QLayout::SetDefaultConstraint + QLayout::SizeConstraint::SetDefaultConstraint @@ -188,14 +188,14 @@ 0 0 262 - 767 + 836 - QLayout::SetDefaultConstraint + QLayout::SizeConstraint::SetDefaultConstraint @@ -307,6 +307,63 @@ + + + + 0 + + + + + Time (t, dt) s: + + + + + + + 5 + + + 5 + + + + + 100000.000000000000000 + + + 0.100000000000000 + + + + + + + -99.000000000000000 + + + 0.100000000000000 + + + 0.500000000000000 + + + + + + + + + + + + + + + + + @@ -326,7 +383,7 @@ - QLayout::SetDefaultConstraint + QLayout::SizeConstraint::SetDefaultConstraint @@ -413,7 +470,7 @@ 100.000000000000000 - QAbstractSpinBox::AdaptiveDecimalStepType + QAbstractSpinBox::StepType::AdaptiveDecimalStepType 0.100000000000000 @@ -423,7 +480,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -600,7 +657,7 @@ 100.000000000000000 - QAbstractSpinBox::AdaptiveDecimalStepType + QAbstractSpinBox::StepType::AdaptiveDecimalStepType 0.100000000000000 diff --git a/src/pen_geoViewInterface.hh b/src/pen_geoViewInterface.hh index 486796a..da7d401 100644 --- a/src/pen_geoViewInterface.hh +++ b/src/pen_geoViewInterface.hh @@ -3,6 +3,7 @@ // // Copyright (C) 2021-2022 Universitat de València - UV // Copyright (C) 2021-2022 Universitat Politècnica de València - UPV +// Copyright (C) 2025 Vicent Giménez Alventosa // // This file is part of PenRed: Parallel Engine for Radiation Energy Deposition. // @@ -17,7 +18,7 @@ // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License -// along with PenRed. If not, see . +// along with PenRed. If not, see . // // contact emails: // @@ -33,14 +34,15 @@ #include #include +#include struct geoError{ - double from[3]; - double to[3]; - unsigned int iIBODY, iMAT; //Initial - unsigned int eIBODY, eMAT; //Expected - unsigned int fIBODY, fMAT; //Final - bool endInVoid; + double from[3]; + double to[3]; + unsigned int iIBODY, iMAT; //Initial + unsigned int eIBODY, eMAT; //Expected + unsigned int fIBODY, fMAT; //Final + bool endInVoid; }; #else struct geoError; @@ -52,178 +54,199 @@ private: public: - virtual unsigned getBodies() const = 0; - - virtual std::string getBodyName(const unsigned ibody) const = 0; - - virtual double z2dir(const double u, - const double v, - const double w, - const double omega, - double rotation[9], - const double phiAux, - const double threshold) const = 0; - - virtual float z2dirf(const float u, - const float v, - const float w, - const float omega, - float rotation[9], - const float phiAux, - const float threshold) const = 0; - - virtual int init(const char* filename, - const unsigned verbose = 5) = 0; - - virtual void testX(std::vector& errors, - const float x, const float y, const float z, - const float dy, const float dz, - const unsigned ny, const unsigned nz) const = 0; - - virtual void renderX(unsigned char* renderMat,unsigned int* renderBody, - const float x, const float y, const float z, - const float dy, const float dz, - const unsigned ny, const unsigned nz, - const unsigned nthreads = 1) const = 0; - - virtual void renderXtoLeft(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dy, const float dz, - const unsigned ny, const unsigned nz) const = 0; - - virtual void renderXtoRight(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dy, const float dz, - const unsigned ny, const unsigned nz) const = 0; - - virtual void renderXtoUp(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dy, const float dz, - const unsigned ny, const unsigned nz) const = 0; - - virtual void renderXtoDown(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dy, const float dz, - const unsigned ny, const unsigned nz) const = 0; - - virtual void testY(std::vector& errors, - const float x, const float y, const float z, - const float dx, const float dz, - const unsigned nx, const unsigned nz) const = 0; - - virtual void renderY(unsigned char* renderMat,unsigned int* renderBody, - const float x, const float y, const float z, - const float dx, const float dz, - const unsigned nx, const unsigned nz, - const unsigned nthreads = 1) const = 0; - - virtual void renderYtoLeft(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dz, - const unsigned nx, const unsigned nz) const = 0; - - virtual void renderYtoRight(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dz, - const unsigned nx, const unsigned nz) const = 0; - - virtual void renderYtoUp(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dz, - const unsigned nx, const unsigned nz) const = 0; - - virtual void renderYtoDown(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dz, - const unsigned nx, const unsigned nz) const = 0; - - virtual void testZ(std::vector& errors, - const float x, const float y, const float z, - const float dx, const float dy, - const unsigned nx, const unsigned ny) const = 0; - - virtual void renderZ(unsigned char* renderMat,unsigned int* renderBody, - const float x, const float y, const float z, - const float dx, const float dy, - const unsigned nx, const unsigned ny, - const unsigned nthreads = 1) const = 0; - - virtual void renderZtoLeft(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dy, - const unsigned nx, const unsigned ny) const = 0; - - virtual void renderZtoRight(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dy, - const unsigned nx, const unsigned ny) const = 0; - - virtual void renderZtoUp(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dy, - const unsigned nx, const unsigned ny) const = 0; - - virtual void renderZtoDown(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dy, - const unsigned nx, const unsigned ny) const = 0; - - virtual int render3Dortho(unsigned char* renderMat,unsigned int* renderBody, - const float x, const float y, const float z, - const float u, const float v, const float w, - const float roll, float& phi, - float* distances, - float& minDistance, float& maxDistance, - const float threshold = 1.0e-4) const = 0; - - virtual int render3Dortho(unsigned char* renderMat,unsigned int* renderBody, - const float x, const float y, const float z, - const float u, const float v, const float w, - const float roll, float& phi, - const float dx, const float dy, - const unsigned nx, const unsigned ny, - float* distances, - float& minDistance, float& maxDistance, - const float threshold = 1.0e-4) const = 0; - - virtual void set3DResolution(const unsigned nx, const unsigned ny, - const float dx, const float dy, - const float perspective) = 0; - - - virtual int render3D(unsigned char* renderMat,unsigned int* renderBody, - const float x, const float y, const float z, - const float u, const float v, const float w, - const float roll, float& phi, - float* distances, - float& minDistance, float& maxDistance, - const float threshold = 1.0e-4) const = 0; - - virtual ~pen_geoViewInterface(){}; + virtual unsigned getBodies() const = 0; + + virtual std::string getBodyName(const unsigned ibody) const = 0; + + virtual double z2dir(const double u, + const double v, + const double w, + const double omega, + double rotation[9], + const double phiAux, + const double threshold) const = 0; + + virtual float z2dirf(const float u, + const float v, + const float w, + const float omega, + float rotation[9], + const float phiAux, + const float threshold) const = 0; + + virtual int init(const char* filename, + const unsigned verbose = 5) = 0; + + virtual void testX(std::vector& errors, + const float x, const float y, const float z, + const float dy, const float dz, + const unsigned ny, const unsigned nz, + const float t) const = 0; + + virtual void renderX(unsigned char* renderMat,unsigned int* renderBody, + const float x, const float y, const float z, + const float dy, const float dz, + const unsigned ny, const unsigned nz, + const float t, + const unsigned nthreads = 1) const = 0; + + virtual void renderXtoLeft(unsigned char* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dy, const float dz, + const unsigned ny, const unsigned nz, + const float t) const = 0; + + virtual void renderXtoRight(unsigned char* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dy, const float dz, + const unsigned ny, const unsigned nz, + const float t) const = 0; + + virtual void renderXtoUp(unsigned char* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dy, const float dz, + const unsigned ny, const unsigned nz, + const float t) const = 0; + + virtual void renderXtoDown(unsigned char* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dy, const float dz, + const unsigned ny, const unsigned nz, + const float t) const = 0; + + virtual void testY(std::vector& errors, + const float x, const float y, const float z, + const float dx, const float dz, + const unsigned nx, const unsigned nz, + const float t) const = 0; + + virtual void renderY(unsigned char* renderMat,unsigned int* renderBody, + const float x, const float y, const float z, + const float dx, const float dz, + const unsigned nx, const unsigned nz, + const float t, + const unsigned nthreads = 1) const = 0; + + virtual void renderYtoLeft(unsigned char* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dz, + const unsigned nx, const unsigned nz, + const float t) const = 0; + + virtual void renderYtoRight(unsigned char* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dz, + const unsigned nx, const unsigned nz, + const float t) const = 0; + + virtual void renderYtoUp(unsigned char* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dz, + const unsigned nx, const unsigned nz, + const float t) const = 0; + + virtual void renderYtoDown(unsigned char* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dz, + const unsigned nx, const unsigned nz, + const float t) const = 0; + + virtual void testZ(std::vector& errors, + const float x, const float y, const float z, + const float dx, const float dy, + const unsigned nx, const unsigned ny, + const float t) const = 0; + + virtual void renderZ(unsigned char* renderMat,unsigned int* renderBody, + const float x, const float y, const float z, + const float dx, const float dy, + const unsigned nx, const unsigned ny, + const float t, + const unsigned nthreads = 1) const = 0; + + virtual void renderZtoLeft(unsigned char* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dy, + const unsigned nx, const unsigned ny, + const float t) const = 0; + + virtual void renderZtoRight(unsigned char* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dy, + const unsigned nx, const unsigned ny, + const float t) const = 0; + + virtual void renderZtoUp(unsigned char* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dy, + const unsigned nx, const unsigned ny, + const float t) const = 0; + + virtual void renderZtoDown(unsigned char* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dy, + const unsigned nx, const unsigned ny, + const float t) const = 0; + + virtual int render3Dortho(unsigned char* renderMat,unsigned int* renderBody, + const float x, const float y, const float z, + const float u, const float v, const float w, + const float t, + const float roll, float& phi, + float* distances, + float& minDistance, float& maxDistance, + const float threshold = 1.0e-4) const = 0; + + virtual int render3Dortho(unsigned char* renderMat,unsigned int* renderBody, + const float x, const float y, const float z, + const float u, const float v, const float w, + const float t, + const float roll, float& phi, + const float dx, const float dy, + const unsigned nx, const unsigned ny, + float* distances, + float& minDistance, float& maxDistance, + const float threshold = 1.0e-4) const = 0; + + virtual void set3DResolution(const unsigned nx, const unsigned ny, + const float dx, const float dy, + const float perspective) = 0; + + + virtual int render3D(unsigned char* renderMat,unsigned int* renderBody, + const float x, const float y, const float z, + const float u, const float v, const float w, + const float t, + const float roll, float& phi, + float* distances, + float& minDistance, float& maxDistance, + const float threshold = 1.0e-4) const = 0; + + virtual ~pen_geoViewInterface(){}; }; #endif diff --git a/src/viewer.cpp b/src/viewer.cpp index af53011..d294c7c 100644 --- a/src/viewer.cpp +++ b/src/viewer.cpp @@ -8,7 +8,7 @@ viewer::viewer(std::vector& bufferIn, std::vector& distancesIn, QWidget *parent) : QWidget{parent}, buffer(bufferIn), matImage(matImageIn), bodyImage(bodyImageIn), distances(distancesIn), - x(0.0), y(0.0), z(0.0), xlast(0.0), ylast(0.0), zlast(0.0), camera3DX(0.0), camera3DY(0.0), camera3DZ(0.0), + x(0.0), y(0.0), z(0.0), t(0.0), dt(0.5), playing(false), xlast(0.0), ylast(0.0), zlast(0.0), camera3DX(0.0), camera3DY(0.0), camera3DZ(0.0), u(0.0), v(0.0), w(1.0), rho(10.0), theta(1.5707963267948966), phi(0.0), omega(-1.5707963267948966), lastRender3DPhi(0.0), perspective(0), matView(true), pixelSize(0.1), pixelSize3D(0.1), pPenRedViewer(nullptr), geometryLoaded(false) { @@ -250,77 +250,77 @@ void viewer::render(bool moveOnPlane, unsigned char direction, unsigned nPixels) switch(direction){ case 0: pPenRedViewer->renderXtoLeft(matImage.data(), bodyImage.data(), nPixels, - xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight); + xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight, t); break; case 1: pPenRedViewer->renderXtoRight(matImage.data(), bodyImage.data(), nPixels, - xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight); + xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight, t); break; case 2: pPenRedViewer->renderXtoUp(matImage.data(), bodyImage.data(), nPixels, - xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight); + xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight, t); break; case 3: pPenRedViewer->renderXtoDown(matImage.data(), bodyImage.data(), nPixels, - xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight); + xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight, t); break; } }else{ pPenRedViewer->renderX(matImage.data(), bodyImage.data(), - x,y,z, pixelSize, pixelSize, imageWidth, imageHeight, nthreads); + x,y,z, pixelSize, pixelSize, imageWidth, imageHeight, t, nthreads); } }else if(perspective == 1){ if(moveOnPlane){ switch(direction){ case 0: pPenRedViewer->renderYtoLeft(matImage.data(), bodyImage.data(), nPixels, - xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight); + xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight, t); break; case 1: pPenRedViewer->renderYtoRight(matImage.data(), bodyImage.data(), nPixels, - xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight); + xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight, t); break; case 2: pPenRedViewer->renderYtoUp(matImage.data(), bodyImage.data(), nPixels, - xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight); + xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight, t); break; case 3: pPenRedViewer->renderYtoDown(matImage.data(), bodyImage.data(), nPixels, - xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight); + xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight, t); break; } }else{ pPenRedViewer->renderY(matImage.data(), bodyImage.data(), - x,y,z, pixelSize, pixelSize, imageWidth, imageHeight, nthreads); + x,y,z, pixelSize, pixelSize, imageWidth, imageHeight, t, nthreads); } }else if(perspective == 2){ if(moveOnPlane){ switch(direction){ case 0: pPenRedViewer->renderZtoLeft(matImage.data(), bodyImage.data(), nPixels, - xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight); + xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight, t); break; case 1: pPenRedViewer->renderZtoRight(matImage.data(), bodyImage.data(), nPixels, - xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight); + xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight, t); break; case 2: pPenRedViewer->renderZtoUp(matImage.data(), bodyImage.data(), nPixels, - xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight); + xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight, t); break; case 3: pPenRedViewer->renderZtoDown(matImage.data(), bodyImage.data(), nPixels, - xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight); + xlast, ylast, zlast, pixelSize, pixelSize, imageWidth, imageHeight, t); break; } }else{ pPenRedViewer->renderZ(matImage.data(), bodyImage.data(), - x,y,z, pixelSize, pixelSize, imageWidth, imageHeight, nthreads); + x,y,z, pixelSize, pixelSize, imageWidth, imageHeight, t, nthreads); } }else if(perspective == 3){ pPenRedViewer->render3D(matImage.data(), bodyImage.data(), - camera3DX, camera3DY, camera3DZ, u, v, w, omega, lastRender3DPhi, distances.data(), minD, maxD); + camera3DX, camera3DY, camera3DZ, u, v, w, t, omega, lastRender3DPhi, distances.data(), minD, maxD); } xlast = x; @@ -517,13 +517,13 @@ std::vector viewer::test() const{ if(pPenRedViewer != nullptr && geometryLoaded){ if(perspective == 0){ pPenRedViewer->testX(errors, - x,y,z, pixelSize, pixelSize, imageWidth, imageHeight); + x,y,z, pixelSize, pixelSize, imageWidth, imageHeight, t); }else if(perspective == 1){ pPenRedViewer->testY(errors, - x,y,z, pixelSize, pixelSize, imageWidth, imageHeight); + x,y,z, pixelSize, pixelSize, imageWidth, imageHeight, t); }else if(perspective == 2){ pPenRedViewer->testZ(errors, - x,y,z, pixelSize, pixelSize, imageWidth, imageHeight); + x,y,z, pixelSize, pixelSize, imageWidth, imageHeight, t); }else if(perspective == 3){ //TODO @@ -572,6 +572,20 @@ void viewer::setZ(double newZ){ render(); } +void viewer::setTime(double newT){ + t = newT; + render(); +} + +void viewer::setDTime(double newDT){ + dt = newDT; +} + +void viewer::increaseTime(){ + t += dt; + render(); +} + void viewer::update3Ddirections(){ //Obtain x,y,z position diff --git a/src/viewer.h b/src/viewer.h index 723fc5b..d6fd7c5 100644 --- a/src/viewer.h +++ b/src/viewer.h @@ -52,6 +52,8 @@ class viewer : public QWidget QPixmap pixMap; double x, y, z; + double t, dt; + bool playing; double xlast, ylast, zlast; //Last x,y,z values //3D camera position perspective double camera3DX, camera3DY, camera3DZ; @@ -94,6 +96,8 @@ class viewer : public QWidget static std::array defaultColors(); static void resetColors(); + void increaseTime(); + void copy(const viewer& viewer2copy); void render(bool moveOnPlane = false, unsigned char direction = 0, unsigned nPixels = 0); @@ -111,6 +115,9 @@ class viewer : public QWidget constexpr double readY() const {return y;} constexpr double readZ() const {return z;} + constexpr double readTime() const {return t;} + constexpr double readDTime() const {return dt;} + constexpr double readRho() const {return rho;} constexpr double readTheta() const {return theta;} constexpr double readPhi() const {return phi;} @@ -140,6 +147,9 @@ class viewer : public QWidget void setY(double newY); void setZ(double newZ); + void setTime(double newT); + void setDTime(double newDT); + void setRho(double newRho); void setTheta(double newTheta); void setPhi(double newPhi); From 08863f01424512fe94b33ee3657efeab3246b96e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicent=20Gim=C3=A9nez=20Alventosa?= Date: Wed, 15 Apr 2026 21:07:16 +0200 Subject: [PATCH 3/3] Make viewer interface penRed v-1.15-compatible --- src/mainwindow.cpp | 2 +- src/mainwindow.h | 8 +- src/pen_geoViewInterface.hh | 435 ++++++++++++++++++------------------ src/viewer.cpp | 8 +- src/viewer.h | 10 +- 5 files changed, 233 insertions(+), 230 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5394c4f..bbdaa1d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -837,7 +837,7 @@ void MainWindow::on_testButton_released() QElapsedTimer timer; timer.start(); - std::vector errors = viewersArray[activeViewer]->test(); + std::vector errors = viewersArray[activeViewer]->test(); qint64 elapsed = timer.elapsed(); diff --git a/src/mainwindow.h b/src/mainwindow.h index 5bb12e1..a76cb7f 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -122,11 +122,11 @@ private slots: private: std::array,maxViewers> buffers; - std::array,maxViewers> matImages; + std::array,maxViewers> matImages; std::array,maxViewers> bodyImages; std::array,maxViewers> distances; - pen_geoViewInterface* penRedViewer; + penred::geometry::ViewerInterface* penRedViewer; QLibrary viewerLib; QFileDialog saveDialog; @@ -138,9 +138,9 @@ private slots: QVBoxLayout* colorListLayout; QColorDialog* selectColorDialog; - typedef pen_geoViewInterface* (*viewerConstructor)(); + typedef penred::geometry::ViewerInterface* (*viewerConstructor)(); viewerConstructor constructViewer; - typedef void (*viewerDestructor)(pen_geoViewInterface*); + typedef void (*viewerDestructor)(penred::geometry::ViewerInterface*); viewerDestructor destroyViewer; unsigned nViewers; diff --git a/src/pen_geoViewInterface.hh b/src/pen_geoViewInterface.hh index da7d401..3aa9f27 100644 --- a/src/pen_geoViewInterface.hh +++ b/src/pen_geoViewInterface.hh @@ -3,7 +3,7 @@ // // Copyright (C) 2021-2022 Universitat de València - UV // Copyright (C) 2021-2022 Universitat Politècnica de València - UPV -// Copyright (C) 2025 Vicent Giménez Alventosa +// Copyright (C) 2025-2026 Vicent Giménez Alventosa // // This file is part of PenRed: Parallel Engine for Radiation Energy Deposition. // @@ -30,223 +30,226 @@ #ifndef __PEN_GEO_VIEWER_INTERFACE__ #define __PEN_GEO_VIEWER_INTERFACE__ -#ifndef __PEN_GEO_VIEWER__ - #include #include #include -struct geoError{ - double from[3]; - double to[3]; - unsigned int iIBODY, iMAT; //Initial - unsigned int eIBODY, eMAT; //Expected - unsigned int fIBODY, fMAT; //Final - bool endInVoid; -}; -#else -struct geoError; -#endif - -class pen_geoViewInterface{ - -private: - -public: - - virtual unsigned getBodies() const = 0; - - virtual std::string getBodyName(const unsigned ibody) const = 0; - - virtual double z2dir(const double u, - const double v, - const double w, - const double omega, - double rotation[9], - const double phiAux, - const double threshold) const = 0; - - virtual float z2dirf(const float u, - const float v, - const float w, - const float omega, - float rotation[9], - const float phiAux, - const float threshold) const = 0; - - virtual int init(const char* filename, - const unsigned verbose = 5) = 0; - - virtual void testX(std::vector& errors, - const float x, const float y, const float z, - const float dy, const float dz, - const unsigned ny, const unsigned nz, - const float t) const = 0; - - virtual void renderX(unsigned char* renderMat,unsigned int* renderBody, - const float x, const float y, const float z, - const float dy, const float dz, - const unsigned ny, const unsigned nz, - const float t, - const unsigned nthreads = 1) const = 0; - - virtual void renderXtoLeft(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dy, const float dz, - const unsigned ny, const unsigned nz, - const float t) const = 0; - - virtual void renderXtoRight(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dy, const float dz, - const unsigned ny, const unsigned nz, - const float t) const = 0; - - virtual void renderXtoUp(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dy, const float dz, - const unsigned ny, const unsigned nz, - const float t) const = 0; - - virtual void renderXtoDown(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dy, const float dz, - const unsigned ny, const unsigned nz, - const float t) const = 0; - - virtual void testY(std::vector& errors, - const float x, const float y, const float z, - const float dx, const float dz, - const unsigned nx, const unsigned nz, - const float t) const = 0; - - virtual void renderY(unsigned char* renderMat,unsigned int* renderBody, - const float x, const float y, const float z, - const float dx, const float dz, - const unsigned nx, const unsigned nz, - const float t, - const unsigned nthreads = 1) const = 0; - - virtual void renderYtoLeft(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dz, - const unsigned nx, const unsigned nz, - const float t) const = 0; - - virtual void renderYtoRight(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dz, - const unsigned nx, const unsigned nz, - const float t) const = 0; - - virtual void renderYtoUp(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dz, - const unsigned nx, const unsigned nz, - const float t) const = 0; - - virtual void renderYtoDown(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dz, - const unsigned nx, const unsigned nz, - const float t) const = 0; - - virtual void testZ(std::vector& errors, - const float x, const float y, const float z, - const float dx, const float dy, - const unsigned nx, const unsigned ny, - const float t) const = 0; - - virtual void renderZ(unsigned char* renderMat,unsigned int* renderBody, - const float x, const float y, const float z, - const float dx, const float dy, - const unsigned nx, const unsigned ny, - const float t, - const unsigned nthreads = 1) const = 0; - - virtual void renderZtoLeft(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dy, - const unsigned nx, const unsigned ny, - const float t) const = 0; - - virtual void renderZtoRight(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dy, - const unsigned nx, const unsigned ny, - const float t) const = 0; - - virtual void renderZtoUp(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dy, - const unsigned nx, const unsigned ny, - const float t) const = 0; - - virtual void renderZtoDown(unsigned char* renderMat, - unsigned int* renderBody, - const unsigned nPixels, - const float x, const float y, const float z, - const float dx, const float dy, - const unsigned nx, const unsigned ny, - const float t) const = 0; - - virtual int render3Dortho(unsigned char* renderMat,unsigned int* renderBody, - const float x, const float y, const float z, - const float u, const float v, const float w, - const float t, - const float roll, float& phi, - float* distances, - float& minDistance, float& maxDistance, - const float threshold = 1.0e-4) const = 0; - - virtual int render3Dortho(unsigned char* renderMat,unsigned int* renderBody, - const float x, const float y, const float z, - const float u, const float v, const float w, - const float t, - const float roll, float& phi, - const float dx, const float dy, - const unsigned nx, const unsigned ny, - float* distances, - float& minDistance, float& maxDistance, - const float threshold = 1.0e-4) const = 0; - - virtual void set3DResolution(const unsigned nx, const unsigned ny, - const float dx, const float dy, - const float perspective) = 0; - - - virtual int render3D(unsigned char* renderMat,unsigned int* renderBody, - const float x, const float y, const float z, - const float u, const float v, const float w, - const float t, - const float roll, float& phi, - float* distances, - float& minDistance, float& maxDistance, - const float threshold = 1.0e-4) const = 0; - - virtual ~pen_geoViewInterface(){}; -}; - +namespace penred{ + + namespace geometry{ + + struct viewError{ + double from[3]; + double to[3]; + unsigned int iIBODY, iMAT; //Initial + unsigned int eIBODY, eMAT; //Expected + unsigned int fIBODY, fMAT; //Final + bool endInVoid; + }; + + class ViewerInterface{ + + private: + + public: + + virtual unsigned getBodies() const = 0; + + virtual std::string getBodyName(const unsigned ibody) const = 0; + + virtual double z2dir(const double u, + const double v, + const double w, + const double omega, + double rotation[9], + const double phiAux, + const double threshold) const = 0; + + virtual float z2dirf(const float u, + const float v, + const float w, + const float omega, + float rotation[9], + const float phiAux, + const float threshold) const = 0; + + virtual int init(const char* filename, + const unsigned verbose = 5) = 0; + + virtual void testX(std::vector& errors, + const float x, const float y, const float z, + const float dy, const float dz, + const unsigned ny, const unsigned nz, + const float t) const = 0; + + virtual void renderX(unsigned int* renderMat,unsigned int* renderBody, + const float x, const float y, const float z, + const float dy, const float dz, + const unsigned ny, const unsigned nz, + const float t, + const unsigned nthreads = 1) const = 0; + + virtual void renderXtoLeft(unsigned int* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dy, const float dz, + const unsigned ny, const unsigned nz, + const float t) const = 0; + + virtual void renderXtoRight(unsigned int* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dy, const float dz, + const unsigned ny, const unsigned nz, + const float t) const = 0; + + virtual void renderXtoUp(unsigned int* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dy, const float dz, + const unsigned ny, const unsigned nz, + const float t) const = 0; + + virtual void renderXtoDown(unsigned int* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dy, const float dz, + const unsigned ny, const unsigned nz, + const float t) const = 0; + + virtual void testY(std::vector& errors, + const float x, const float y, const float z, + const float dx, const float dz, + const unsigned nx, const unsigned nz, + const float t) const = 0; + + virtual void renderY(unsigned int* renderMat,unsigned int* renderBody, + const float x, const float y, const float z, + const float dx, const float dz, + const unsigned nx, const unsigned nz, + const float t, + const unsigned nthreads = 1) const = 0; + + virtual void renderYtoLeft(unsigned int* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dz, + const unsigned nx, const unsigned nz, + const float t) const = 0; + + virtual void renderYtoRight(unsigned int* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dz, + const unsigned nx, const unsigned nz, + const float t) const = 0; + + virtual void renderYtoUp(unsigned int* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dz, + const unsigned nx, const unsigned nz, + const float t) const = 0; + + virtual void renderYtoDown(unsigned int* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dz, + const unsigned nx, const unsigned nz, + const float t) const = 0; + + virtual void testZ(std::vector& errors, + const float x, const float y, const float z, + const float dx, const float dy, + const unsigned nx, const unsigned ny, + const float t) const = 0; + + virtual void renderZ(unsigned int* renderMat,unsigned int* renderBody, + const float x, const float y, const float z, + const float dx, const float dy, + const unsigned nx, const unsigned ny, + const float t, + const unsigned nthreads = 1) const = 0; + + virtual void renderZtoLeft(unsigned int* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dy, + const unsigned nx, const unsigned ny, + const float t) const = 0; + + virtual void renderZtoRight(unsigned int* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dy, + const unsigned nx, const unsigned ny, + const float t) const = 0; + + virtual void renderZtoUp(unsigned int* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dy, + const unsigned nx, const unsigned ny, + const float t) const = 0; + + virtual void renderZtoDown(unsigned int* renderMat, + unsigned int* renderBody, + const unsigned nPixels, + const float x, const float y, const float z, + const float dx, const float dy, + const unsigned nx, const unsigned ny, + const float t) const = 0; + + virtual int render3Dortho(unsigned int* renderMat,unsigned int* renderBody, + const float x, const float y, const float z, + const float u, const float v, const float w, + const float t, + const float roll, float& phi, + float* distances, + float& minDistance, float& maxDistance, + const float threshold = 1.0e-4) const = 0; + + virtual int render3Dortho(unsigned int* renderMat,unsigned int* renderBody, + const float x, const float y, const float z, + const float u, const float v, const float w, + const float t, + const float roll, float& phi, + const float dx, const float dy, + const unsigned nx, const unsigned ny, + float* distances, + float& minDistance, float& maxDistance, + const float threshold = 1.0e-4) const = 0; + + virtual void set3DResolution(const unsigned nx, const unsigned ny, + const float dx, const float dy, + const float perspective) = 0; + + + virtual int render3D(unsigned int* renderMat,unsigned int* renderBody, + const float x, const float y, const float z, + const float u, const float v, const float w, + const float t, + const float roll, float& phi, + float* distances, + float& minDistance, float& maxDistance, + const float threshold = 1.0e-4) const = 0; + + virtual ~ViewerInterface(){}; + }; + + } //namespace geometry + +} //namespace penred + #endif diff --git a/src/viewer.cpp b/src/viewer.cpp index d294c7c..fb25854 100644 --- a/src/viewer.cpp +++ b/src/viewer.cpp @@ -3,7 +3,7 @@ std::array viewer::colors; viewer::viewer(std::vector& bufferIn, - std::vector& matImageIn, + std::vector& matImageIn, std::vector& bodyImageIn, std::vector& distancesIn, QWidget *parent) @@ -511,9 +511,9 @@ void viewer::resizeImage(){ label.setPixmap(scaledPixMap); } -std::vector viewer::test() const{ +std::vector viewer::test() const{ - std::vector errors; + std::vector errors; if(pPenRedViewer != nullptr && geometryLoaded){ if(perspective == 0){ pPenRedViewer->testX(errors, @@ -543,7 +543,7 @@ void viewer::update3D(unsigned width, unsigned height, double pixSize){ //Setter functions -void viewer::setViewer(const pen_geoViewInterface* p, const bool _geometryLoaded){ +void viewer::setViewer(const penred::geometry::ViewerInterface* p, const bool _geometryLoaded){ geometryLoaded = _geometryLoaded; pPenRedViewer = p; } diff --git a/src/viewer.h b/src/viewer.h index d6fd7c5..8461ed1 100644 --- a/src/viewer.h +++ b/src/viewer.h @@ -38,7 +38,7 @@ class viewer : public QWidget static constexpr double stheta = 0.08715574274765817; std::vector& buffer; - std::vector& matImage; + std::vector& matImage; std::vector& bodyImage; std::vector& distances; float minD, maxD; @@ -71,7 +71,7 @@ class viewer : public QWidget double pixelSize; //in cm double pixelSize3D; //in cm - const pen_geoViewInterface* pPenRedViewer; + const penred::geometry::ViewerInterface* pPenRedViewer; QString keyText; //HTML text with key table @@ -88,7 +88,7 @@ class viewer : public QWidget public: explicit viewer(std::vector& bufferIn, - std::vector& matImageIn, + std::vector& matImageIn, std::vector& bodyImage, std::vector& distancesIn, QWidget *parent = nullptr); @@ -103,7 +103,7 @@ class viewer : public QWidget void render(bool moveOnPlane = false, unsigned char direction = 0, unsigned nPixels = 0); void resizeImage(); void updateMatView(); - std::vector test() const; + std::vector test() const; //Getter functions constexpr const QImage& readImage() const {return image;} @@ -138,7 +138,7 @@ class viewer : public QWidget //Setter functions - void setViewer(const pen_geoViewInterface* p, const bool _geometryLoaded = false); + void setViewer(const penred::geometry::ViewerInterface* p, const bool _geometryLoaded = false); void setImageWidth(unsigned width); void setImageHeight(unsigned height);