diff --git a/.gitignore b/.gitignore index 0278ddb..2add144 100644 --- a/.gitignore +++ b/.gitignore @@ -2,11 +2,13 @@ *.o *.egsphant.gz *.log +eb_gui eb_gui.app/* *.dcm *.stash source/moc_* source/Makefile +source/.qmake.stash */*.zip LDR_Phantom_Test_Case configuration.txt diff --git a/README.md b/README.md index 597b7fb..bed378c 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,11 @@ A Graphical User Interface (GUI) made for EGSnrc application egs_brachy, with ad Installation: -Ensure Qt5 is installed, along with an appropriate version of qmake along with it. Navigate to the source code directory, and invoke the following commands: +Ensure Qt 6 is installed (widgets and charts modules), along with an appropriate version of qmake. Navigate to the source code directory, and invoke the following commands: > qmake; > make -which will first create a Makefile using the appropriate Qt libraries on your computer qmake finds, then compile the actual program. The program is fairly robust and takes a while to compile, especially the database.cpp file which contains tag data for every DICOM tag. After compilation is complete, there should be an eb_gui file that is executeable in the parent directory. +which will first create a Makefile using the appropriate Qt libraries on your computer qmake finds, then compile the actual program. The program is fairly robust and takes a while to compile, especially the database.cpp file which contains tag data for every DICOM tag. After compilation is complete, there should be an `eb_gui` executable in the parent directory. + +On systems where both Qt 5 and Qt 6 are installed, invoke Qt 6's qmake explicitly (for example `qmake6` or the full path to Qt 6's `qmake`). diff --git a/source/GUI/appInterface.h b/source/GUI/appInterface.h index 78ed1d8..339210c 100644 --- a/source/GUI/appInterface.h +++ b/source/GUI/appInterface.h @@ -40,6 +40,7 @@ #ifndef APPINTERFACE_H #define APPINTERFACE_H +#include #include #include #include "../interface.h" diff --git a/source/GUI/doseInterface.cpp b/source/GUI/doseInterface.cpp index 087869b..b7ea440 100644 --- a/source/GUI/doseInterface.cpp +++ b/source/GUI/doseInterface.cpp @@ -40,12 +40,12 @@ // Constructors doseInterface::doseInterface() : -allowedReals(QRegExp(REGEX_REAL)), -allowedPosReals(QRegExp(REGEX_REAL_POS)), -allowedPosRealArrs(QRegExp(REGEX_REAL_POS_ARR)), -allowedNats(QRegExp(REGEX_NATURAL_POS)), -allowedPercents(QRegExp(REGEX_PERCENT)), -allowedPercentArrs(QRegExp(REGEX_PERCENT_ARR)) { +allowedReals(QRegularExpression(REGEX_REAL)), +allowedPosReals(QRegularExpression(REGEX_REAL_POS)), +allowedPosRealArrs(QRegularExpression(REGEX_REAL_POS_ARR)), +allowedNats(QRegularExpression(REGEX_NATURAL_POS)), +allowedPercents(QRegularExpression(REGEX_PERCENT)), +allowedPercentArrs(QRegularExpression(REGEX_PERCENT_ARR)) { parent = (Interface*)parentWidget(); log = new logWindow(); @@ -55,12 +55,12 @@ allowedPercentArrs(QRegExp(REGEX_PERCENT_ARR)) { } doseInterface::doseInterface(Interface* p) : -allowedReals(QRegExp(REGEX_REAL)), -allowedPosReals(QRegExp(REGEX_REAL_POS)), -allowedPosRealArrs(QRegExp(REGEX_REAL_POS_ARR)), -allowedNats(QRegExp(REGEX_NATURAL_POS)), -allowedPercents(QRegExp(REGEX_PERCENT)), -allowedPercentArrs(QRegExp(REGEX_PERCENT_ARR)) { +allowedReals(QRegularExpression(REGEX_REAL)), +allowedPosReals(QRegularExpression(REGEX_REAL_POS)), +allowedPosRealArrs(QRegularExpression(REGEX_REAL_POS_ARR)), +allowedNats(QRegularExpression(REGEX_NATURAL_POS)), +allowedPercents(QRegularExpression(REGEX_PERCENT)), +allowedPercentArrs(QRegularExpression(REGEX_PERCENT_ARR)) { parent = p; log = new logWindow(); @@ -880,7 +880,7 @@ void doseInterface::connectLayout() { sigMap->setMapping(isoDoseBox[1], 1); sigMap->setMapping(isoDoseBox[2], 2); - connect(sigMap, SIGNAL(mapped(int)), + connect(sigMap, SIGNAL(mappedInt(int)), this, SLOT(loadIsoDose(int))); // Change all colours @@ -902,7 +902,7 @@ void doseInterface::connectLayout() { for (int i = 0; i < 5; i++) sigMap->setMapping(isoColourButton[i], 3+i); - connect(sigMap, SIGNAL(mapped(int)), + connect(sigMap, SIGNAL(mappedInt(int)), this, SLOT(previewChangeColor(int))); // Histogram ~~~~~~~~~~~~ @@ -1954,7 +1954,7 @@ QImage doseInterface::createLegend() { pen.setColor(Qt::black); QFont font; - font.setWeight(75); + font.setWeight(QFont::Bold); font.setPointSize(10); painter.begin(&legend); @@ -3310,17 +3310,19 @@ void doseInterface::savePreviewEgsphant() { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Hover Label Class~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *******************************************************************************/ void HoverLabel::mousePressEvent(QMouseEvent *event) { - if (event->x() > 0 && event->x() < width() && event->y() > 0 && event->y() < height()) { - emit mouseClicked(event->x(),event->y()); + const QPoint p = event->position().toPoint(); + if (p.x() > 0 && p.x() < width() && p.y() > 0 && p.y() < height()) { + emit mouseClicked(p.x(), p.y()); } event->accept(); } void HoverLabel::wheelEvent(QWheelEvent *event) { - if (event->delta() > 0 && event->x() > 0 && event->x() < width() && event->y() > 0 && event->y() < height()) { + const QPointF p = event->position(); + if (event->angleDelta().y() > 0 && p.x() > 0 && p.x() < width() && p.y() > 0 && p.y() < height()) { emit mouseWheelUp(); } - else if (event->x() > 0 && event->x() < width() && event->y() > 0 && event->y() < height()) { + else if (p.x() > 0 && p.x() < width() && p.y() > 0 && p.y() < height()) { emit mouseWheelDown(); } event->accept(); diff --git a/source/GUI/doseInterface.h b/source/GUI/doseInterface.h index 26acea1..4abe26a 100644 --- a/source/GUI/doseInterface.h +++ b/source/GUI/doseInterface.h @@ -40,6 +40,7 @@ #ifndef DOSEINTERFACE_H #define DOSEINTERFACE_H +#include #include #include #include @@ -61,12 +62,12 @@ class doseInterface : public QWidget { Interface *parent; // Pointer to the parent to access data with - QRegExpValidator allowedReals; - QRegExpValidator allowedPosReals; - QRegExpValidator allowedPosRealArrs; - QRegExpValidator allowedNats; - QRegExpValidator allowedPercents; - QRegExpValidator allowedPercentArrs; + QRegularExpressionValidator allowedReals; + QRegularExpressionValidator allowedPosReals; + QRegularExpressionValidator allowedPosRealArrs; + QRegularExpressionValidator allowedNats; + QRegularExpressionValidator allowedPercents; + QRegularExpressionValidator allowedPercentArrs; // Shared objects QScrollArea *canvasArea; diff --git a/source/GUI/ebInterface.cpp b/source/GUI/ebInterface.cpp index f2325f1..2bd5873 100644 --- a/source/GUI/ebInterface.cpp +++ b/source/GUI/ebInterface.cpp @@ -40,7 +40,7 @@ // Constructors ebInterface::ebInterface() - : allowedNums(QRegExp(REGEX_REAL_POS)) { + : allowedNums(QRegularExpression(REGEX_REAL_POS)) { parent = (Interface*)parentWidget(); console = new consoleWindow; @@ -53,7 +53,7 @@ ebInterface::ebInterface() } ebInterface::ebInterface(Interface* p) - : allowedNums(QRegExp(REGEX_REAL_POS)) { + : allowedNums(QRegularExpression(REGEX_REAL_POS)) { parent = p; console = new consoleWindow(); diff --git a/source/GUI/ebInterface.h b/source/GUI/ebInterface.h index 3949393..811d731 100644 --- a/source/GUI/ebInterface.h +++ b/source/GUI/ebInterface.h @@ -39,6 +39,7 @@ #ifndef EBINTERFACE_H #define EBINTERFACE_H +#include #include #include #include "../interface.h" @@ -63,7 +64,7 @@ class ebInterface : public QWidget { // LAYOUT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ QGridLayout* mainLayout; - QRegExpValidator allowedNums; + QRegularExpressionValidator allowedNums; QFrame* simulationOptions; QGridLayout* simulationLayout; diff --git a/source/GUI/phantInterface.cpp b/source/GUI/phantInterface.cpp index 06bace9..f1bc4d3 100644 --- a/source/GUI/phantInterface.cpp +++ b/source/GUI/phantInterface.cpp @@ -44,7 +44,7 @@ phantInterface::phantInterface() // 1) some number of digits // 2) (e|E)[+]?\d{1,2} character e or E, an optional +, then 1-2 digits // 3) .\d*(e|E)[+]?\d{1,2} dot ., some number of digits, character e or E, an optional +, then 1-2 digits - : allowedNums(QRegExp(REGEX_REAL_POS)) { + : allowedNums(QRegularExpression(REGEX_REAL_POS)) { parent = (Interface*)parentWidget(); log = new logWindow(); @@ -58,7 +58,7 @@ phantInterface::phantInterface(Interface* p) // 1) some number of digits // 2) (e|E)[+]?\d{1,2} character e or E, an optional +, then 1-2 digits // 3) .\d*(e|E)[+]?\d{1,2} dot ., some number of digits, character e or E, an optional +, then 1-2 digits - : allowedNums(QRegExp(REGEX_REAL_POS)) { + : allowedNums(QRegularExpression(REGEX_REAL_POS)) { parent = p; log = new logWindow(); @@ -638,7 +638,7 @@ void phantInterface::loadCTFiles() { else { QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } if (temp.trimmed().compare("CT")) { // See if the field contains CT @@ -657,7 +657,7 @@ void phantInterface::loadCTFiles() { if (tempAtt->tag[0] == 0x0010 && tempAtt->tag[1] == 0x0010) { QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } phantNameEdit->setText(temp); @@ -725,7 +725,7 @@ void phantInterface::loadCTDir() { // Very similar to CT files with an extra ste else { QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } if (temp.trimmed().compare("CT")) { // See if the field contains CT @@ -744,7 +744,7 @@ void phantInterface::loadCTDir() { // Very similar to CT files with an extra ste if (tempAtt->tag[0] == 0x0010 && tempAtt->tag[1] == 0x0010 && tempAtt->vl) { QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } phantNameEdit->setText(temp); @@ -884,10 +884,10 @@ void phantInterface::loadStruct() { for (int l = 0; l < att->size(); l++) { if (att->at(l)->tag[0] == 0x3006 && att->at(l)->tag[1] == 0x0026) for (unsigned int s = 0; s < att->at(l)->vl; s++) - tempS.append(att->at(l)->vf[s]); + tempS.append(QChar(att->at(l)->vf[s])); else if (att->at(l)->tag[0] == 0x3006 && att->at(l)->tag[1] == 0x0022) for (unsigned int s = 0; s < att->at(l)->vl; s++) - tempI.append(att->at(l)->vf[s]); + tempI.append(QChar(att->at(l)->vf[s])); } tempS = tempS.trimmed().replace(" ", "_"); @@ -948,7 +948,7 @@ void phantInterface::loadStruct() { for (int m = 0; m < att2->size(); m++) if (att2->at(m)->tag[0] == 0x3006 && att2->at(m)->tag[1] == 0x0050) for (unsigned int s = 0; s < att2->at(m)->vl; s++) - tempS.append(att2->at(m)->vf[s]); + tempS.append(QChar(att2->at(m)->vf[s])); pointData = tempS.split('\\'); structZTemp.append(pointData[2].toDouble()/10.0); @@ -963,7 +963,7 @@ void phantInterface::loadStruct() { else if (att->at(l)->tag[0] == 0x3006 && att->at(l)->tag[1] == 0x0084) { QString tempI = ""; // Get the number for (unsigned int s = 0; s < att->at(l)->vl; s++) - tempI.append(att->at(l)->vf[s]); + tempI.append(QChar(att->at(l)->vf[s])); structReferenceTemp = tempI.toInt(); } } @@ -1135,7 +1135,7 @@ void phantInterface::refresh() { void phantInterface::loadHU2rho() { QString path = QFileDialog::getOpenFileName(this, tr("Load HU to density conversion table"), parent->data->gui_location+"/database/HU_conversion", tr("HU2RHO file (*.HU2RHO)")); - if (path < 1) + if (path.isEmpty()) return; // Check if it opens as a text file (at the very least) diff --git a/source/GUI/phantInterface.h b/source/GUI/phantInterface.h index 444cbee..58af4c8 100644 --- a/source/GUI/phantInterface.h +++ b/source/GUI/phantInterface.h @@ -39,6 +39,7 @@ #ifndef PHANTINTERFACE_H #define PHANTINTERFACE_H +#include #include #include #include "../interface.h" @@ -63,7 +64,7 @@ class phantInterface : public QWidget { // LAYOUT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ QGridLayout *mainLayout; - QRegExpValidator allowedNums; + QRegularExpressionValidator allowedNums; // Select DICOM files QLabel* dcmImport; diff --git a/source/GUI/sourceInterface.cpp b/source/GUI/sourceInterface.cpp index 4701d9e..a2c7245 100644 --- a/source/GUI/sourceInterface.cpp +++ b/source/GUI/sourceInterface.cpp @@ -206,7 +206,7 @@ void sourceInterface::loadPlan() { if (tempAtt->tag[0] == 0x0008 && tempAtt->tag[1] == 0x0060) {// See if it is (0008,0060) QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } if (temp.trimmed().compare("RTPLAN")) { @@ -228,7 +228,7 @@ void sourceInterface::loadPlan() { if (tempAtt->tag[0] == 0x0010 && tempAtt->tag[1] == 0x0010) { QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } tagEdit->setText(temp); diff --git a/source/GUI/sourceInterface.h b/source/GUI/sourceInterface.h index 07189e4..38635d0 100644 --- a/source/GUI/sourceInterface.h +++ b/source/GUI/sourceInterface.h @@ -39,6 +39,7 @@ #ifndef SOURCEINTERFACE_H #define SOURCEINTERFACE_H +#include #include #include #include "../interface.h" diff --git a/source/data.cpp b/source/data.cpp index ae7a5fa..b6a20ca 100644 --- a/source/data.cpp +++ b/source/data.cpp @@ -80,7 +80,7 @@ int Data::loadDefaults() { // EGS_CONFIG if (envVars.contains("EGS_CONFIG")) { // No HEN_HOUSE defined - QFileInfo egs_config = envVars.value("EGS_CONFIG"); + QFileInfo egs_config(envVars.value("EGS_CONFIG")); my_machine = egs_config.baseName(); } else { @@ -93,7 +93,7 @@ int Data::loadDefaults() { if (!envVars.contains("HEN_HOUSE")) { // No HEN_HOUSE defined // first try to figure it out based on EGS_CONFIG if (envVars.contains("EGS_CONFIG")) { // No HEN_HOUSE defined - QFileInfo egs_config = envVars.value("EGS_CONFIG"); + QFileInfo egs_config(envVars.value("EGS_CONFIG")); hh_location = QDir::cleanPath(egs_config.absolutePath() + "/../"); } else { @@ -121,12 +121,6 @@ int Data::loadDefaults() { } gui_location = QCoreApplication::applicationDirPath(); - #if defined(__APPLE__) - // on OSX applicationDirPath() resolves to ${EGS_HOME}/eb_gui/eb_gui.app/Contents/MacOS - // but it should resolve to ${EGS_HOME}/eb_gui - // so we go back 3 directories - gui_location = QDir::cleanPath(gui_location + "/../../.."); - #endif ep_location = hh_location+"scripts/bin/egs-parallel"; QFile *file; @@ -180,7 +174,7 @@ int Data::loadDefaults() { else if (text.left(33).compare("HU to egsphant conversion table =") == 0) hu_location = gui_location+text.right(text.length()-33).trimmed(); else if (text.left(27).compare("tissue assignment schemes =") == 0) - TAS_names = text.right(text.length()-27).trimmed().split(" ", QString::SkipEmptyParts); + TAS_names = text.right(text.length()-27).trimmed().split(" ", Qt::SkipEmptyParts); else if (text.left(24).compare("isodose line thickness =") == 0) isodoseLineThickness = text.right(text.length()-24).trimmed().toInt(); else if (text.left(22).compare("histogram bin count =") == 0) @@ -472,13 +466,13 @@ int Data::buildEgsphant(EGSPhant* phant, QString* log, int contourNum, int defau tempS = input.readLine(); if (tempS.contains(" ")) { - HUMap << tempS.split(' ', QString::SkipEmptyParts)[0].toDouble(); - denMap << tempS.split(' ', QString::SkipEmptyParts)[1].toDouble(); + HUMap << tempS.split(' ', Qt::SkipEmptyParts)[0].toDouble(); + denMap << tempS.split(' ', Qt::SkipEmptyParts)[1].toDouble(); *log = *log + " " + QString::number(HUMap.last()).rightJustified(8,' ') + " " + QString::number(denMap.last()) + "\n"; } else if (tempS.contains("\t")) { - HUMap << tempS.split('\t', QString::SkipEmptyParts)[0].toDouble(); - denMap << tempS.split('\t', QString::SkipEmptyParts)[1].toDouble(); + HUMap << tempS.split('\t', Qt::SkipEmptyParts)[0].toDouble(); + denMap << tempS.split('\t', Qt::SkipEmptyParts)[1].toDouble(); *log = *log + " " + QString::number(HUMap.last()).rightJustified(8,' ') + " " + QString::number(denMap.last()) + "\n"; } else { @@ -525,11 +519,11 @@ int Data::buildEgsphant(EGSPhant* phant, QString* log, int contourNum, int defau QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } - xySpacing.last()[0] = (temp.split('\\',QString::SkipEmptyParts)[0]).toDouble(); - xySpacing.last()[1] = (temp.split('\\',QString::SkipEmptyParts)[1]).toDouble(); + xySpacing.last()[0] = (temp.split('\\',Qt::SkipEmptyParts)[0]).toDouble(); + xySpacing.last()[1] = (temp.split('\\',Qt::SkipEmptyParts)[1]).toDouble(); } else return 201; @@ -539,7 +533,7 @@ int Data::buildEgsphant(EGSPhant* phant, QString* log, int contourNum, int defau if (tempAtt->tag[0] == 0x0018 && tempAtt->tag[1] == 0x0050) { QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } zSpacing.append(temp.toDouble()); @@ -555,12 +549,12 @@ int Data::buildEgsphant(EGSPhant* phant, QString* log, int contourNum, int defau QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } - imagePos.last()[0] = (temp.split('\\',QString::SkipEmptyParts)[0]).toDouble(); - imagePos.last()[1] = (temp.split('\\',QString::SkipEmptyParts)[1]).toDouble(); - imagePos.last()[2] = (temp.split('\\',QString::SkipEmptyParts)[2]).toDouble(); + imagePos.last()[0] = (temp.split('\\',Qt::SkipEmptyParts)[0]).toDouble(); + imagePos.last()[1] = (temp.split('\\',Qt::SkipEmptyParts)[1]).toDouble(); + imagePos.last()[2] = (temp.split('\\',Qt::SkipEmptyParts)[2]).toDouble(); } else return 203; @@ -596,7 +590,7 @@ int Data::buildEgsphant(EGSPhant* phant, QString* log, int contourNum, int defau if (tempAtt->tag[0] == 0x0028 && tempAtt->tag[1] == 0x1053) { QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } rescaleM = temp.toDouble(); @@ -608,7 +602,7 @@ int Data::buildEgsphant(EGSPhant* phant, QString* log, int contourNum, int defau if (tempAtt->tag[0] == 0x0028 && tempAtt->tag[1] == 0x1052) { QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } rescaleB = temp.toDouble(); @@ -1183,7 +1177,7 @@ int Data::parsePlan(QString* log) { if (tempAtt->tag[0] == 0x300A && tempAtt->tag[1] == 0x0202) { QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } treatmentType = temp.trimmed(); } @@ -1197,7 +1191,7 @@ int Data::parsePlan(QString* log) { if (tempAtt->tag[0] == 0x300A && tempAtt->tag[1] == 0x0200) { QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } treatmentTechnique = temp.trimmed(); } @@ -1211,7 +1205,7 @@ int Data::parsePlan(QString* log) { if (tempAtt->tag[0] == 0x300A && tempAtt->tag[1] == 0x0006) { QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } treatDate = temp.trimmed(); } @@ -1219,7 +1213,7 @@ int Data::parsePlan(QString* log) { if (tempAtt->tag[0] == 0x300A && tempAtt->tag[1] == 0x0007) { QString temp = ""; for (unsigned int s = 0; s < tempAtt->vl; s++) { - temp.append(tempAtt->vf[s]); + temp.append(QChar(tempAtt->vf[s])); } treatTime = temp.trimmed(); } @@ -1251,19 +1245,19 @@ int Data::parsePlan(QString* log) { for (int l = 0; l < att->size(); l++) { if (att->at(l)->tag[0] == 0x300A && att->at(l)->tag[1] == 0x022A) for (unsigned int s = 0; s < att->at(l)->vl; s++) - tempS.append(att->at(l)->vf[s]); + tempS.append(QChar(att->at(l)->vf[s])); else if (att->at(l)->tag[0] == 0x300A && att->at(l)->tag[1] == 0x0228) for (unsigned int s = 0; s < att->at(l)->vl; s++) - tempI.append(att->at(l)->vf[s]); + tempI.append(QChar(att->at(l)->vf[s])); else if (att->at(l)->tag[0] == 0x300A && att->at(l)->tag[1] == 0x0226) for (unsigned int s = 0; s < att->at(l)->vl; s++) - tempE.append(att->at(l)->vf[s]); + tempE.append(QChar(att->at(l)->vf[s])); else if (att->at(l)->tag[0] == 0x300A && att->at(l)->tag[1] == 0x0216) { if (tempInf != "") tempInf = tempInf + " - "; for (unsigned int s = 0; s < att->at(l)->vl; s++) { - tempInf.append(att->at(l)->vf[s]); + tempInf.append(QChar(att->at(l)->vf[s])); } } else if (att->at(l)->tag[0] == 0x300A && att->at(l)->tag[1] == 0x021B) { @@ -1271,7 +1265,7 @@ int Data::parsePlan(QString* log) { tempInf = tempInf + " - "; for (unsigned int s = 0; s < att->at(l)->vl; s++) { - tempInf.append(att->at(l)->vf[s]); + tempInf.append(QChar(att->at(l)->vf[s])); } } else if (att->at(l)->tag[0] == 0x300A && att->at(l)->tag[1] == 0x021C) { @@ -1279,10 +1273,10 @@ int Data::parsePlan(QString* log) { } else if (att->at(l)->tag[0] == 0x300A && att->at(l)->tag[1] == 0x022C) for (unsigned int s = 0; s < att->at(l)->vl; s++) - tempD.append(att->at(l)->vf[s]); + tempD.append(QChar(att->at(l)->vf[s])); else if (att->at(l)->tag[0] == 0x300A && att->at(l)->tag[1] == 0x022E) for (unsigned int s = 0; s < att->at(l)->vl; s++) - tempT.append(att->at(l)->vf[s]); + tempT.append(QChar(att->at(l)->vf[s])); } if (airKerma == -1 && tempS != "") @@ -1419,7 +1413,7 @@ int Data::parsePlan(QString* log) { for (int n = 0; n < att3->size(); n++) { if (att3->at(n)->tag[0] == 0x300A && att3->at(n)->tag[1] == 0x02D4) { // Seed position for (unsigned int s = 0; s < att3->at(n)->vl; s++) { - tempS.append(att3->at(n)->vf[s]); + tempS.append(QChar(att3->at(n)->vf[s])); } pointData2 = tempS.split('\\'); @@ -1433,7 +1427,7 @@ int Data::parsePlan(QString* log) { else if (att3->at(n)->tag[0] == 0x300A && att3->at(n)->tag[1] == 0x02D6) { // Seed time weight for (unsigned int s = 0; s < att3->at(n)->vl; s++) { - tempT.append(att3->at(n)->vf[s]); + tempT.append(QChar(att3->at(n)->vf[s])); } tempDwellTimes.append(tempT.toDouble()); @@ -1486,7 +1480,7 @@ int Data::parsePlan(QString* log) { *log = *log + "Found " + QString::number(seedPos.size()) + " seeds\n"; treatmentTime /= 3600; // Go from seconds to hours if (treatmentTime > 0) { - *log = *log + " with " + QString::number(seedTime.size()) + " associated dwell times over " + treatmentTime + "\n"; + *log = *log + " with " + QString::number(seedTime.size()) + " associated dwell times over " + QString::number(treatmentTime) + "\n"; } *log = *log + "----------------------------------------------\n"; diff --git a/source/data.h b/source/data.h index 3a135ad..33c7743 100644 --- a/source/data.h +++ b/source/data.h @@ -39,6 +39,7 @@ #ifndef DATA_H #define DATA_H +#include #include #include diff --git a/source/data/DICOM.cpp b/source/data/DICOM.cpp index 5fd00e8..666621d 100644 --- a/source/data/DICOM.cpp +++ b/source/data/DICOM.cpp @@ -122,7 +122,7 @@ int DICOM::parse(QString p) { file.close(); return 102; } - else if ((QString(dat[0])+dat[1]+dat[2]+dat[3]) != "DICM") { + else if ((QString::fromLatin1(reinterpret_cast(dat), 4)) != "DICM") { // Not a DICOM file delete[] dat; file.close(); @@ -180,7 +180,7 @@ int DICOM::parse(QString p) { // Find the closest tag in the database Reference closest = lib->binSearch(temp->tag[0], temp->tag[1], 0, lib->lib.size()-1); - QString tempVR = QString(dat[0])+dat[1]; + QString tempVR = QString::fromLatin1(reinterpret_cast(dat), 2); if (closest.tag[0] == temp->tag[0] && closest.tag[1] == temp->tag[1]) { // Found the tag temp->desc = closest.title; l++; @@ -206,7 +206,7 @@ int DICOM::parse(QString p) { // It is either explicit or we are in the syntax defining tags at the start if (!isImplicit || temp->tag[0] == 0x0002) { - VR = QString(dat[0])+dat[1]; + VR = QString::fromLatin1(reinterpret_cast(dat), 2); readVR = true; #if defined(OUTPUT_ALL) || defined(OUTPUT_TAG) @@ -216,7 +216,7 @@ int DICOM::parse(QString p) { #endif } // Check for explicit VRs when using custom tags even if isImplicit else if (ALLOW_LOOSE_CUSTOM_TAGS && isImplicit && !temp->desc.compare("Unknown Tag")) { - QString tempVR = QString(dat[0])+dat[1]; + QString tempVR = QString::fromLatin1(reinterpret_cast(dat), 2); unsigned long int tempVL = ((unsigned int)(dat[3]) << 24) + ((unsigned int)(dat[2]) << 16) + ((unsigned int)(dat[1]) << 8) + @@ -448,7 +448,7 @@ int DICOM::parse(QString p) { if (temp->tag[0] == 0x0020 && temp->tag[1] == 0x0013) { QString tempS = ""; for (unsigned int s = 0; s < temp->vl; s++) { - tempS.append(temp->vf[s]); + tempS.append(QChar(temp->vf[s])); } n = tempS.toInt(); @@ -458,7 +458,7 @@ int DICOM::parse(QString p) { //if (temp->tag[0] == 0x0020 && temp->tag[1] == 0x1041) { // removed as it wasn't // QString tempS = ""; // always correct in all // for (unsigned int s = 0; s < temp->vl; s++) { // datasets - // tempS.append(temp->vf[s]); + // tempS.append(QChar(temp->vf[s])); // } // // z = tempS.toDouble(); @@ -466,7 +466,7 @@ int DICOM::parse(QString p) { if (temp->tag[0] == 0x0020 && temp->tag[1] == 0x0032) { QString tempS = ""; for (unsigned int s = 0; s < temp->vl; s++) { // Image Position Patient - tempS.append(temp->vf[s]); + tempS.append(QChar(temp->vf[s])); } z = tempS.split("\\").last().toDouble(); @@ -835,7 +835,7 @@ int DICOM::parseSequence(QDataStream *in, QVector *att) { return 0; } - VR = QString(dat[0])+dat[1]; + VR = QString::fromLatin1(reinterpret_cast(dat), 2); #if defined(OUTPUT_READ_SQ) std::cout << ((unsigned short int)(dat[0]) << 8) + (unsigned short int)dat[1] << " -> " << VR.toStdString() << " | Size "; std::cout.flush(); #endif @@ -959,7 +959,7 @@ int DICOM::parseSequence(QDataStream *in, QVector *att) { if (!nested) { QString tempS = ""; for (unsigned int s = 0; s < temp->vl; s++) - tempS.append(temp->vf[s]); + tempS.append(QChar(temp->vf[s])); std::cout << tempS.toStdString() << "\n"; } else { diff --git a/source/data/DICOM.h b/source/data/DICOM.h index bc6ec51..b27563a 100644 --- a/source/data/DICOM.h +++ b/source/data/DICOM.h @@ -39,6 +39,7 @@ #ifndef DICOM_H #define DICOM_H +#include #include #include #include diff --git a/source/data/input.cpp b/source/data/input.cpp index e8e5afc..c93f71f 100644 --- a/source/data/input.cpp +++ b/source/data/input.cpp @@ -223,7 +223,7 @@ QString EGSInput::buildInput() { output = output + "\tscore energy deposition = " + SO_edep + "\n"; output = output + "\tmuen file = " + SO_muenFile + "\n"; output = output + "\tmuen for media = " + SO_muenMed + "\n"; - if (SO_scale != 1) + if (SO_scale != QLatin1String("1")) output = output + "\tdose scaling factor = " + SO_scale + "\n"; output = output + ":stop scoring options:\n"; output = output + "#----------------------------------------------------------------------------------------------------\n"; diff --git a/source/interface.cpp b/source/interface.cpp index 76afa3f..a374ed8 100644 --- a/source/interface.cpp +++ b/source/interface.cpp @@ -48,7 +48,7 @@ Interface::Interface() // 1) some number of digits // 2) (e|E)[+-]?\d{1,2} character e or E, an optional +, then 1-2 digits // 3) .\d*(e|E)[+]?\d{1,2} dot ., some number of digits, character e or E, an optional +, then 1-2 digits - : allowedNums(QRegExp(REGEX_REAL_POS)) { + : allowedNums(QRegularExpression(REGEX_REAL_POS)) { // Create the data backend data = new Data(); int err = data->loadDefaults(); // load default parameters @@ -1179,9 +1179,9 @@ int Interface::populateEgsinp() { if (line.startsWith("media =")) { if (line.contains(",")) - media = line.split('=')[1].trimmed().split(",",QString::SkipEmptyParts); + media = line.split('=')[1].trimmed().split(",",Qt::SkipEmptyParts); else - media = line.split('=')[1].trimmed().split(" ",QString::SkipEmptyParts); + media = line.split('=')[1].trimmed().split(" ",Qt::SkipEmptyParts); break; } } @@ -1304,7 +1304,7 @@ void Interface::finishedProgress(){ // EGS_geom~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EGS_geom::EGS_geom(QString n, int ind) : name (n), index(ind), -allowedNums(QRegExp(REGEX_REAL)), +allowedNums(QRegularExpression(REGEX_REAL)), // -?[\d*] potential -, then one digit followed by: // 1) some number of digits // 2) (e|E)[+-]?\d{1,2} character e or E, an optional + or -, then 1-2 digits diff --git a/source/interface.h b/source/interface.h index b8396ba..2c90a2b 100644 --- a/source/interface.h +++ b/source/interface.h @@ -39,6 +39,7 @@ #ifndef INTERFACE_H #define INTERFACE_H +#include #include #include "data.h" #include "libraries/gzstream.h" @@ -109,7 +110,7 @@ public slots: public: void createGlobalWidgets(); - QRegExpValidator allowedNums; // Positive, real numbers + QRegularExpressionValidator allowedNums; // Positive, real numbers bool firstDelete = true; // Ask if they're sure they want to delete something the firstDelete // time they try //Maximum dwell time @@ -255,7 +256,7 @@ class EGS_geom : public QWidget { public: QString name; int index; - QRegExpValidator allowedNums; + QRegularExpressionValidator allowedNums; QIntValidator allowedPrios; // Transformations list diff --git a/source/main.cpp b/source/main.cpp index dbd0f31..5978735 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -41,6 +41,7 @@ #include "GUI/phantInterface.h" #include "GUI/sourceInterface.h" +#include #include #include #include diff --git a/source/source.pro b/source/source.pro index edb9fc4..bf72766 100644 --- a/source/source.pro +++ b/source/source.pro @@ -1,5 +1,5 @@ ###################################################################### -# Automatically generated by qmake (3.1) Thu Nov 18 12:06:56 2021 +# egs_brachy_GUI — Qt 6 project file ###################################################################### QT += widgets @@ -9,16 +9,13 @@ TEMPLATE = app TARGET = ../eb_gui INCLUDEPATH += . -# The following define makes your compiler warn you if you use any -# feature of Qt which has been marked as deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS +CONFIG += c++17 +# Prefer a plain executable (../eb_gui) over an .app bundle on macOS +CONFIG -= app_bundle -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 +# Fail the build on APIs deprecated before Qt 6.0 +DEFINES += QT_DEPRECATED_WARNINGS +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # Input HEADERS += data.h \