Skip to content

Commit

Permalink
ENH: Apply Andras' feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Punzo committed Jan 11, 2024
1 parent 9f14ae6 commit 573773e
Show file tree
Hide file tree
Showing 15 changed files with 158 additions and 232 deletions.
42 changes: 0 additions & 42 deletions Libs/DICOM/Core/ctkDICOMEcho.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,55 +89,13 @@ ctkDICOMEcho::ctkDICOMEcho(QObject* parentObject)
Q_D(ctkDICOMEcho);

d->SCU.setVerbosePCMode(false);

this->setDCMTKLogLevel(logger.logLevel());
}

//------------------------------------------------------------------------------
ctkDICOMEcho::~ctkDICOMEcho()
{
}

//-----------------------------------------------------------------------------
void ctkDICOMEcho::setDCMTKLogLevel(const ctkErrorLogLevel::LogLevel& level)
{
OFLogger::LogLevel dcmtkLogLevel = OFLogger::OFF_LOG_LEVEL;
if (level == ctkErrorLogLevel::LogLevel::Fatal)
{
dcmtkLogLevel = OFLogger::FATAL_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Critical ||
level == ctkErrorLogLevel::LogLevel::Error)
{
dcmtkLogLevel = OFLogger::ERROR_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Warning)
{
dcmtkLogLevel = OFLogger::WARN_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Info)
{
dcmtkLogLevel = OFLogger::INFO_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Debug)
{
dcmtkLogLevel = OFLogger::DEBUG_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Trace ||
level == ctkErrorLogLevel::LogLevel::Status)
{
dcmtkLogLevel = OFLogger::TRACE_LOG_LEVEL;
}

OFLog::configure(dcmtkLogLevel);
}

//-----------------------------------------------------------------------------
ctkErrorLogLevel::LogLevel ctkDICOMEcho::DCMTKLogLevel() const
{
return logger.logLevel();
}

/// Set methods for connectivity
//------------------------------------------------------------------------------
void ctkDICOMEcho::setConnectionName(const QString& connectionName)
Expand Down
4 changes: 0 additions & 4 deletions Libs/DICOM/Core/ctkDICOMEcho.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMEcho : public QObject
void setConnectionTimeout(const int timeout);
int connectionTimeout() const;

/// Log level for dcmtk. Default: Error.
Q_INVOKABLE void setDCMTKLogLevel(const ctkErrorLogLevel::LogLevel& level);
Q_INVOKABLE ctkErrorLogLevel::LogLevel DCMTKLogLevel() const;

/// Echo connection.
bool echo();

Expand Down
42 changes: 0 additions & 42 deletions Libs/DICOM/Core/ctkDICOMQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,55 +152,13 @@ ctkDICOMQuery::ctkDICOMQuery(QObject* parentObject)

d->SCU.setVerbosePCMode(false);
d->SCU.query = this; // give the dcmtk level access to this for emitting signals

this->setDCMTKLogLevel(logger.logLevel());
}

//------------------------------------------------------------------------------
ctkDICOMQuery::~ctkDICOMQuery()
{
}

//-----------------------------------------------------------------------------
void ctkDICOMQuery::setDCMTKLogLevel(const ctkErrorLogLevel::LogLevel& level)
{
OFLogger::LogLevel dcmtkLogLevel = OFLogger::OFF_LOG_LEVEL;
if (level == ctkErrorLogLevel::LogLevel::Fatal)
{
dcmtkLogLevel = OFLogger::FATAL_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Critical ||
level == ctkErrorLogLevel::LogLevel::Error)
{
dcmtkLogLevel = OFLogger::ERROR_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Warning)
{
dcmtkLogLevel = OFLogger::WARN_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Info)
{
dcmtkLogLevel = OFLogger::INFO_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Debug)
{
dcmtkLogLevel = OFLogger::DEBUG_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Trace ||
level == ctkErrorLogLevel::LogLevel::Status)
{
dcmtkLogLevel = OFLogger::TRACE_LOG_LEVEL;
}

OFLog::configure(dcmtkLogLevel);
}

//-----------------------------------------------------------------------------
ctkErrorLogLevel::LogLevel ctkDICOMQuery::DCMTKLogLevel() const
{
return logger.logLevel();
}

/// Set methods for connectivity
//------------------------------------------------------------------------------
void ctkDICOMQuery::setConnectionName(const QString& connectionName)
Expand Down
4 changes: 0 additions & 4 deletions Libs/DICOM/Core/ctkDICOMQuery.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMQuery : public QObject
/// operation is canceled?
Q_INVOKABLE bool wasCanceled();

/// Log level for dcmtk. Default: Error.
Q_INVOKABLE void setDCMTKLogLevel(const ctkErrorLogLevel::LogLevel& level);
Q_INVOKABLE ctkErrorLogLevel::LogLevel DCMTKLogLevel() const;

/// Query a remote DICOM Image Store SCP.
/// You must at least set the host and port before calling query()
Q_INVOKABLE bool query(ctkDICOMDatabase& database);
Expand Down
42 changes: 0 additions & 42 deletions Libs/DICOM/Core/ctkDICOMRetrieve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,6 @@ ctkDICOMRetrieve::ctkDICOMRetrieve(QObject* parent)

