Skip to content

Commit

Permalink
Merge branch 'commontk:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
txdy077345 authored Mar 26, 2024
2 parents 4475cc9 + fb72e1a commit 9f22fe7
Show file tree
Hide file tree
Showing 647 changed files with 14,315 additions and 13,679 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

# Exclude QtCreator files ...
CMakeLists.txt.user*
CMakeCache.txt
CMakeFiles/cmake.check_cache

# ignore ctags file
tags
60 changes: 30 additions & 30 deletions Applications/Testing/Cpp/ctkDICOMApplicationTest1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ enum WaitType
int wait_for_finished(QTextStream& out, const QString& type, QProcess* process, bool kill=false)
{
try
{
{
QString programName = QFileInfo(process->program()).baseName();

if (kill)
{
{
process->kill();
}
}

process->waitForFinished();

Expand All @@ -96,19 +96,19 @@ int wait_for_finished(QTextStream& out, const QString& type, QProcess* process,

out << "Process ExitCode: ";
if (process->exitCode() == QProcess::NormalExit)
{
{
out << "NormalExit (" << static_cast<int>(QProcess::NormalExit) << ")\n";
}
}
else
{
{
out << "CrashExit (" << static_cast<int>(QProcess::CrashExit) << ")\n";
}
}

if (process->exitCode() == QProcess::CrashExit)
{
{
out << "Process State: ";
switch(static_cast<int>(process->error()))
{
{

#define _QProcessErrorToString(ERROR) \
case QProcess::ERROR: \
Expand All @@ -123,27 +123,27 @@ int wait_for_finished(QTextStream& out, const QString& type, QProcess* process,
_QProcessErrorToString(UnknownError);

#undef _QProcessErrorToString
}
}
}
out << "Standard Output:\n";
out << process->readAllStandardOutput();
out << "Standard Error:\n";
out << process->readAllStandardError();

if (kill)
{
{
return EXIT_SUCCESS;
}
}
else
{
{
return process->exitStatus() == QProcess::NormalExit ? process->exitCode() : EXIT_FAILURE;
}
}
}
catch (const std::exception& e)
{
{
out << "ERROR: exception ocurred in wait_for_finished(): " << e.what();
return EXIT_FAILURE;
}
}
}

//-----------------------------------------------------------------------------
Expand All @@ -157,28 +157,28 @@ int run_process(

out << "------------------------------------------------------------------------------\n";
if (type == "server")
{
{
out << " ____ _____ ______ _______ ____ " << "\n";
out << " / ___|| ____| _ \\ \\ / / ____| _ \\ " << "\n";
out << " \\___ \\| _| | |_) \\ \\ / /| _| | |_) |" << "\n";
out << " ___) | |___| _ < \\ V / | |___| _ < " << "\n";
out << " |____/|_____|_| \\_\\ \\_/ |_____|_| \\_\\" << "\n";
}
}

else if (type == "client")
{
{
out << " ____ _ ___ _____ _ _ _____ " << "\n";
out << " / ___| | |_ _| ____| \\ | |_ _|" << "\n";
out << "| | | | | || _| | \\| | | | " << "\n";
out << "| |___| |___ | || |___| |\\ | | | " << "\n";
out << " \\____|_____|___|_____|_| \\_| |_| " << "\n";
}
}
out << "------------------------------------------------------------------------------\n";
out << "starting " << type << " " << exectuable << "\n";
out << "with args " << arguments.join(" ") << "\n";
process->start(exectuable, arguments);
switch(wait_type)
{
{
case WaitForStarted:
process->waitForStarted();
out << programName << " Started.\n";
Expand All @@ -189,7 +189,7 @@ int run_process(

default:
return EXIT_FAILURE;
}
}
}
catch (const std::exception& e)
{
Expand Down Expand Up @@ -240,12 +240,12 @@ int main(int argc, char * argv []) {
{
CHECK_EXIT_SUCCESS(
run_process(out, "server", WaitForStarted, dcmqrscp, dcmqrscp_exe,
{
{
"--config", dcmqrscp_cfg,
"--debug",
"--verbose",
"11112"
}));
}));
}


Expand All @@ -257,13 +257,13 @@ int main(int argc, char * argv []) {
{
CHECK_EXIT_SUCCESS(
run_process(out, "client", WaitForFinished, storescu, storescu_exe,
{
{
"-aec", "CTK_AE",
"-aet", "CTK_AE",
"localhost", "11112",
dicomData1,
dicomData2,
}));
}));
}


Expand All @@ -279,13 +279,13 @@ int main(int argc, char * argv []) {

CHECK_EXIT_SUCCESS(
run_process(out, "client", WaitForFinished, ctkDICOMQuery, ctkDICOMQuery_exe,
{
{
ctkDICOMQuery_db_file,
"CTK_AE",
"CTK_AE",
"localhost",
"11112"
}));
}));
}


Expand All @@ -303,15 +303,15 @@ int main(int argc, char * argv []) {

CHECK_EXIT_SUCCESS(
run_process(out, "client", WaitForFinished, ctkDICOMRetrieve, ctkDICOMRetrieve_exe,
{
{
studyUID,
ctkDICOMRetrieve_directory,
"CTK_AE",
"CTK_AE",
"localhost",
"11112",
"CTK_CLIENT_AE"
}));
}));
}


Expand Down
12 changes: 6 additions & 6 deletions Applications/ctkDICOM/Testing/Cpp/ctkDICOMTest1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ int ctkDICOMTest1(int argc, char * argv [])
QString testName = arguments.takeFirst();

