From 9f14ae669a15aaba584ca8d588ed01860b64def1 Mon Sep 17 00:00:00 2001 From: Davide Punzo Date: Thu, 11 Jan 2024 16:39:47 +0100 Subject: [PATCH] ENH: Apply Andras' feedback --- .../Resources/UI/ctkDICOMServerNodeWidget2.ui | 227 +++++++++--------- .../Widgets/ctkDICOMPatientItemWidget.cpp | 35 +-- .../DICOM/Widgets/ctkDICOMPatientItemWidget.h | 21 +- .../Widgets/ctkDICOMSeriesItemWidget.cpp | 33 +-- Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.h | 10 +- .../DICOM/Widgets/ctkDICOMStudyItemWidget.cpp | 93 +++++-- Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.h | 29 ++- .../Widgets/ctkDICOMVisualBrowserWidget.cpp | 38 +-- .../Widgets/ctkDICOMVisualBrowserWidget.h | 25 +- 9 files changed, 267 insertions(+), 244 deletions(-) diff --git a/Libs/DICOM/Widgets/Resources/UI/ctkDICOMServerNodeWidget2.ui b/Libs/DICOM/Widgets/Resources/UI/ctkDICOMServerNodeWidget2.ui index 61950a3c4b..2f617941c8 100644 --- a/Libs/DICOM/Widgets/Resources/UI/ctkDICOMServerNodeWidget2.ui +++ b/Libs/DICOM/Widgets/Resources/UI/ctkDICOMServerNodeWidget2.ui @@ -29,119 +29,7 @@ 5 - - - - Servers - - - Qt::AlignCenter - - - - - - - - 1 - 0 - - - - false - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - Qt::ElideRight - - - 10 - - - true - - - false - - - 165 - - - 165 - - - true - - - false - - - true - - - false - - - false - - - - Name - - - - - Query/Retrieve - - - - - Storage - - - - - Calling AETitle - - - - - Called AETitle - - - - - Address - - - - - Port - - - - - Timeout - - - - - Protocol - - - - - Proxy - - - - - + @@ -281,7 +169,7 @@ - + 3 @@ -380,6 +268,117 @@ + + + + Servers + + + + + + + 1 + 0 + + + + false + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + Qt::ElideRight + + + 10 + + + true + + + false + + + 165 + + + 165 + + + true + + + false + + + true + + + false + + + false + + + + Name + + + + + Query/Retrieve + + + + + Storage + + + + + Calling AETitle + + + + + Called AETitle + + + + + Address + + + + + Port + + + + + Timeout + + + + + Protocol + + + + + Proxy + + + + + + + diff --git a/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp index 05bc6473c1..d8cccaae27 100644 --- a/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp @@ -35,7 +35,6 @@ // ctkDICOMWidgets includes #include "ctkDICOMSeriesItemWidget.h" -#include "ctkDICOMStudyItemWidget.h" #include "ctkDICOMPatientItemWidget.h" #include "ui_ctkDICOMPatientItemWidget.h" @@ -74,8 +73,7 @@ class ctkDICOMPatientItemWidgetPrivate: public Ui_ctkDICOMPatientItemWidget QSharedPointer VisualDICOMBrowser; int NumberOfStudiesPerPatient; - int NumberOfSeriesPerRow; - int MinimumThumbnailSize; + ctkDICOMStudyItemWidget::ThumbnailSizeOption ThumbnailSize; QString PatientItem; QString PatientID; @@ -98,8 +96,7 @@ ctkDICOMPatientItemWidgetPrivate::ctkDICOMPatientItemWidgetPrivate(ctkDICOMPatie { this->FilteringDate = ctkDICOMPatientItemWidget::DateType::Any; this->NumberOfStudiesPerPatient = 2; - this->NumberOfSeriesPerRow = 6; - this->MinimumThumbnailSize = 300; + this->ThumbnailSize = ctkDICOMStudyItemWidget::ThumbnailSizeOption::Medium; this->PatientItem = ""; this->PatientID = ""; this->FilteringStudyDescription = ""; @@ -437,31 +434,17 @@ int ctkDICOMPatientItemWidget::numberOfStudiesPerPatient() const } //------------------------------------------------------------------------------ -void ctkDICOMPatientItemWidget::setNumberOfSeriesPerRow(int numberOfSeriesPerRow) +void ctkDICOMPatientItemWidget::setThumbnailSize(const ctkDICOMStudyItemWidget::ThumbnailSizeOption &thumbnailSize) { Q_D(ctkDICOMPatientItemWidget); - d->NumberOfSeriesPerRow = numberOfSeriesPerRow; + d->ThumbnailSize = thumbnailSize; } //------------------------------------------------------------------------------ -int ctkDICOMPatientItemWidget::numberOfSeriesPerRow() const +ctkDICOMStudyItemWidget::ThumbnailSizeOption ctkDICOMPatientItemWidget::thumbnailSize() const { Q_D(const ctkDICOMPatientItemWidget); - return d->NumberOfSeriesPerRow; -} - -//---------------------------------------------------------------------------- -void ctkDICOMPatientItemWidget::setMinimumThumbnailSize(int minimumThumbnailSize) -{ - Q_D(ctkDICOMPatientItemWidget); - d->MinimumThumbnailSize = minimumThumbnailSize; -} - -//---------------------------------------------------------------------------- -int ctkDICOMPatientItemWidget::minimumThumbnailSize() const -{ - Q_D(const ctkDICOMPatientItemWidget); - return d->MinimumThumbnailSize; + return d->ThumbnailSize; } //---------------------------------------------------------------------------- @@ -619,11 +602,7 @@ void ctkDICOMPatientItemWidget::addStudyItemWidget(const QString &studyItem) } studyItemWidget->setDescription(studyDescription); - studyItemWidget->setNumberOfSeriesPerRow(d->NumberOfSeriesPerRow); - if (this->parentWidget()) - { - studyItemWidget->setThumbnailSize(std::max(int(this->parentWidget()->width() / d->NumberOfSeriesPerRow), d->MinimumThumbnailSize) * 0.94); - } + studyItemWidget->setThumbnailSize(d->ThumbnailSize); studyItemWidget->setFilteringSeriesDescription(d->FilteringSeriesDescription); studyItemWidget->setFilteringModalities(d->FilteringModalities); studyItemWidget->setDicomDatabase(d->DicomDatabase); diff --git a/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.h b/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.h index 7bfe67d790..c26f77d1e1 100644 --- a/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.h +++ b/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.h @@ -26,10 +26,13 @@ #include "ctkDICOMWidgetsExport.h" -// Qt includes +// Qt includes #include #include +// CTK includes +#include "ctkDICOMStudyItemWidget.h" + class ctkDICOMPatientItemWidgetPrivate; class ctkDICOMDatabase; @@ -44,8 +47,7 @@ class CTK_DICOM_WIDGETS_EXPORT ctkDICOMPatientItemWidget : public QWidget Q_PROPERTY(QString patientItem READ patientItem WRITE setPatientItem); Q_PROPERTY(QString patientID READ patientID WRITE setPatientID); Q_PROPERTY(int numberOfStudiesPerPatient READ numberOfStudiesPerPatient WRITE setNumberOfStudiesPerPatient); - Q_PROPERTY(int numberOfSeriesPerRow READ numberOfSeriesPerRow WRITE setNumberOfSeriesPerRow); - Q_PROPERTY(int minimumThumbnailSize READ minimumThumbnailSize WRITE setMinimumThumbnailSize); + Q_PROPERTY(ctkDICOMStudyItemWidget::ThumbnailSizeOption thumbnailSize READ thumbnailSize WRITE setThumbnailSize); public: typedef QWidget Superclass; @@ -97,15 +99,10 @@ class CTK_DICOM_WIDGETS_EXPORT ctkDICOMPatientItemWidget : public QWidget void setNumberOfStudiesPerPatient(int numberOfStudiesPerPatient); int numberOfStudiesPerPatient() const; - /// Number of series displayed per row - /// 6 by default - void setNumberOfSeriesPerRow(int numberOfSeriesPerRow); - int numberOfSeriesPerRow() const; - - /// Minimum thumbnail size in pixel - /// 300 by default - void setMinimumThumbnailSize(int minimumThumbnailSize); - int minimumThumbnailSize() const; + /// Set the thumbnail size: small, medium, large + /// medium by default + void setThumbnailSize(const ctkDICOMStudyItemWidget::ThumbnailSizeOption &thumbnailSize); + ctkDICOMStudyItemWidget::ThumbnailSizeOption thumbnailSize() const; /// Return the scheduler. Q_INVOKABLE ctkDICOMScheduler* scheduler() const; diff --git a/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.cpp index 1add8fd988..dcd5f99953 100644 --- a/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.cpp @@ -88,7 +88,7 @@ class ctkDICOMSeriesItemWidgetPrivate: public Ui_ctkDICOMSeriesItemWidget bool RetrieveFailed; bool IsLoaded; bool IsVisible; - int ThumbnailSize; + int ThumbnailSizePixel; int NumberOfDownloads; QImage ThumbnailImage; bool isThumbnailDocument; @@ -116,7 +116,7 @@ ctkDICOMSeriesItemWidgetPrivate::ctkDICOMSeriesItemWidgetPrivate(ctkDICOMSeriesI this->StopJobs = false; this->RaiseJobsPriority = false; this->isThumbnailDocument = false; - this->ThumbnailSize = 300; + this->ThumbnailSizePixel = 200; this->NumberOfDownloads = 0; this->DicomDatabase = nullptr; @@ -331,16 +331,17 @@ void ctkDICOMSeriesItemWidgetPrivate::drawModalityThumbnail() return; } + // To Do: formula on thumbnailSizePixel int textSize = 40; QFont font = this->SeriesThumbnail->font(); font.setBold(true); font.setPixelSize(textSize); - QPixmap resultPixmap(this->ThumbnailSize, this->ThumbnailSize); + QPixmap resultPixmap(this->ThumbnailSizePixel, this->ThumbnailSizePixel); resultPixmap.fill(Qt::transparent); ctkDICOMThumbnailGenerator thumbnailGenerator; - thumbnailGenerator.setWidth(this->ThumbnailSize); - thumbnailGenerator.setHeight(this->ThumbnailSize); + thumbnailGenerator.setWidth(this->ThumbnailSizePixel); + thumbnailGenerator.setHeight(this->ThumbnailSizePixel); QImage thumbnailImage; QPainter painter; @@ -370,21 +371,23 @@ void ctkDICOMSeriesItemWidgetPrivate::drawThumbnail(const QString &file, int num return; } + // To Do: formula on thumbnailSizePixel int margin = 5; int iconSize = 48; int textSize = 20; QFont font = this->SeriesThumbnail->font(); font.setBold(true); font.setPixelSize(textSize); - QPixmap resultPixmap(this->ThumbnailSize, this->ThumbnailSize); + + QPixmap resultPixmap(this->ThumbnailSizePixel, this->ThumbnailSizePixel); resultPixmap.fill(Qt::transparent); ctkDICOMThumbnailGenerator thumbnailGenerator; - thumbnailGenerator.setWidth(this->ThumbnailSize); - thumbnailGenerator.setHeight(this->ThumbnailSize); + thumbnailGenerator.setWidth(this->ThumbnailSizePixel); + thumbnailGenerator.setHeight(this->ThumbnailSizePixel); bool thumbnailGenerated = true; bool emptyThumbnailGenerated = false; QPainter painter; - if (this->ThumbnailImage.width() != this->ThumbnailSize) + if (this->ThumbnailImage.width() != this->ThumbnailSizePixel) { if (!thumbnailGenerator.generateThumbnail(file, this->ThumbnailImage)) { @@ -545,7 +548,7 @@ void ctkDICOMSeriesItemWidgetPrivate::updateThumbnailProgressBar() { this->drawThumbnail(file, numberOfFrames); } - } + } } //---------------------------------------------------------------------------- @@ -727,18 +730,18 @@ bool ctkDICOMSeriesItemWidget::IsVisible() const return d->IsVisible; } -//---------------------------------------------------------------------------- -void ctkDICOMSeriesItemWidget::setThumbnailSize(int thumbnailSize) +//------------------------------------------------------------------------------ +void ctkDICOMSeriesItemWidget::setThumbnailSizePixel(const int &thumbnailSizePixel) { Q_D(ctkDICOMSeriesItemWidget); - d->ThumbnailSize = thumbnailSize; + d->ThumbnailSizePixel = thumbnailSizePixel; } //------------------------------------------------------------------------------ -int ctkDICOMSeriesItemWidget::thumbnailSize() const +int ctkDICOMSeriesItemWidget::thumbnailSizePixel() const { Q_D(const ctkDICOMSeriesItemWidget); - return d->ThumbnailSize; + return d->ThumbnailSizePixel; } //---------------------------------------------------------------------------- diff --git a/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.h b/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.h index 05f01bc683..81a527d706 100644 --- a/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.h +++ b/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.h @@ -47,7 +47,7 @@ class CTK_DICOM_WIDGETS_EXPORT ctkDICOMSeriesItemWidget : public QWidget Q_PROPERTY(QString seriesDescription READ seriesDescription WRITE setSeriesDescription); Q_PROPERTY(bool isCloud READ isCloud); Q_PROPERTY(bool retrieveFailed READ retrieveFailed WRITE setRetrieveFailed); - Q_PROPERTY(int thumbnailSize READ thumbnailSize WRITE setThumbnailSize); + Q_PROPERTY(int thumbnailSizePixel READ thumbnailSizePixel WRITE setThumbnailSizePixel); Q_PROPERTY(bool stopJobs READ stopJobs WRITE setStopJobs); Q_PROPERTY(bool raiseJobsPriority READ raiseJobsPriority WRITE setRaiseJobsPriority); @@ -105,10 +105,10 @@ class CTK_DICOM_WIDGETS_EXPORT ctkDICOMSeriesItemWidget : public QWidget /// Series is visible in the parent widget bool IsVisible() const; - /// Series Thumbnail size - /// 300 px by default - void setThumbnailSize(int thumbnailSize); - int thumbnailSize() const; + /// Set the thumbnail size in pixel + /// 200 by default + void setThumbnailSizePixel(const int &thumbnailSizePixel); + int thumbnailSizePixel() const; /// Return the scheduler. Q_INVOKABLE ctkDICOMScheduler* scheduler() const; diff --git a/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.cpp index b28611fc48..f148d7ece3 100644 --- a/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.cpp @@ -24,6 +24,7 @@ //Qt includes #include #include +#include #include // CTK includes @@ -35,7 +36,6 @@ #include "ctkDICOMJobResponseSet.h" // ctkDICOMWidgets includes -#include "ctkDICOMSeriesItemWidget.h" #include "ctkDICOMStudyItemWidget.h" #include "ui_ctkDICOMStudyItemWidget.h" @@ -66,6 +66,10 @@ class ctkDICOMStudyItemWidgetPrivate: public Ui_ctkDICOMStudyItemWidget void init(QWidget* parentWidget); void updateColumnsWidths(); void createSeries(); + int getScreenWidth(); + int getScreenHeight(); + int calculateNumerOfSeriesPerRow(const ctkDICOMStudyItemWidget::ThumbnailSizeOption &thumbnailSize); + int calculateThumbnailSizeInPixel(const ctkDICOMStudyItemWidget::ThumbnailSizeOption &thumbnailSize); void addEmptySeriesItemWidget(const int& rowIndex, const int& columnIndex); bool isSeriesItemAlreadyAdded(const QString& seriesItem); @@ -77,7 +81,8 @@ class ctkDICOMStudyItemWidgetPrivate: public Ui_ctkDICOMStudyItemWidget QSharedPointer Scheduler; QSharedPointer VisualDICOMBrowser; - int ThumbnailSize; + ctkDICOMStudyItemWidget::ThumbnailSizeOption ThumbnailSize; + int ThumbnailSizePixel; QString PatientID; QString StudyInstanceUID; QString StudyItem; @@ -90,7 +95,8 @@ class ctkDICOMStudyItemWidgetPrivate: public Ui_ctkDICOMStudyItemWidget ctkDICOMStudyItemWidgetPrivate::ctkDICOMStudyItemWidgetPrivate(ctkDICOMStudyItemWidget& obj) : q_ptr(&obj) { - this->ThumbnailSize = 300; + this->ThumbnailSize = ctkDICOMStudyItemWidget::ThumbnailSizeOption::Medium; + this->ThumbnailSizePixel = 200; this->FilteringSeriesDescription = ""; this->PatientID = ""; this->StudyInstanceUID = ""; @@ -142,9 +148,9 @@ void ctkDICOMStudyItemWidgetPrivate::init(QWidget* parentWidget) //------------------------------------------------------------------------------ void ctkDICOMStudyItemWidgetPrivate::updateColumnsWidths() { - for (int i = 0; i < this->SeriesListTableWidget->columnCount(); ++i) + for (int columnIndex = 0; columnIndex < this->SeriesListTableWidget->columnCount(); ++columnIndex) { - this->SeriesListTableWidget->setColumnWidth(i, this->ThumbnailSize); + this->SeriesListTableWidget->setColumnWidth(columnIndex, this->ThumbnailSizePixel); } } @@ -234,7 +240,57 @@ void ctkDICOMStudyItemWidgetPrivate::createSeries() } iHeight += 25; this->SeriesListTableWidget->setMinimumHeight(iHeight); + } +} + +//------------------------------------------------------------------------------ +int ctkDICOMStudyItemWidgetPrivate::getScreenWidth() +{ + QList screens = QApplication::screens(); + int width = 1920; + foreach (QScreen* screen, screens) + { + QRect rec = screen->geometry(); + if (rec.width() > width) + { + width = rec.width(); + } + } + + return width; +} + +//------------------------------------------------------------------------------ +int ctkDICOMStudyItemWidgetPrivate::getScreenHeight() +{ + QList screens = QApplication::screens(); + int height = 1080; + foreach (QScreen* screen, screens) + { + QRect rec = screen->geometry(); + if (rec.height() > height) + { + height = rec.height(); + } } + + return height; +} + +//------------------------------------------------------------------------------ +int ctkDICOMStudyItemWidgetPrivate::calculateNumerOfSeriesPerRow(const ctkDICOMStudyItemWidget::ThumbnailSizeOption &thumbnailSize) +{ + //int width = this->getScreenWidth(); + // To Do: formula based on screen width. + return 6; +} + +//------------------------------------------------------------------------------ +int ctkDICOMStudyItemWidgetPrivate::calculateThumbnailSizeInPixel(const ctkDICOMStudyItemWidget::ThumbnailSizeOption &thumbnailSize) +{ + //int height = this->getScreenHeight(); + // To Do: formula on screen height + return 200; } //------------------------------------------------------------------------------ @@ -388,14 +444,6 @@ bool ctkDICOMStudyItemWidget::collapsed()const return d->StudyItemCollapsibleGroupBox->collapsed(); } -//---------------------------------------------------------------------------- -void ctkDICOMStudyItemWidget::setNumberOfSeriesPerRow(int numberOfSeriesPerRow) -{ - Q_D(ctkDICOMStudyItemWidget); - d->SeriesListTableWidget->setColumnCount(numberOfSeriesPerRow); - d->updateColumnsWidths(); -} - //------------------------------------------------------------------------------ int ctkDICOMStudyItemWidget::numberOfSeriesPerRow() const { @@ -403,21 +451,30 @@ int ctkDICOMStudyItemWidget::numberOfSeriesPerRow() const return d->SeriesListTableWidget->columnCount(); } -//---------------------------------------------------------------------------- -void ctkDICOMStudyItemWidget::setThumbnailSize(int thumbnailSize) +//------------------------------------------------------------------------------ +void ctkDICOMStudyItemWidget::setThumbnailSize(const ctkDICOMStudyItemWidget::ThumbnailSizeOption &thumbnailSize) { Q_D(ctkDICOMStudyItemWidget); d->ThumbnailSize = thumbnailSize; + d->SeriesListTableWidget->setColumnCount(d->calculateNumerOfSeriesPerRow(d->ThumbnailSize)); + d->ThumbnailSizePixel = d->calculateThumbnailSizeInPixel(d->ThumbnailSize); d->updateColumnsWidths(); } //------------------------------------------------------------------------------ -int ctkDICOMStudyItemWidget::thumbnailSize() const +ctkDICOMStudyItemWidget::ThumbnailSizeOption ctkDICOMStudyItemWidget::thumbnailSize() const { Q_D(const ctkDICOMStudyItemWidget); return d->ThumbnailSize; } +//------------------------------------------------------------------------------ +int ctkDICOMStudyItemWidget::thumbnailSizePixel() const +{ + Q_D(const ctkDICOMStudyItemWidget); + return d->ThumbnailSizePixel; +} + //------------------------------------------------------------------------------ void ctkDICOMStudyItemWidget::setSelection(bool selected) { @@ -603,7 +660,7 @@ void ctkDICOMStudyItemWidget::addSeriesItemWidget(const int& tableIndex, seriesItemWidget->setSeriesNumber(seriesNumber); seriesItemWidget->setModality(modality); seriesItemWidget->setSeriesDescription(seriesDescription); - seriesItemWidget->setThumbnailSize(d->ThumbnailSize); + seriesItemWidget->setThumbnailSizePixel(d->ThumbnailSizePixel); seriesItemWidget->setDicomDatabase(d->DicomDatabase); seriesItemWidget->setScheduler(d->Scheduler); seriesItemWidget->generateInstances(); @@ -707,7 +764,5 @@ void ctkDICOMStudyItemWidget::updateGUIFromScheduler(QVariant data) //------------------------------------------------------------------------------ void ctkDICOMStudyItemWidget::onStudySelectionClicked(bool toggled) { - Q_D(ctkDICOMStudyItemWidget); - this->setSelection(toggled); } diff --git a/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.h b/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.h index 183b3fdb7d..eb6d3e3f66 100644 --- a/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.h +++ b/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.h @@ -30,6 +30,9 @@ #include #include +// ctkDICOMWidgets includes +#include "ctkDICOMSeriesItemWidget.h" + class ctkCollapsibleGroupBox; class ctkDICOMDatabase; class ctkDICOMScheduler; @@ -42,14 +45,16 @@ class QTableWidget; class CTK_DICOM_WIDGETS_EXPORT ctkDICOMStudyItemWidget : public QWidget { Q_OBJECT; + Q_ENUMS(ThumbnailSizeOption) Q_PROPERTY(QString studyItem READ studyItem WRITE setStudyItem); Q_PROPERTY(QString patientID READ patientID WRITE setPatientID); Q_PROPERTY(QString studyInstanceUID READ studyInstanceUID WRITE setStudyInstanceUID); Q_PROPERTY(QString title READ title WRITE setTitle); Q_PROPERTY(QString description READ description WRITE setDescription); Q_PROPERTY(bool collapsed READ collapsed WRITE setCollapsed); - Q_PROPERTY(int numberOfSeriesPerRow READ numberOfSeriesPerRow WRITE setNumberOfSeriesPerRow); - Q_PROPERTY(int thumbnailSize READ thumbnailSize WRITE setThumbnailSize); + Q_PROPERTY(int numberOfSeriesPerRow READ numberOfSeriesPerRow); + Q_PROPERTY(ThumbnailSizeOption thumbnailSize READ thumbnailSize WRITE setThumbnailSize); + Q_PROPERTY(int thumbnailSizePixel READ thumbnailSizePixel); public: typedef QWidget Superclass; @@ -82,14 +87,22 @@ class CTK_DICOM_WIDGETS_EXPORT ctkDICOMStudyItemWidget : public QWidget bool collapsed() const; /// Number of series displayed per row - /// 6 by default - void setNumberOfSeriesPerRow(int numberOfSeriesPerRow); int numberOfSeriesPerRow() const; - /// Series Thumbnail size - /// 300 px by default - void setThumbnailSize(int thumbnailSize); - int thumbnailSize() const; + enum ThumbnailSizeOption + { + Small = 0, + Medium, + Large, + }; + + /// Set the thumbnail size: small, medium, large + /// medium by default + void setThumbnailSize(const ThumbnailSizeOption &thumbnailSize); + ThumbnailSizeOption thumbnailSize() const; + + /// Thumbnail size in pixel + int thumbnailSizePixel() const; /// Study is selected void setSelection(bool selected); diff --git a/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.cpp index c787fa198d..496fdb00e4 100644 --- a/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.cpp @@ -51,7 +51,6 @@ // ctkDICOMWidgets includes #include "ctkDICOMObjectListWidget.h" #include "ctkDICOMVisualBrowserWidget.h" -#include "ctkDICOMStudyItemWidget.h" #include "ctkDICOMSeriesItemWidget.h" #include "ctkDICOMServerNodeWidget2.h" #include "ctkDICOMVisualBrowserWidget.h" @@ -222,8 +221,7 @@ class ctkDICOMVisualBrowserWidgetPrivate: public Ui_ctkDICOMVisualBrowserWidget QStringList FilteringModalities; int NumberOfStudiesPerPatient; - int NumberOfSeriesPerRow; - int MinimumThumbnailSize; + ctkDICOMStudyItemWidget::ThumbnailSizeOption ThumbnailSize; bool SendActionVisible; bool DeleteActionVisible; bool IsGUIUpdating; @@ -260,8 +258,7 @@ ctkDICOMVisualBrowserWidgetPrivate::ctkDICOMVisualBrowserWidgetPrivate(ctkDICOMV this->DatabaseDirectory = ""; this->NumberOfStudiesPerPatient = 2; - this->NumberOfSeriesPerRow = 6; - this->MinimumThumbnailSize = 300; + this->ThumbnailSize = ctkDICOMStudyItemWidget::ThumbnailSizeOption::Medium; this->SendActionVisible = false; this->DeleteActionVisible = true; @@ -1654,7 +1651,7 @@ QStringList ctkDICOMVisualBrowserWidget::filteringModalities() const } //------------------------------------------------------------------------------ -void ctkDICOMVisualBrowserWidget::setNumberOfStudiesPerPatient(int numberOfStudiesPerPatient) +void ctkDICOMVisualBrowserWidget::setNumberOfStudiesPerPatient(const int &numberOfStudiesPerPatient) { Q_D(ctkDICOMVisualBrowserWidget); d->NumberOfStudiesPerPatient = numberOfStudiesPerPatient; @@ -1668,35 +1665,21 @@ int ctkDICOMVisualBrowserWidget::numberOfStudiesPerPatient() const } //------------------------------------------------------------------------------ -void ctkDICOMVisualBrowserWidget::setNumberOfSeriesPerRow(int numberOfSeriesPerRow) +void ctkDICOMVisualBrowserWidget::setThumbnailSize(const ctkDICOMStudyItemWidget::ThumbnailSizeOption &thumbnailSize) { Q_D(ctkDICOMVisualBrowserWidget); - d->NumberOfSeriesPerRow = numberOfSeriesPerRow; + d->ThumbnailSize = thumbnailSize; } //------------------------------------------------------------------------------ -int ctkDICOMVisualBrowserWidget::numberOfSeriesPerRow() const +ctkDICOMStudyItemWidget::ThumbnailSizeOption ctkDICOMVisualBrowserWidget::thumbnailSize() const { Q_D(const ctkDICOMVisualBrowserWidget); - return d->NumberOfSeriesPerRow; + return d->ThumbnailSize; } //------------------------------------------------------------------------------ -void ctkDICOMVisualBrowserWidget::setMinimumThumbnailSize(int minimumThumbnailSize) -{ - Q_D(ctkDICOMVisualBrowserWidget); - d->MinimumThumbnailSize = minimumThumbnailSize; -} - -//------------------------------------------------------------------------------ -int ctkDICOMVisualBrowserWidget::minimumThumbnailSize() const -{ - Q_D(const ctkDICOMVisualBrowserWidget); - return d->MinimumThumbnailSize; -} - -//------------------------------------------------------------------------------ -void ctkDICOMVisualBrowserWidget::setSendActionVisible(bool visible) +void ctkDICOMVisualBrowserWidget::setSendActionVisible(const bool &visible) { Q_D(ctkDICOMVisualBrowserWidget); d->SendActionVisible = visible; @@ -1711,7 +1694,7 @@ bool ctkDICOMVisualBrowserWidget::isSendActionVisible() const //------------------------------------------------------------------------------ -void ctkDICOMVisualBrowserWidget::setDeleteActionVisible(bool visible) +void ctkDICOMVisualBrowserWidget::setDeleteActionVisible(const bool &visible) { Q_D(ctkDICOMVisualBrowserWidget); d->DeleteActionVisible = visible; @@ -1744,8 +1727,7 @@ void ctkDICOMVisualBrowserWidget::addPatientItemWidget(const QString& patientIte patientItemWidget->setFilteringDate(d->FilteringDate); patientItemWidget->setFilteringSeriesDescription(d->FilteringSeriesDescription); patientItemWidget->setFilteringModalities(d->FilteringModalities); - patientItemWidget->setMinimumThumbnailSize(d->MinimumThumbnailSize); - patientItemWidget->setNumberOfSeriesPerRow(d->NumberOfSeriesPerRow); + patientItemWidget->setThumbnailSize(d->ThumbnailSize); patientItemWidget->setNumberOfStudiesPerPatient(d->NumberOfStudiesPerPatient); patientItemWidget->setDicomDatabase(d->DicomDatabase); patientItemWidget->setScheduler(d->Scheduler); diff --git a/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.h b/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.h index cb0eed3662..3a3b1a5745 100644 --- a/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.h +++ b/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.h @@ -31,7 +31,8 @@ #include // CTK includes -#include +#include "ctkDICOMPatientItemWidget.h" +#include "ctkDICOMStudyItemWidget.h" #include "ctkDICOMModel.h" #include "ctkErrorLogLevel.h" @@ -75,8 +76,7 @@ class CTK_DICOM_WIDGETS_EXPORT ctkDICOMVisualBrowserWidget : public QWidget Q_PROPERTY(QString filteringPatientID READ filteringPatientID WRITE setFilteringPatientID); Q_PROPERTY(QString filteringPatientName READ filteringPatientName WRITE setFilteringPatientName); Q_PROPERTY(int numberOfStudiesPerPatient READ numberOfStudiesPerPatient WRITE setNumberOfStudiesPerPatient); - Q_PROPERTY(int numberOfSeriesPerRow READ numberOfSeriesPerRow WRITE setNumberOfSeriesPerRow); - Q_PROPERTY(int minimumThumbnailSize READ minimumThumbnailSize WRITE setMinimumThumbnailSize); + Q_PROPERTY(ctkDICOMStudyItemWidget::ThumbnailSizeOption thumbnailSize READ thumbnailSize WRITE setThumbnailSize); Q_PROPERTY(bool sendActionVisible READ isSendActionVisible WRITE setSendActionVisible) Q_PROPERTY(bool deleteActionVisible READ isDeleteActionVisible WRITE setDeleteActionVisible) Q_PROPERTY(QString storageAETitle READ storageAETitle WRITE setStorageAETitle); @@ -183,27 +183,22 @@ class CTK_DICOM_WIDGETS_EXPORT ctkDICOMVisualBrowserWidget : public QWidget /// Number of non collapsed studies per patient /// 2 by default - void setNumberOfStudiesPerPatient(int numberOfStudiesPerPatient); + void setNumberOfStudiesPerPatient(const int &numberOfStudiesPerPatient); int numberOfStudiesPerPatient() const; - /// Number of series displayed per row - /// 6 by default - void setNumberOfSeriesPerRow(int numberOfSeriesPerRow); - int numberOfSeriesPerRow() const; - - /// Minimum thumbnail size in pixel - /// 300 by default - void setMinimumThumbnailSize(int minimumThumbnailSize); - int minimumThumbnailSize() const; + /// Set the thumbnail size: small, medium, large + /// medium by default + void setThumbnailSize(const ctkDICOMStudyItemWidget::ThumbnailSizeOption &thumbnailSize); + ctkDICOMStudyItemWidget::ThumbnailSizeOption thumbnailSize() const; /// Set if send action on right click context menu is available /// false by default - void setSendActionVisible(bool visible); + void setSendActionVisible(const bool &visible); bool isSendActionVisible() const; /// Set if cancel action on right click context menu is available /// true by default - void setDeleteActionVisible(bool visible); + void setDeleteActionVisible(const bool &visible); bool isDeleteActionVisible() const; /// Add/Remove Patient item widget