diff --git a/src/include/QDicomViewer.h b/src/include/QDicomViewer.h index 2f4c544..48583cc 100644 --- a/src/include/QDicomViewer.h +++ b/src/include/QDicomViewer.h @@ -7,6 +7,10 @@ #include "Customwindow.h" #include "pqFontPropertyWidget.h" +/** + * @brief 主窗口Class + * 继承自QMainWindow,主要用于显示整个界面 + */ class QDicomViewer : public QMainWindow { Q_OBJECT @@ -23,10 +27,21 @@ public slots: private: Ui::QDicomViewerClass *ui; + /** + * 从qrc中读取指定抿成的StyleSheet文件 + * @param sheetName StyleSheet文件名 + */ void loadStyleSheet(const QString &sheetName); + /** + * 初始化函数,主要实现了Button的构建和槽函数绑定 + */ void Initial(); void createToolButton(); - + + /** + * 用于设置ToolButton相关的属性(文字、图标、槽等)的一组函数 + * @{ + */ void SetupFileTool(QToolButton* fileBtn); void SetupImportTool(QToolButton* importBtn); void SetupExportTool(QToolButton *saveBtn); @@ -51,12 +66,38 @@ private: void SetupMaximizeTool(QToolButton *btnmaximize); void SetupMinimizeTool(QToolButton *btnminimize); void SetupCloseTool(QToolButton *btnclose); + //@} - + /** + * 设置是否显示缩略图栏 + * TODO:考虑改名为setThumbnailBarDisplay + * @param value + */ void displayThumbnailBar(bool value); + + /** + * 打开DICOM,并在界面上绘制出显示效果 + * @param dicomName DICOM文件路径 + * @param openMode 文件打开方式,文件方式或文件夹方式 + */ void drawDICOM(const std::string &dicomName, SeriesOpenMode openMode); - void setConnections(); + + /** + * 设置部分空间的槽函数连接 + */ + void SetupConnections(); + + /** + * 按照annType的类型,在Container中执行对应的Measurement操作 + * @param Container 包含RenderWindow的QTWidget容器 + * @param annType 需要执行操作的AnnotationActorType + */ void executeActiveMeasure(ViewContainerWidget *Container, AnnotationActorType annType); + + /** + * 为对应的DicomImageView构建对应的播放控件 + * @param v + */ void createVCRToolbar(DicomImageView *v); QIcon icon_manual; diff --git a/src/include/global/QGlobals.h b/src/include/global/QGlobals.h index d105d81..7d3505e 100644 --- a/src/include/global/QGlobals.h +++ b/src/include/global/QGlobals.h @@ -17,11 +17,11 @@ #include using namespace std; -// 汾 +// ����汾 #define Project_NAME "EquilibriumNine DicomViewer" #define Project_VER "1.0.0.0" -//Ϣ +//�����Ϣ #define Project_OrganizationName "EquilibriumNine" #define Project_OrganizationDomain "" @@ -416,6 +416,8 @@ typedef struct PatientInfo std::string birth_date; QPushButton *patient_label; StudiesMapType *studies; - PatientInfo():patient_label(nullptr), studies(nullptr){} + PatientInfo():patient_label(nullptr), studies(nullptr){ + printf("constr PatientInfo \r\n"); + } }PatientInfo_t; typedef std::map PatientsMapType; diff --git a/src/src/QDicomViewer.cpp b/src/src/QDicomViewer.cpp index 32494a2..81f956d 100644 --- a/src/src/QDicomViewer.cpp +++ b/src/src/QDicomViewer.cpp @@ -85,9 +85,11 @@ m_import(nullptr) this->statusBar()->showMessage(tr("Ready")); QWidget::setWindowTitle(Project_NAME); - icon_manual.addFile(QStringLiteral(SYNC_MANUAL_URL), QSize(), QIcon::Normal, QIcon::Off); - icon_auto.addFile(QStringLiteral(SYNC_AUTO_URL), QSize(), QIcon::Normal, QIcon::Off); - icon_dis.addFile(QStringLiteral(SYNC_DIS_URL), QSize(), QIcon::Normal, QIcon::Off); + //init icons + icon_manual.addFile(QStringLiteral(SYNC_MANUAL_URL)); + icon_auto.addFile(QStringLiteral(SYNC_AUTO_URL)); + icon_dis.addFile(QStringLiteral(SYNC_DIS_URL)); + this->Initial(); loadStyleSheet("Combinear"); @@ -95,14 +97,17 @@ m_import(nullptr) QSize size(27, 27); this->setIconSize(size); + //init fontsizehelper QScreen* screen = QGuiApplication::primaryScreen(); QRect rect = screen->geometry(); FontSizeHelper::desktop_width = rect.width(); FontSizeHelper::desktop_height = rect.height(); + //hidden humbnailBar as default displayThumbnailBar(false); - OrienHelper::init(); + //TODO:目前为方向是写死的正交方向 + orientationHelper::init(); } QDicomViewer::~QDicomViewer() { @@ -124,7 +129,7 @@ void QDicomViewer::loadStyleSheet(const QString& sheetName) void QDicomViewer::Initial() { this->createToolButton(); - this->setConnections(); + this->SetupConnections(); } void QDicomViewer::createToolButton() @@ -260,6 +265,7 @@ void QDicomViewer::SetupCloseTool(QToolButton* btnclose) void QDicomViewer::SetupAnnoTool(QToolButton* annoBtn) { + //主要设置了四角标签的操作逻辑 annoBtn->setToolTip(QString("Toggle annotations")); connect(annoBtn, &QToolButton::clicked, this, [=] { AnnoHelper::toggleAnno(); @@ -328,8 +334,8 @@ void QDicomViewer::SetupAnnoTool(QToolButton* annoBtn) - - +//AnnotationActor执行相关 +//TODO:考虑从这个类中移除,采用factory模式解耦合 void QDicomViewer::executeActiveMeasure(ViewContainerWidget* Container, AnnotationActorType annType) { QList viewers = Container->getViewList(); @@ -408,6 +414,8 @@ void QDicomViewer::executeActiveMeasure(ViewContainerWidget* Container, Annotati } + +//AnnotationActor新增相关 void QDicomViewer::SetupMeasureTool(QToolButton* measureBtn) { measureBtn->setToolTip(QString("Measurements")); @@ -945,7 +953,7 @@ void QDicomViewer::SetupGridTool(QToolButton* gridBtn) { } -void QDicomViewer::setConnections() +void QDicomViewer::SetupConnections() { //connect(ui->action_OpenDicomFile, SIGNAL(triggered()), this, SLOT(OnOpenDicomFile())); //connect(ui->action_OpenDicomFolder, SIGNAL(triggered()), this, SLOT(OnOpenSeriesFolder())); diff --git a/src/src/base/DicomLoader.cpp b/src/src/base/DicomLoader.cpp index 745e4ad..f4ad3a2 100644 --- a/src/src/base/DicomLoader.cpp +++ b/src/src/base/DicomLoader.cpp @@ -198,9 +198,6 @@ void DicomLoader::InitFromCopy(SeriesInstance* instance) void DicomLoader::InitFromRead(SeriesInstance* instance)//, DicomTagInfo_t* tag_info) { - ////////////////////////////////////////////////////////////////////////// - //You have to use DeepCopy on this condition,otherwise, the previous image will be flushed. - instance->m_image = reader->GetOutput(); if (instance->getUniqueID()->open_mode == DIR_OPEN_MODE) diff --git a/src/src/view/thumbnailbarwidget.cpp b/src/src/view/thumbnailbarwidget.cpp index d30df10..684fb62 100644 --- a/src/src/view/thumbnailbarwidget.cpp +++ b/src/src/view/thumbnailbarwidget.cpp @@ -119,18 +119,13 @@ void ThumbnailBarWidget::updateThumbnailBar() LabelList.removeOne(l); //delete l; } - //foreach(thumbnailImage *t, imageLabelList) { - // imageLabelList.removeOne(t); - // //delete l; - //} - - - DicomLoader *helper = DicomLoader::GetInstance(); + //获取Patient const PatientsMapType & all_patients = helper->getPatientsList(); for (PatientsMapType::const_iterator it_pa = all_patients.cbegin(); it_pa != all_patients.cend(); it_pa++) { + //构建Patient panel QPushButton *patient_lbl = it_pa->second->patient_label; if (!patient_lbl) { @@ -141,12 +136,6 @@ void ThumbnailBarWidget::updateThumbnailBar() qtext.replace("^", "\n"); patient_lbl->setText(qtext); patient_lbl->setEnabled(false); - //patient_lbl->setGeometry(0, 0, 100, 100); - //QFont font; - //font.setFamily(QString::fromUtf8("Britannic Bold")); - //patient_lbl->setFont(font); - //patient_lbl->setWordWrap(true); - //patient_lbl->setFrameShape(QFrame::NoFrame); } seriesPanel->layout()->addWidget(patient_lbl); LabelList << patient_lbl; @@ -222,24 +211,10 @@ thumbnailImage* ThumbnailBarWidget::createThumbnailImage(QWidget *parent, Series } -//void ThumbnailBarWidget::paintEvent(QPaintEvent *) -//{ -// QStyleOption o; -// o.initFrom(this); -// QPainter p(this); -// style()->drawPrimitive( -// QStyle::PE_Widget, &o, &p, this); -//} +//该槽函数未使用 void ThumbnailBarWidget::Slot_setCurrentThumbnail(DicomImageView *view) { - - //cancel all highlight; - //if (currentImageLabel) - //{ - // currentImageLabel->setHighlight(false); - //} - if (view != nullptr) { if (view->HasSeries()) { @@ -264,11 +239,6 @@ void ThumbnailBarWidget::Slot_setCurrentThumbnail(DicomImageView *view) } } } - //else - //{ - // currentImageLabel->setHighlight(false); - // currentImageLabel = nullptr; - //} } void ThumbnailBarWidget::SLot_ThumbClicked(thumbnailImage* thumb)