Skip to content

Commit

Permalink
ENH: Add operation status icon for series widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
Punzo committed May 20, 2024
1 parent 3e76623 commit 1d1b1d6
Show file tree
Hide file tree
Showing 8 changed files with 290 additions and 116 deletions.
128 changes: 68 additions & 60 deletions Libs/DICOM/Core/ctkDICOMScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,77 +845,85 @@ void ctkDICOMScheduler::stopJobsByDICOMUIDs(const QStringList& patientIDs,
}

//----------------------------------------------------------------------------
void ctkDICOMScheduler::runJobs(const QMap<QString, ctkDICOMJobDetail> &jobDetails)
void ctkDICOMScheduler::runJob(const ctkDICOMJobDetail& jd, const QStringList& allowedSeversForPatient)
{
for(QString jobUID : jobDetails.keys())
QStringList allowedSevers = QStringList(jd.ConnectionName);
allowedSevers.append(allowedSeversForPatient);
if (jd.JobClass == "ctkDICOMQueryJob")
{
ctkDICOMJobDetail jd = jobDetails.value(jobUID);
if (jd.JobClass == "ctkDICOMQueryJob")
switch (jd.DICOMLevel)
{
switch (jd.DICOMLevel)
{
case ctkDICOMJob::DICOMLevels::None:
logger.warn("ctkDICOMScheduler : DICOMLevels was not set.");
break;
case ctkDICOMJob::DICOMLevels::Patients:
this->queryPatients();
break;
case ctkDICOMJob::DICOMLevels::Studies:
this->queryStudies(jd.PatientID,
case ctkDICOMJob::DICOMLevels::None:
logger.warn("ctkDICOMScheduler : DICOMLevels was not set.");
break;
case ctkDICOMJob::DICOMLevels::Patients:
this->queryPatients();
break;
case ctkDICOMJob::DICOMLevels::Studies:
this->queryStudies(jd.PatientID,
QThread::NormalPriority,
allowedSevers);
break;
case ctkDICOMJob::DICOMLevels::Series:
this->querySeries(jd.PatientID,
jd.StudyInstanceUID,
QThread::NormalPriority,
allowedSevers);
break;
case ctkDICOMJob::DICOMLevels::Instances:
this->queryInstances(jd.PatientID,
jd.StudyInstanceUID,
jd.SeriesInstanceUID,
QThread::NormalPriority,
QStringList(jd.ConnectionName));
break;
case ctkDICOMJob::DICOMLevels::Series:
this->querySeries(jd.PatientID,
jd.StudyInstanceUID,
QThread::NormalPriority,
QStringList(jd.ConnectionName));
break;
case ctkDICOMJob::DICOMLevels::Instances:
this->queryInstances(jd.PatientID,
jd.StudyInstanceUID,
jd.SeriesInstanceUID,
QThread::NormalPriority,
QStringList(jd.ConnectionName));
break;
}
allowedSevers);
break;
}
else if (jd.JobClass == "ctkDICOMRetrieveJob")
}
else if (jd.JobClass == "ctkDICOMRetrieveJob")
{
switch (jd.DICOMLevel)
{
switch (jd.DICOMLevel)
{
case ctkDICOMJob::DICOMLevels::None:
logger.warn("ctkDICOMScheduler : DICOMLevels was not set.");
break;
case ctkDICOMJob::DICOMLevels::Patients:
logger.warn("Retrieve Patient is not implemented");
break;
case ctkDICOMJob::DICOMLevels::Studies:
this->retrieveStudy(jd.PatientID,
jd.StudyInstanceUID,
QThread::NormalPriority,
QStringList(jd.ConnectionName));
case ctkDICOMJob::DICOMLevels::None:
logger.warn("ctkDICOMScheduler : DICOMLevels was not set.");
break;
case ctkDICOMJob::DICOMLevels::Series:
this->retrieveSeries(jd.PatientID,
jd.StudyInstanceUID,
jd.SeriesInstanceUID,
QThread::NormalPriority,
QStringList(jd.ConnectionName));
break;
case ctkDICOMJob::DICOMLevels::Instances:
this->retrieveSOPInstance(jd.PatientID,
jd.StudyInstanceUID,
jd.SeriesInstanceUID,
jd.SOPInstanceUID,
QThread::NormalPriority,
QStringList(jd.ConnectionName));
break;
}
case ctkDICOMJob::DICOMLevels::Patients:
logger.warn("Retrieve Patient is not implemented");
break;
case ctkDICOMJob::DICOMLevels::Studies:
this->retrieveStudy(jd.PatientID,
jd.StudyInstanceUID,
QThread::NormalPriority,
allowedSevers);
break;
case ctkDICOMJob::DICOMLevels::Series:
this->retrieveSeries(jd.PatientID,
jd.StudyInstanceUID,
jd.SeriesInstanceUID,
QThread::NormalPriority,
allowedSevers);
break;
case ctkDICOMJob::DICOMLevels::Instances:
this->retrieveSOPInstance(jd.PatientID,
jd.StudyInstanceUID,
jd.SeriesInstanceUID,
jd.SOPInstanceUID,
QThread::NormalPriority,
allowedSevers);
break;
}
}
}

