Skip to content

Commit

Permalink
ENH: Remove unnecessary logging information from ctkDICOMDatabase class
Browse files Browse the repository at this point in the history
  • Loading branch information
Punzo committed Jan 22, 2024
1 parent 88ff72b commit 35d45c1
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions Libs/DICOM/Core/ctkDICOMDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,6 @@ bool ctkDICOMDatabasePrivate::loggedExec(QSqlQuery& query, const QString& queryS
{
success = query.exec();
}
if (!success)
{
QSqlError sqlError = query.lastError();
logger.debug("SQL failed\n Bad SQL: " + query.lastQuery());
logger.debug("Error text: " + sqlError.text());
}
else
{
logger.debug("SQL worked!\n SQL: " + query.lastQuery());
}
return (success);
}

Expand All @@ -177,16 +167,6 @@ bool ctkDICOMDatabasePrivate::loggedExecBatch(QSqlQuery& query)
{
bool success;
success = query.execBatch();
if (!success)
{
QSqlError sqlError = query.lastError();
logger.debug( "SQL failed\n Bad SQL: " + query.lastQuery());
logger.debug( "Error text: " + sqlError.text());
}
else
{
logger.debug("SQL worked!\n SQL: " + query.lastQuery());
}
return (success);
}

Expand Down Expand Up @@ -280,7 +260,6 @@ bool ctkDICOMDatabasePrivate::executeScript(const QString script)
{
if (! (*it).startsWith("--") )
{
logger.debug(*it + "\n");
query.exec(*it);
if (query.lastError().type())
{
Expand Down Expand Up @@ -834,8 +813,6 @@ void ctkDICOMDatabasePrivate::insert(const ctkDICOMItem& dataset, const QString&
QString sopInstanceUID(dataset.GetElementAsString(DCM_SOPInstanceUID));

// Check to see if the file has already been loaded
logger.debug("inserting filePath: " + filePath);

// Check if the file has been already indexed and skip indexing if it is
bool datasetInDatabase = false;
bool datasetUpToDate = false;
Expand All @@ -851,13 +828,11 @@ void ctkDICOMDatabasePrivate::insert(const ctkDICOMItem& dataset, const QString&
{
if (datasetUpToDate)
{
logger.debug("File " + databaseFilename + " already added");
return;
}
// File is updated, delete record and re-index
if (!this->removeImage(sopInstanceUID))
{
logger.debug("File " + filePath + " cannot be added, failed to update existing values in the database");
return;
}
}
Expand All @@ -884,7 +859,6 @@ void ctkDICOMDatabasePrivate::insert(const ctkDICOMItem& dataset, const QString&
bool databaseWasChanged = this->insertPatientStudySeries(dataset, patientID, patientsName);
if (!sopInstanceUID.isEmpty() && !seriesInstanceUID.isEmpty() && !storedFilePath.isEmpty())
{
logger.debug("Maybe add Instance");
bool alreadyInserted = false;
if (!storeFile)
{
Expand Down Expand Up @@ -933,7 +907,6 @@ void ctkDICOMDatabasePrivate::insert(const ctkDICOMItem& dataset, const QString&
// let users of this class track when things happen
emit q->instanceAdded(sopInstanceUID);

logger.debug("Instance Added");
databaseWasChanged = true;
}
if (generateThumbnail)
Expand Down Expand Up @@ -2373,12 +2346,9 @@ void ctkDICOMDatabase::insert( const QString& filePath, bool storeFile, bool gen
/// first we check if the file is already in the database
if (fileExistsAndUpToDate(filePath))
{
logger.debug( "File " + filePath + " already added.");
return;
}

logger.debug( "Processing " + filePath );

ctkDICOMItem dataset;

dataset.InitializeFromFile(filePath);
Expand Down Expand Up @@ -2517,7 +2487,6 @@ void ctkDICOMDatabase::insert(const QList<ctkDICOMDatabase::IndexingResult>& ind
insertImageStatement.addBindValue(QDateTime::currentDateTime());
insertImageStatement.exec();
emit instanceAdded(sopInstanceUID);
logger.debug( "Instance Added" );
databaseWasChanged = true;

if (generateThumbnail)
Expand Down Expand Up @@ -2737,7 +2706,6 @@ void ctkDICOMDatabase::insert(QList<QSharedPointer<ctkDICOMJobResponseSet>> jobR
(!storedFilePath.isEmpty() ||
!url.isEmpty()))
{
logger.debug( "Maybe add Instance" );
bool alreadyInserted = false;
if (!storeFile)
{
Expand Down Expand Up @@ -2785,7 +2753,6 @@ void ctkDICOMDatabase::insert(QList<QSharedPointer<ctkDICOMJobResponseSet>> jobR

// let users of this class track when things happen
emit instanceAdded(sopInstanceUID);
logger.debug( "Instance Added" );
databaseWasChanged = true;
}
if (generateThumbnail)
Expand Down Expand Up @@ -2971,7 +2938,6 @@ bool ctkDICOMDatabase::removeSeries(const QString& seriesInstanceUID, bool clear
{
if (file.remove())
{
logger.debug("Removed file " + absPath);
QString fileFolder = QFileInfo(absPath).absoluteDir().path();
if (foldersToRemove.isEmpty() || foldersToRemove.last() != fileFolder)
{
Expand Down

0 comments on commit 35d45c1

Please sign in to comment.