Skip to content

Commit

Permalink
BUG: Fix series loading when widgets are still retrieving data
Browse files Browse the repository at this point in the history
  • Loading branch information
Punzo committed Jun 4, 2024
1 parent c5b7fff commit 967de75
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 69 deletions.
5 changes: 0 additions & 5 deletions Libs/DICOM/Core/ctkDICOMScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -899,18 +899,13 @@ void ctkDICOMScheduler::stopJobsByDICOMUIDs(const QStringList& patientIDs,
continue;
}

ctkDICOMInserterJob* inserterJob = qobject_cast<ctkDICOMInserterJob*>(job.data());
if ((!dicomJob->patientID().isEmpty() && patientIDs.contains(dicomJob->patientID())) ||
(!dicomJob->studyInstanceUID().isEmpty() && studyInstanceUIDs.contains(dicomJob->studyInstanceUID())) ||
(!dicomJob->seriesInstanceUID().isEmpty() && seriesInstanceUIDs.contains(dicomJob->seriesInstanceUID())) ||
(!dicomJob->sopInstanceUID().isEmpty() && sopInstanceUIDs.contains(dicomJob->sopInstanceUID())))
{
jobsUIDs.append(dicomJob->jobUID());
}
else if (inserterJob)
{
jobsUIDs.append(dicomJob->jobUID());
}
}
}

Expand Down
13 changes: 6 additions & 7 deletions Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include "ctkDICOMJob.h"
#include "ctkDICOMJobResponseSet.h"
#include "ctkDICOMScheduler.h"
#include "ctkDICOMStudyItemWidget.h"
#include "ctkDICOMThumbnailGenerator.h"

// ctkDICOMWidgets includes
Expand Down Expand Up @@ -69,7 +68,7 @@ class ctkDICOMSeriesItemWidgetPrivate : public Ui_ctkDICOMSeriesItemWidget
ctkDICOMSeriesItemWidgetPrivate(ctkDICOMSeriesItemWidget& obj);
~ctkDICOMSeriesItemWidgetPrivate();

void init(ctkDICOMStudyItemWidget* top);
void init(QWidget* top);
void connectToTop();
void disconnectFromTop();
QString getDICOMCenterFrameFromInstances(QStringList instancesList);
Expand All @@ -90,7 +89,7 @@ class ctkDICOMSeriesItemWidgetPrivate : public Ui_ctkDICOMSeriesItemWidget

QSharedPointer<ctkDICOMDatabase> DicomDatabase;
QSharedPointer<ctkDICOMScheduler> Scheduler;
QSharedPointer<ctkDICOMStudyItemWidget> StudyWidget;
QSharedPointer<QWidget> StudyWidget;
QMap<QString, QMetaObject::Connection> Connections;
QStringList AllowedServers;

Expand Down Expand Up @@ -163,12 +162,12 @@ ctkDICOMSeriesItemWidgetPrivate::~ctkDICOMSeriesItemWidgetPrivate()
}