d->SCU.setVerbosePCMode(false);
d->SCU.retrieve = this; // give the dcmtk level access to this for emitting signals

this->setDCMTKLogLevel(logger.logLevel());
}

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -967,46 +965,6 @@ bool ctkDICOMRetrieve::wasCanceled()
return d->Canceled;
}

//-----------------------------------------------------------------------------
void ctkDICOMRetrieve::setDCMTKLogLevel(const ctkErrorLogLevel::LogLevel& level)
{
OFLogger::LogLevel dcmtkLogLevel = OFLogger::OFF_LOG_LEVEL;
if (level == ctkErrorLogLevel::LogLevel::Fatal)
{
dcmtkLogLevel = OFLogger::FATAL_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Critical ||
level == ctkErrorLogLevel::LogLevel::Error)
{
dcmtkLogLevel = OFLogger::ERROR_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Warning)
{
dcmtkLogLevel = OFLogger::WARN_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Info)
{
dcmtkLogLevel = OFLogger::INFO_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Debug)
{
dcmtkLogLevel = OFLogger::DEBUG_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Trace ||
level == ctkErrorLogLevel::LogLevel::Status)
{
dcmtkLogLevel = OFLogger::TRACE_LOG_LEVEL;
}

OFLog::configure(dcmtkLogLevel);
}

//-----------------------------------------------------------------------------
ctkErrorLogLevel::LogLevel ctkDICOMRetrieve::DCMTKLogLevel() const
{
return logger.logLevel();
}

//------------------------------------------------------------------------------
bool ctkDICOMRetrieve::moveStudy(const QString& studyInstanceUID,
const QString& patientID)
Expand Down
4 changes: 0 additions & 4 deletions Libs/DICOM/Core/ctkDICOMRetrieve.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMRetrieve : public QObject
/// operation is canceled?
Q_INVOKABLE bool wasCanceled();

/// Log level for dcmtk. Default: Error.
Q_INVOKABLE void setDCMTKLogLevel(const ctkErrorLogLevel::LogLevel& level);
Q_INVOKABLE ctkErrorLogLevel::LogLevel DCMTKLogLevel() const;

/// where to insert new data sets obtained via get (must be set for
/// get to succeed)
Q_INVOKABLE void setDatabase(ctkDICOMDatabase& dicomDatabase);
Expand Down
42 changes: 0 additions & 42 deletions Libs/DICOM/Core/ctkDICOMStorageListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@ ctkDICOMStorageListener::ctkDICOMStorageListener(QObject* parentObject)
{
Q_D(ctkDICOMStorageListener);
d->SCU.listener = this; // give the dcmtk level access to this for emitting signals

this->setDCMTKLogLevel(logger.logLevel());
}

//------------------------------------------------------------------------------
Expand All @@ -253,46 +251,6 @@ ctkDICOMStorageListener::~ctkDICOMStorageListener()
d->JobResponseSets.clear();
}

//-----------------------------------------------------------------------------
void ctkDICOMStorageListener::setDCMTKLogLevel(const ctkErrorLogLevel::LogLevel& level)
{
OFLogger::LogLevel dcmtkLogLevel = OFLogger::OFF_LOG_LEVEL;
if (level == ctkErrorLogLevel::LogLevel::Fatal)
{
dcmtkLogLevel = OFLogger::FATAL_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Critical ||
level == ctkErrorLogLevel::LogLevel::Error)
{
dcmtkLogLevel = OFLogger::ERROR_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Warning)
{
dcmtkLogLevel = OFLogger::WARN_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Info)
{
dcmtkLogLevel = OFLogger::INFO_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Debug)
{
dcmtkLogLevel = OFLogger::DEBUG_LOG_LEVEL;
}
else if (level == ctkErrorLogLevel::LogLevel::Trace ||
level == ctkErrorLogLevel::LogLevel::Status)
{
dcmtkLogLevel = OFLogger::TRACE_LOG_LEVEL;
}

OFLog::configure(dcmtkLogLevel);
}

//-----------------------------------------------------------------------------
ctkErrorLogLevel::LogLevel ctkDICOMStorageListener::DCMTKLogLevel() const
{
return logger.logLevel();
}

//------------------------------------------------------------------------------
bool ctkDICOMStorageListener::listen()
{
Expand Down
4 changes: 0 additions & 4 deletions Libs/DICOM/Core/ctkDICOMStorageListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMStorageListener : public QObject
Q_INVOKABLE void setJobUID(const QString& jobUID);
Q_INVOKABLE QString jobUID() const;

/// Log level for dcmtk. Default: Error.
Q_INVOKABLE void setDCMTKLogLevel(const ctkErrorLogLevel::LogLevel& level);
Q_INVOKABLE ctkErrorLogLevel::LogLevel DCMTKLogLevel() const;

/// Start listen connection.
bool listen();

Expand Down
Loading

0 comments on commit 573773e

Please sign in to comment.