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 1de3f3f commit 9f14ae6
Show file tree
Hide file tree
Showing 9 changed files with 267 additions and 244 deletions.
227 changes: 113 additions & 114 deletions Libs/DICOM/Widgets/Resources/UI/ctkDICOMServerNodeWidget2.ui
Original file line number Diff line number Diff line change
Expand Up @@ -29,119 +29,7 @@
<property name="spacing">
<number>5</number>
</property>
<item row="1" column="0" colspan="4">
<widget class="QLabel" name="ServersLabel">
<property name="text">
<string>Servers</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QTableWidget" name="NodeTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="textElideMode">
<enum>Qt::ElideRight</enum>
</property>
<property name="columnCount">
<number>10</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>165</number>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>165</number>
</attribute>
<attribute name="horizontalHeaderHighlightSections">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Query/Retrieve</string>
</property>
</column>
<column>
<property name="text">
<string>Storage</string>
</property>
</column>
<column>
<property name="text">
<string>Calling AETitle</string>
</property>
</column>
<column>
<property name="text">
<string>Called AETitle</string>
</property>
</column>
<column>
<property name="text">
<string>Address</string>
</property>
</column>
<column>
<property name="text">
<string>Port</string>
</property>
</column>
<column>
<property name="text">
<string>Timeout</string>
</property>
</column>
<column>
<property name="text">
<string>Protocol</string>
</property>
</column>
<column>
<property name="text">
<string>Proxy</string>
</property>
</column>
</widget>
</item>
<item row="3" column="0" colspan="3">
<item row="3" column="0" colspan="2">
<widget class="ctkCollapsibleGroupBox" name="StorageCollapsibleGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
Expand Down Expand Up @@ -281,7 +169,7 @@
</layout>
</widget>
</item>
<item row="2" column="3" rowspan="3">
<item row="1" column="2" rowspan="4">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>3</number>
Expand Down Expand Up @@ -380,6 +268,117 @@
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="ctkCollapsibleGroupBox" name="ServersCollapsibleGroupBox">
<property name="title">
<string>Servers </string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTableWidget" name="NodeTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="textElideMode">
<enum>Qt::ElideRight</enum>
</property>
<property name="columnCount">
<number>10</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>165</number>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>165</number>
</attribute>
<attribute name="horizontalHeaderHighlightSections">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Query/Retrieve</string>
</property>
</column>
<column>
<property name="text">
<string>Storage</string>
</property>
</column>
<column>
<property name="text">
<string>Calling AETitle</string>
</property>
</column>
<column>
<property name="text">
<string>Called AETitle</string>
</property>
</column>
<column>
<property name="text">
<string>Address</string>
</property>
</column>
<column>
<property name="text">
<string>Port</string>
</property>
</column>
<column>
<property name="text">
<string>Timeout</string>
</property>
</column>
<column>
<property name="text">
<string>Protocol</string>
</property>
</column>
<column>
<property name="text">
<string>Proxy</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
Expand Down
35 changes: 7 additions & 28 deletions Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

// ctkDICOMWidgets includes
#include "ctkDICOMSeriesItemWidget.h"
#include "ctkDICOMStudyItemWidget.h"
#include "ctkDICOMPatientItemWidget.h"
#include "ui_ctkDICOMPatientItemWidget.h"

Expand Down Expand Up @@ -74,8 +73,7 @@ class ctkDICOMPatientItemWidgetPrivate: public Ui_ctkDICOMPatientItemWidget
QSharedPointer<QWidget> VisualDICOMBrowser;

int NumberOfStudiesPerPatient;
int NumberOfSeriesPerRow;
int MinimumThumbnailSize;
ctkDICOMStudyItemWidget::ThumbnailSizeOption ThumbnailSize;

QString PatientItem;
QString PatientID;
Expand All @@ -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 = "";
Expand Down Expand Up @@ -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;
}

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -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);
Expand Down
21 changes: 9 additions & 12 deletions Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@

#include "ctkDICOMWidgetsExport.h"

// Qt includes
// Qt includes
#include <QWidget>
#include <QVariant>

// CTK includes
#include "ctkDICOMStudyItemWidget.h"

class ctkDICOMPatientItemWidgetPrivate;

class ctkDICOMDatabase;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 9f14ae6

Please sign in to comment.