//----------------------------------------------------------------------------
void ctkDICOMSeriesItemWidgetPrivate::init(ctkDICOMStudyItemWidget* top)
void ctkDICOMSeriesItemWidgetPrivate::init(QWidget* top)
{
Q_Q(ctkDICOMSeriesItemWidget);
this->setupUi(q);

this->StudyWidget = QSharedPointer<ctkDICOMStudyItemWidget>(top, skipDelete);
this->StudyWidget = QSharedPointer<QWidget>(top, skipDelete);
this->connectToTop();

this->SeriesThumbnail->setTransformationMode(Qt::TransformationMode::SmoothTransformation);
Expand Down Expand Up @@ -744,7 +743,7 @@ void ctkDICOMSeriesItemWidgetPrivate::updateRetrieveUIOnFinished()
// ctkDICOMSeriesItemWidget methods

//----------------------------------------------------------------------------
ctkDICOMSeriesItemWidget::ctkDICOMSeriesItemWidget(ctkDICOMStudyItemWidget* top, QWidget* parent)
ctkDICOMSeriesItemWidget::ctkDICOMSeriesItemWidget(QWidget* top, QWidget* parent)
: Superclass(parent)
, d_ptr(new ctkDICOMSeriesItemWidgetPrivate(*this))
{
Expand Down Expand Up @@ -810,7 +809,7 @@ void ctkDICOMSeriesItemWidget::forceRetrieve()
{
Q_D(ctkDICOMSeriesItemWidget);

d->IsCloud = false;
d->IsCloud = true;
d->RetrieveFailed = false;
d->StopJobs = false;
d->DicomDatabase->removeSeries(d->SeriesInstanceUID, false, false);
Expand Down
4 changes: 2 additions & 2 deletions Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class CTK_DICOM_WIDGETS_EXPORT ctkDICOMSeriesItemWidget : public QWidget

public:
typedef QWidget Superclass;
explicit ctkDICOMSeriesItemWidget(ctkDICOMStudyItemWidget* top = nullptr,
QWidget* parent = nullptr);
explicit ctkDICOMSeriesItemWidget(QWidget* top = nullptr,
QWidget* parent = nullptr);
virtual ~ctkDICOMSeriesItemWidget();

///@{
Expand Down
11 changes: 5 additions & 6 deletions Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include "ctkDICOMScheduler.h"

// ctkDICOMWidgets includes
#include "ctkDICOMPatientItemWidget.h"
#include "ctkDICOMStudyItemWidget.h"
#include "ui_ctkDICOMStudyItemWidget.h"

Expand Down Expand Up @@ -65,7 +64,7 @@ class ctkDICOMStudyItemWidgetPrivate : public Ui_ctkDICOMStudyItemWidget
ctkDICOMStudyItemWidgetPrivate(ctkDICOMStudyItemWidget& obj);
~ctkDICOMStudyItemWidgetPrivate();

void init(ctkDICOMPatientItemWidget* parent, QWidget* root);
void init(QWidget* top, QWidget* parent);
void connectToTop();
void disconnectFromTop();
void updateColumnsWidths();
Expand All @@ -84,7 +83,7 @@ class ctkDICOMStudyItemWidgetPrivate : public Ui_ctkDICOMStudyItemWidget

QSharedPointer<ctkDICOMDatabase> DicomDatabase;
QSharedPointer<ctkDICOMScheduler> Scheduler;
QSharedPointer<ctkDICOMPatientItemWidget> PatientWidget;
QSharedPointer<QWidget> PatientWidget;
QSharedPointer<QWidget> VisualDICOMBrowser;
QMap<QString, QMetaObject::Connection> Connections;

Expand Down Expand Up @@ -149,12 +148,12 @@ ctkDICOMStudyItemWidgetPrivate::~ctkDICOMStudyItemWidgetPrivate()
}

//----------------------------------------------------------------------------
void ctkDICOMStudyItemWidgetPrivate::init(ctkDICOMPatientItemWidget* top, QWidget* parent)
void ctkDICOMStudyItemWidgetPrivate::init(QWidget* top, QWidget* parent)
{
Q_Q(ctkDICOMStudyItemWidget);
this->setupUi(q);

this->PatientWidget = QSharedPointer<ctkDICOMPatientItemWidget>(top, skipDelete);
this->PatientWidget = QSharedPointer<QWidget>(top, skipDelete);
this->connectToTop();
this->VisualDICOMBrowser = QSharedPointer<QWidget>(parent, skipDelete);

Expand Down Expand Up @@ -453,7 +452,7 @@ ctkDICOMSeriesItemWidget* ctkDICOMStudyItemWidgetPrivate::isSeriesItemAlreadyAdd
// ctkDICOMStudyItemWidget methods

//----------------------------------------------------------------------------
ctkDICOMStudyItemWidget::ctkDICOMStudyItemWidget(ctkDICOMPatientItemWidget* top, QWidget* parent)
ctkDICOMStudyItemWidget::ctkDICOMStudyItemWidget(QWidget* top, QWidget* parent)
: Superclass(parent)
, d_ptr(new ctkDICOMStudyItemWidgetPrivate(*this))
{
Expand Down
3 changes: 1 addition & 2 deletions Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class ctkDICOMScheduler;
// ctkDICOMWidgets includes
#include "ctkDICOMSeriesItemWidget.h"

class ctkDICOMPatientItemWidget;
class ctkDICOMSeriesItemWidget;
class ctkDICOMStudyItemWidgetPrivate;

Expand All @@ -68,7 +67,7 @@ class CTK_DICOM_WIDGETS_EXPORT ctkDICOMStudyItemWidget : public QWidget

public:
typedef QWidget Superclass;
explicit ctkDICOMStudyItemWidget(ctkDICOMPatientItemWidget* top = nullptr,
explicit ctkDICOMStudyItemWidget(QWidget* top = nullptr,
QWidget* parent = nullptr);
virtual ~ctkDICOMStudyItemWidget();

Expand Down
Loading

0 comments on commit 967de75

Please sign in to comment.