if (arguments.count() != 1)
{
{
std::cerr << "Usage: " << qPrintable(testName)
<< " <path-to-ctkDICOM-executable>" << std::endl;
return EXIT_FAILURE;
}
}

QString command = arguments.at(0);

Expand All @@ -49,18 +49,18 @@ int ctkDICOMTest1(int argc, char * argv [])
process.start(command, /* arguments= */ QStringList());
bool res = process.waitForStarted();
if (!res)
{
{
std::cerr << '\"' << qPrintable(command) << '\"'
<< " didn't start correctly" << std::endl;
return res ? EXIT_SUCCESS : EXIT_FAILURE;
}
}
process.kill();
res = process.waitForFinished();
if (!res)
{
{
std::cerr << '\"' << qPrintable(command) << '\"'
<< " failed to terminate" << std::endl;
return res ? EXIT_SUCCESS : EXIT_FAILURE;
}
}
return res ? EXIT_SUCCESS : EXIT_FAILURE;
}
12 changes: 6 additions & 6 deletions Applications/ctkDICOM2/Testing/Cpp/ctkDICOM2Test1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ int ctkDICOM2Test1(int argc, char * argv [])
QString testName = arguments.takeFirst();

if (arguments.count() != 1)
{
{
std::cerr << "Usage: " << qPrintable(testName)
<< " <path-to-ctkDICOM-executable>" << std::endl;
return EXIT_FAILURE;
}
}

QString command = arguments.at(0);

Expand All @@ -49,18 +49,18 @@ int ctkDICOM2Test1(int argc, char * argv [])
process.start(command, /* arguments= */ QStringList());
bool res = process.waitForStarted();
if (!res)
{
{
std::cerr << '\"' << qPrintable(command) << '\"'
<< " didn't start correctly" << std::endl;
return res ? EXIT_SUCCESS : EXIT_FAILURE;
}
}
process.kill();
res = process.waitForFinished();
if (!res)
{
{
std::cerr << '\"' << qPrintable(command) << '\"'
<< " failed to terminate" << std::endl;
return res ? EXIT_SUCCESS : EXIT_FAILURE;
}
}
return res ? EXIT_SUCCESS : EXIT_FAILURE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ int ctkDICOMDemoSCUTest1(int argc, char * argv [])
QString testName = arguments.takeFirst();

if (arguments.count() != 1)
{
{
std::cerr << "Usage: " << qPrintable(testName)
<< " <path-to-ctkDICOMDemoSCU-executable>" << std::endl;
return EXIT_FAILURE;
}
}

QString command = arguments.at(0);

Expand All @@ -54,10 +54,10 @@ int ctkDICOMDemoSCUTest1(int argc, char * argv [])

int res = QProcess::execute(command, parameters);
if (res != EXIT_SUCCESS)
{
{
std::cerr << '\"' << qPrintable(command) << '\"'
<< " returned " << res << std::endl;
return res;
}
}
return res;
}
12 changes: 6 additions & 6 deletions Applications/ctkDICOMHost/Testing/Cpp/ctkDICOMHostTest1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ int ctkDICOMHostTest1(int argc, char * argv [])
QString testName = arguments.takeFirst();

if (arguments.count() != 1)
{
{
std::cerr << "Usage: " << qPrintable(testName)
<< " <path-to-ctkDICOMHost-executable>" << std::endl;
return EXIT_FAILURE;
}
}

QString command = arguments.at(0);

Expand All @@ -51,18 +51,18 @@ int ctkDICOMHostTest1(int argc, char * argv [])
process.start(command, /* arguments= */ QStringList());
bool res = process.waitForStarted();
if (!res)
{
{
std::cerr << '\"' << qPrintable(command) << '\"'
<< " didn't start correctly" << std::endl;
return res ? EXIT_SUCCESS : EXIT_FAILURE;
}
}
process.kill();
res = process.waitForFinished();
if (!res)
{
{
std::cerr << '\"' << qPrintable(command) << '\"'
<< " failed to terminate" << std::endl;
return res ? EXIT_SUCCESS : EXIT_FAILURE;
}
}
return res ? EXIT_SUCCESS : EXIT_FAILURE;
}
26 changes: 13 additions & 13 deletions Applications/ctkDICOMHost/ctkDICOMHostMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ int main(int argc, char** argv)
QSharedPointer<ctkPluginFramework> framework = fwFactory.getFramework();

try
{
{
framework->init();
}
}
catch (const ctkPluginException& exc)
{
{
qCritical() << "Failed to initialize the plug-in framework:" << exc;
return EXIT_FAILURE;
}
}

#ifdef CMAKE_INTDIR
QString pluginPath = CTK_PLUGIN_DIR CMAKE_INTDIR "/";
Expand All @@ -91,32 +91,32 @@ int main(int argc, char** argv)

QList<QSharedPointer<ctkPlugin> > installedPlugins;
while(dirIter.hasNext())
{
{
try
{
{
QString fileLocation = dirIter.next();
foreach(QString pluginToInstall, pluginsToInstall)
{
{
if (fileLocation.contains(pluginToInstall))
{
{
QSharedPointer<ctkPlugin> plugin = framework->getPluginContext()->installPlugin(QUrl::fromLocalFile(fileLocation));
installedPlugins << plugin;
break;
}
}
}
}
catch (const ctkPluginException& e)
{
{
qCritical() << e.what();
}
}
}

framework->start();

foreach(QSharedPointer<ctkPlugin> plugin, installedPlugins)
{
{
plugin->start();
}
}
// end startup plugin framework and dah

// set up Qt resource files
Expand Down
Loading

0 comments on commit 9f22fe7

Please sign in to comment.