//----------------------------------------------------------------------------
void ctkDICOMScheduler::runJobs(const QMap<QString, ctkDICOMJobDetail> &jobDetails)
{
for(QString jobUID : jobDetails.keys())
{
ctkDICOMJobDetail jd = jobDetails.value(jobUID);
this->runJob(jd);
}
}

//----------------------------------------------------------------------------
void ctkDICOMScheduler::raiseJobsPriorityForSeries(const QStringList& selectedSeriesInstanceUIDs,
QThread::Priority priority)
Expand Down
1 change: 1 addition & 0 deletions Libs/DICOM/Core/ctkDICOMScheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMScheduler : public ctkJobScheduler
const QStringList& seriesInstanceUIDs = {},
const QStringList& sopInstanceUIDs = {});

Q_INVOKABLE void runJob(const ctkDICOMJobDetail& jobDetails, const QStringList& allowedSeversForPatient = QStringList());
Q_INVOKABLE void runJobs(const QMap<QString, ctkDICOMJobDetail>& jobDetails);
Q_INVOKABLE void raiseJobsPriorityForSeries(const QStringList& selectedSeriesInstanceUIDs,
QThread::Priority priority = QThread::HighestPriority);
Expand Down
6 changes: 5 additions & 1 deletion Libs/DICOM/Widgets/ctkDICOMJobListWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ void ctkDICOMJobListWidgetPrivate::retryJobs()
(row, QCenteredItemModel::Columns::JobClass).data().toString();
QString jobUID = this->showCompletedProxyModel->index
(row, QCenteredItemModel::Columns::JobUID).data().toString();

if (status != ctkDICOMJobListWidget::tr("failed") && status != ctkDICOMJobListWidget::tr("user-stopped"))
{
continue;
Expand Down Expand Up @@ -944,6 +945,8 @@ void ctkDICOMJobListWidgetPrivate::retryJobs()
(row, QCenteredItemModel::Columns::SeriesInstanceUID).data().toString();
jobDetail.SOPInstanceUID = this->showCompletedProxyModel->index
(row, QCenteredItemModel::Columns::SOPInstanceUID).data().toString();
jobDetail.ConnectionName = this->showCompletedProxyModel->index
(row, QCenteredItemModel::Columns::Connection).data().toString();
jobsUIDsToRetry.insert(jobUID, jobDetail);
}

Expand All @@ -968,7 +971,8 @@ void ctkDICOMJobListWidgetPrivate::retryJobs()
td.PatientID == filteredTD.PatientID &&
td.StudyInstanceUID == filteredTD.StudyInstanceUID &&
td.SeriesInstanceUID == filteredTD.SeriesInstanceUID &&
td.SOPInstanceUID == filteredTD.SOPInstanceUID)
td.SOPInstanceUID == filteredTD.SOPInstanceUID &&
td.ConnectionName == filteredTD.ConnectionName)
{
duplicate = true;
break;
Expand Down
Loading

0 comments on commit 1d1b1d6

Please sign in to comment.