Refactor QDicomViewer, extract toolbar DefaultToolBar class, refactor state -> only can build.
This commit is contained in:
@@ -50,6 +50,83 @@ QToolButton:disabled
|
|||||||
background-color: #222222;
|
background-color: #222222;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QToolBar QToolButton{
|
||||||
|
min-width: 36px;
|
||||||
|
max-width: 36px;
|
||||||
|
min-height: 36px;
|
||||||
|
max-height: 36px;
|
||||||
|
/*qproperty-iconSize:36px 36px;*/
|
||||||
|
}
|
||||||
|
QToolButton#groupButton {
|
||||||
|
qproperty-checkable:true;
|
||||||
|
qproperty-autoExclusive:true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolBar QToolButton[toolButtonStyle="2"]{
|
||||||
|
min-width: 42px;
|
||||||
|
max-width: 42px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton#file {
|
||||||
|
qproperty-icon:url(":/InfiniteViewer/Icon/openfile.png");
|
||||||
|
}
|
||||||
|
QToolButton#import {
|
||||||
|
qproperty-icon: url(":/InfiniteViewer/Icon/import.png")
|
||||||
|
}
|
||||||
|
QToolButton#save {
|
||||||
|
qproperty-icon: url(":/InfiniteViewer/Icon/save.png")
|
||||||
|
}
|
||||||
|
QToolButton#grid {
|
||||||
|
qproperty-icon: url(":/InfiniteViewer/Icon/grid.png")
|
||||||
|
}
|
||||||
|
QToolButton#sync {
|
||||||
|
qproperty-icon: url(":/InfiniteViewer/Icon/sync/sync_dis.png")
|
||||||
|
}
|
||||||
|
QToolButton#anonymize {
|
||||||
|
qproperty-icon: url(":/InfiniteViewer/Icon/anno.png")
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton#slice{qproperty-icon:url(":/InfiniteViewer/Icon/slice.png")}
|
||||||
|
QToolButton#window{qproperty-icon:url(":/InfiniteViewer/Icon/windowlevel.png")}
|
||||||
|
QToolButton#pan{qproperty-icon:url(":/InfiniteViewer/Icon/pan.png")}
|
||||||
|
QToolButton#zoom{qproperty-icon:url(":/InfiniteViewer/Icon/zoom.png")}
|
||||||
|
QToolButton#measure{qproperty-icon:url(":/InfiniteViewer/Icon/distance.png")}
|
||||||
|
QToolButton#clear{qproperty-icon:url(":/InfiniteViewer/Icon/trashbin.png")}
|
||||||
|
|
||||||
|
QToolButton#flip{qproperty-icon:url(":/InfiniteViewer/Icon/flip.png")}
|
||||||
|
QToolButton#cine{qproperty-icon:url(":/InfiniteViewer/Icon/cine.png")}
|
||||||
|
QToolButton#fusion{qproperty-icon:url(":/InfiniteViewer/Icon/fusion.png")}
|
||||||
|
QToolButton#MPR{qproperty-icon:url(":/InfiniteViewer/Icon/MPR.png")}
|
||||||
|
|
||||||
|
QToolButton#minimize{
|
||||||
|
min-height: 25px;
|
||||||
|
max-height: 25px;
|
||||||
|
min-width: 25px;
|
||||||
|
max-width: 25px;
|
||||||
|
qproperty-icon:url(":/InfiniteViewer/Icon/minimize.png")
|
||||||
|
}
|
||||||
|
QToolButton#maximize{
|
||||||
|
min-height: 25px;
|
||||||
|
max-height: 25px;
|
||||||
|
min-width: 25px;
|
||||||
|
max-width: 25px;
|
||||||
|
qproperty-icon:url(":/InfiniteViewer/Icon/maximize-restore.png")
|
||||||
|
}
|
||||||
|
QToolButton#close{
|
||||||
|
min-height: 25px;
|
||||||
|
max-height: 25px;
|
||||||
|
min-width: 25px;
|
||||||
|
max-width: 25px;
|
||||||
|
qproperty-icon:url(":/InfiniteViewer/Icon/close.png")
|
||||||
|
}
|
||||||
|
QToolButton#fullscreen{
|
||||||
|
min-height: 25px;
|
||||||
|
max-height: 25px;
|
||||||
|
min-width: 25px;
|
||||||
|
max-width: 25px;
|
||||||
|
qproperty-icon:url(":/InfiniteViewer/Icon/full_screen.png")
|
||||||
|
}
|
||||||
|
|
||||||
/*-----QMenu-----*/
|
/*-----QMenu-----*/
|
||||||
QMenu {
|
QMenu {
|
||||||
background-color: #f0f0f0;
|
background-color: #f0f0f0;
|
||||||
|
|||||||
@@ -30,11 +30,6 @@ using namespace std;
|
|||||||
#define Project_OrganizationDomain ""
|
#define Project_OrganizationDomain ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SYNC_MANUAL_URL ":/InfiniteViewer/Icon/sync/sync_manual.png"
|
|
||||||
#define SYNC_AUTO_URL ":/InfiniteViewer/Icon/sync/sync_auto.png"
|
|
||||||
#define SYNC_DIS_URL ":/InfiniteViewer/Icon/sync/sync_dis.png"
|
|
||||||
|
|
||||||
#define CLOSE_URL ":/InfiniteViewer/Icon/close.png"
|
#define CLOSE_URL ":/InfiniteViewer/Icon/close.png"
|
||||||
#define MAX_URL ":/InfiniteViewer/Icon/max.png"
|
#define MAX_URL ":/InfiniteViewer/Icon/max.png"
|
||||||
|
|
||||||
|
|||||||
@@ -334,11 +334,11 @@ void ImageViewManager::unloadFusion() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageViewManager::switchFusion() {
|
void ImageViewManager::switchFusion(bool fusion) {
|
||||||
if (currentView) {
|
if (currentView) {
|
||||||
if (currentView->hasSeries() && currentView->isFusion()) {
|
if (currentView->hasSeries() && currentView->isFusion() && !fusion) {
|
||||||
unloadFusion();
|
unloadFusion();
|
||||||
} else {
|
} else if (fusion) {
|
||||||
loadFusion();
|
loadFusion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -357,3 +357,7 @@ bool ImageViewManager::checkViewFusion(DicomImageView *view) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImageViewManager::clearCurrentView() {
|
||||||
|
currentView->viewCleared();
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ public:
|
|||||||
|
|
||||||
void viewCleared(DicomImageView* view);
|
void viewCleared(DicomImageView* view);
|
||||||
|
|
||||||
|
void clearCurrentView();
|
||||||
|
|
||||||
void setInteractionMode(int InteractionMode);
|
void setInteractionMode(int InteractionMode);
|
||||||
|
|
||||||
void renderAll();
|
void renderAll();
|
||||||
@@ -92,7 +94,7 @@ public:
|
|||||||
|
|
||||||
void loadFusion();
|
void loadFusion();
|
||||||
|
|
||||||
void switchFusion();
|
void switchFusion(bool fusion);
|
||||||
|
|
||||||
enum DoScope {
|
enum DoScope {
|
||||||
Current,
|
Current,
|
||||||
|
|||||||
434
src/src/UI/Widget/ToolBar/DefaultToolBar.cpp
Normal file
434
src/src/UI/Widget/ToolBar/DefaultToolBar.cpp
Normal file
@@ -0,0 +1,434 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/8/1.
|
||||||
|
//
|
||||||
|
#include "DefaultToolBar.h"
|
||||||
|
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QButtonGroup>
|
||||||
|
#include "Rendering/Measure/Measure.h"
|
||||||
|
|
||||||
|
#include "Common/QGlobals.h"
|
||||||
|
typedef tuple<const char *, const char *, int> ActionProperty;
|
||||||
|
namespace {
|
||||||
|
const char *SYNC_MANUAL_URL = ":/InfiniteViewer/Icon/sync/sync_manual.png";
|
||||||
|
const char *SYNC_AUTO_URL = ":/InfiniteViewer/Icon/sync/sync_auto.png";
|
||||||
|
const char *SYNC_DIS_URL = ":/InfiniteViewer/Icon/sync/sync_dis.png";
|
||||||
|
const int ACTION_COUNT = 7;
|
||||||
|
const ActionProperty MEASURE_ACTIIONS[ACTION_COUNT] = {
|
||||||
|
{"Length", ":/InfiniteViewer/Icon/distance.png", AnnotationActorType::RulerAnn},
|
||||||
|
{"Angle", ":/InfiniteViewer/Icon/angle.png", AnnotationActorType::AngleAnn},
|
||||||
|
{"Closed polygon", ":/InfiniteViewer/Icon/polygon.png", AnnotationActorType::ClosedPolygonAnn},
|
||||||
|
{"Open polygon", ":/InfiniteViewer/Icon/polyline.png", AnnotationActorType::OpenPolygonAnn},
|
||||||
|
{"Arrow", ":/InfiniteViewer/Icon/arrow.png", AnnotationActorType::ArrowAnn},
|
||||||
|
{"Ellipse", ":/InfiniteViewer/Icon/ellipse.png", AnnotationActorType::EllipseAnn},
|
||||||
|
{"Text", ":/InfiniteViewer/Icon/text.png", AnnotationActorType::TextAnn}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
DefaultToolBar::DefaultToolBar(QWidget *parent) : QToolBar(parent)
|
||||||
|
, mBtnFile(new QToolButton(this))
|
||||||
|
, mBtnImport(new QToolButton(this))
|
||||||
|
, mBtnSave(new QToolButton(this))
|
||||||
|
, mBtnGrid(new QToolButton(this))
|
||||||
|
, mBtnSync(new QToolButton(this))
|
||||||
|
, mBtnAnonymize(new QToolButton(this))
|
||||||
|
, mBtnSlice(new QToolButton(this))
|
||||||
|
, mBtnWindow(new QToolButton(this))
|
||||||
|
, mBtnPan(new QToolButton(this))
|
||||||
|
, mBtnZoom(new QToolButton(this))
|
||||||
|
, mBtnMeasure(new QToolButton(this))
|
||||||
|
, mBtnClear(new QToolButton(this))
|
||||||
|
, mBtnFlip(new QToolButton(this))
|
||||||
|
, mBtnCine(new QToolButton(this))
|
||||||
|
, mBtnFusion(new QToolButton(this))
|
||||||
|
, mBtnMPR(new QToolButton(this))
|
||||||
|
, mBtnMinimize(new QToolButton(this))
|
||||||
|
, mBtnMaximize(new QToolButton(this))
|
||||||
|
, mBtnClose(new QToolButton(this))
|
||||||
|
, mBtnFullScreen(new QToolButton(this))
|
||||||
|
, mActionMinimize(nullptr)
|
||||||
|
, mActionMaximize(nullptr)
|
||||||
|
, mActionClose(nullptr)
|
||||||
|
, mActionFullScreen(nullptr) {
|
||||||
|
//init icons
|
||||||
|
mManualIcon.addFile(SYNC_MANUAL_URL);
|
||||||
|
mAutoIcon.addFile(SYNC_AUTO_URL);
|
||||||
|
mDisIcon.addFile(SYNC_DIS_URL);
|
||||||
|
initButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
DefaultToolBar::~DefaultToolBar() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QAction* DefaultToolBar::initButton(QToolButton* button, const char* objectName) {
|
||||||
|
button->setObjectName(objectName);
|
||||||
|
button->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||||
|
return addWidget(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::initGroupedButton(QToolButton* button, const char* objectName, QButtonGroup * group) {
|
||||||
|
button->setObjectName(objectName);
|
||||||
|
button->setCheckable(true);
|
||||||
|
button->setAutoExclusive(true);
|
||||||
|
group->addButton(button);
|
||||||
|
addWidget(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::initButtons() {
|
||||||
|
setContextMenuPolicy(Qt::ContextMenuPolicy::PreventContextMenu);
|
||||||
|
setFixedHeight(VCRHelper::toolbar_Height);
|
||||||
|
setMovable(false);
|
||||||
|
initButton(mBtnFile, "file");
|
||||||
|
initButton(mBtnImport, "import");
|
||||||
|
initButton(mBtnSave, "save");
|
||||||
|
|
||||||
|
addSeparator();
|
||||||
|
|
||||||
|
initButton(mBtnGrid, "grid");
|
||||||
|
initButton(mBtnSync, "sync");
|
||||||
|
initButton(mBtnAnonymize, "anonymize");
|
||||||
|
|
||||||
|
addSeparator();
|
||||||
|
|
||||||
|
QButtonGroup *modeGroup = new QButtonGroup(this);
|
||||||
|
initGroupedButton(mBtnSlice, "slice", modeGroup);
|
||||||
|
initGroupedButton(mBtnWindow, "window", modeGroup);
|
||||||
|
initGroupedButton(mBtnPan, "pan", modeGroup);
|
||||||
|
initGroupedButton(mBtnZoom, "zoom", modeGroup);
|
||||||
|
initGroupedButton(mBtnMeasure, "measure", modeGroup);
|
||||||
|
initButton(mBtnClear, "clear");
|
||||||
|
addSeparator();
|
||||||
|
|
||||||
|
|
||||||
|
initButton(mBtnFlip, "flip");
|
||||||
|
initButton(mBtnCine, "cine");
|
||||||
|
initButton(mBtnFusion, "fusion");
|
||||||
|
initButton(mBtnMPR, "MPR");
|
||||||
|
|
||||||
|
QWidget *spacer = new QWidget(this);
|
||||||
|
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
|
addWidget(spacer);
|
||||||
|
|
||||||
|
mActionMinimize = initButton(mBtnMinimize, "minimize");
|
||||||
|
mActionMaximize = initButton(mBtnMaximize, "maximize");
|
||||||
|
mActionClose = initButton(mBtnClose, "close");
|
||||||
|
mActionFullScreen = initButton(mBtnFullScreen, "fullscreen");
|
||||||
|
|
||||||
|
mActionMinimize->setVisible(false);
|
||||||
|
mActionMaximize->setVisible(false);
|
||||||
|
mActionClose->setVisible(false);
|
||||||
|
|
||||||
|
SetupFileTool();
|
||||||
|
SetupImportTool();
|
||||||
|
SetupExportTool();
|
||||||
|
SetupGridTool();
|
||||||
|
SetupSyncTool();
|
||||||
|
SetupModeTool();
|
||||||
|
SetupTransformTool();
|
||||||
|
SetupFusionTool();
|
||||||
|
SetupCineTool();
|
||||||
|
SetupEmptyTool();
|
||||||
|
SetupScreenTool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::SetupFileTool() {
|
||||||
|
mBtnFile->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
|
// Menu
|
||||||
|
mBtnFile->setToolTip(QString("Open Dicom series from directory"));
|
||||||
|
QMenu *m;
|
||||||
|
m = new QMenu(this);
|
||||||
|
m->addAction(tr("Open DICOM folder"), this, &DefaultToolBar::openFolder);
|
||||||
|
|
||||||
|
m->addAction(tr("Open DICOM file"), this, &DefaultToolBar::openFile);
|
||||||
|
|
||||||
|
m->addSeparator();
|
||||||
|
m->addAction(tr("Quit"), this, &DefaultToolBar::parentWindowClose);
|
||||||
|
mBtnFile->setPopupMode(QToolButton::MenuButtonPopup);
|
||||||
|
mBtnFile->setMenu(m);
|
||||||
|
|
||||||
|
// connect
|
||||||
|
connect(mBtnFile, &QToolButton::clicked, this, &DefaultToolBar::openFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::SetupImportTool() {
|
||||||
|
mBtnImport->setToolTip(QString("Search and download studies from PACS locations"));
|
||||||
|
connect(mBtnImport, &QToolButton::clicked, this, &DefaultToolBar::import);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::SetupExportTool() {
|
||||||
|
mBtnSave->setToolTip(QString("Export images"));
|
||||||
|
connect(mBtnSave, &QToolButton::clicked, this, &DefaultToolBar::save);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::SetupGridTool() {
|
||||||
|
mBtnGrid->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
|
mBtnGrid->setToolTip(QString("Split Screen"));
|
||||||
|
// connect
|
||||||
|
connect(mBtnGrid, &QToolButton::clicked, this, [=](){
|
||||||
|
emit showGrid(mBtnGrid);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::SetupSyncTool() {
|
||||||
|
mBtnSync->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
|
mBtnSync->setToolTip(QString("Toggle series synchronization"));
|
||||||
|
// Menu
|
||||||
|
QMenu * m = new QMenu(this);
|
||||||
|
|
||||||
|
SyncState curst = SyncHelper::getSyncState();
|
||||||
|
mActionSyncState = m->addAction(QString(tr("CUR STATE: %1")).arg(SyncHelper::SyncStateName[curst]));
|
||||||
|
mActionSyncState->setCheckable(false);
|
||||||
|
addSeparator();
|
||||||
|
|
||||||
|
#define ADD_SYNC_ITEM(index,text,type)\
|
||||||
|
mSyncActions[index] = m->addAction(tr(text), this, [&](bool value) {\
|
||||||
|
SyncHelper::setSyncItem(type, value);\
|
||||||
|
});\
|
||||||
|
mSyncActions[index]->setCheckable(true);\
|
||||||
|
mSyncActions[index]->setChecked(false);\
|
||||||
|
mSyncActions[index]->setDisabled(true);
|
||||||
|
|
||||||
|
ADD_SYNC_ITEM(0,"Sychronize slice position",SyncItem::SLICE_POS)
|
||||||
|
ADD_SYNC_ITEM(1,"Sychronize zoom & pan",SyncItem::ZOOM_PAN)
|
||||||
|
ADD_SYNC_ITEM(2,"Sychronize window level & width",SyncItem::WIDTH_LEVEL)
|
||||||
|
|
||||||
|
mBtnSync->setPopupMode(QToolButton::MenuButtonPopup);
|
||||||
|
mBtnSync->setMenu(m);
|
||||||
|
connect(mBtnSync, &QToolButton::clicked,[](){
|
||||||
|
SyncHelper::setSyncState((SyncState)((SyncHelper::getSyncState()+1)%3));
|
||||||
|
});
|
||||||
|
connect(EventsCenter::Default(), &EventsCenter::SyncStateChanged, this, &DefaultToolBar::syncStateChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::syncStateChanged() const {
|
||||||
|
switch (SyncHelper::getSyncState()) {
|
||||||
|
case AUTO_SYNC:
|
||||||
|
// mBtnSync->setIcon(mAutoIcon);
|
||||||
|
mActionSyncState->setText(QString(tr("CUR STATE: %1")).arg(SyncHelper::SyncStateName[AUTO_SYNC]));
|
||||||
|
for (int i = 0; i < SYNC_ITEM_NUM; i++) {
|
||||||
|
mSyncActions[i]->setDisabled(false);
|
||||||
|
}
|
||||||
|
mSyncActions[SLICE_POS]->setChecked(SyncHelper::getSyncItem(SLICE_POS));
|
||||||
|
mSyncActions[WIDTH_LEVEL]->setChecked(SyncHelper::getSyncItem(WIDTH_LEVEL));
|
||||||
|
mSyncActions[ZOOM_PAN]->setChecked(SyncHelper::getSyncItem(ZOOM_PAN));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MANUAL_SYNC:{
|
||||||
|
// mBtnSync->setIcon(mManualIcon);
|
||||||
|
mActionSyncState->setText(QString(tr("CUR STATE: %1")).arg(SyncHelper::SyncStateName[MANUAL_SYNC]));
|
||||||
|
mSyncActions[SLICE_POS]->setChecked(SyncHelper::getSyncItem(SLICE_POS));
|
||||||
|
mSyncActions[WIDTH_LEVEL]->setChecked(SyncHelper::getSyncItem(WIDTH_LEVEL));
|
||||||
|
mSyncActions[ZOOM_PAN]->setChecked(SyncHelper::getSyncItem(ZOOM_PAN));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DIS_SYNC:
|
||||||
|
// mBtnSync->setIcon(mDisIcon);
|
||||||
|
mActionSyncState->setText(QString(tr("CUR STATE: %1")).arg(SyncHelper::SyncStateName[DIS_SYNC]));
|
||||||
|
for (int i = 0; i < SYNC_ITEM_NUM; i++) {
|
||||||
|
mSyncActions[i]->setChecked(false);
|
||||||
|
mSyncActions[i]->setDisabled(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::SetupModeTool() {
|
||||||
|
mBtnWindow->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
|
mBtnWindow->setToolTip(QString("Adjust window level"));
|
||||||
|
connect(mBtnWindow, &QToolButton::clicked, this, [&] {
|
||||||
|
emit modeChanged(7);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Menu
|
||||||
|
QMenu *m = new QMenu(this);
|
||||||
|
m->addAction(tr("Custom Window"), this, &DefaultToolBar::customWindow);
|
||||||
|
|
||||||
|
auto action = m->addAction(tr("Negative"), this, &DefaultToolBar::negativeWindow);
|
||||||
|
action->setCheckable(true);
|
||||||
|
action->setChecked(false);
|
||||||
|
|
||||||
|
mBtnWindow->setPopupMode(QToolButton::MenuButtonPopup);
|
||||||
|
mBtnWindow->setMenu(m);
|
||||||
|
|
||||||
|
mBtnPan->setToolTip(QString("Pan image"));
|
||||||
|
connect(mBtnPan, &QToolButton::clicked, this, [&] {
|
||||||
|
emit modeChanged(5);
|
||||||
|
});
|
||||||
|
|
||||||
|
mBtnZoom->setToolTip(QString("Zoom image"));
|
||||||
|
connect(mBtnZoom, &QToolButton::clicked, this, [&] {
|
||||||
|
emit modeChanged(6);
|
||||||
|
});
|
||||||
|
|
||||||
|
mBtnSlice->setToolTip(QString("Browse series"));
|
||||||
|
connect(mBtnSlice, &QToolButton::clicked, this, [&] {
|
||||||
|
emit modeChanged(4);
|
||||||
|
});
|
||||||
|
|
||||||
|
SetupMeasureTool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::SetupAnnoTool() {
|
||||||
|
mBtnAnonymize->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
|
|
||||||
|
//主要设置了四角标签的操作逻辑
|
||||||
|
mBtnAnonymize->setToolTip(QString("Toggle annotations"));
|
||||||
|
//视窗操作,显隐脚注
|
||||||
|
|
||||||
|
// connect(mBtnAnonymize, &QToolButton::clicked, this, [=] {
|
||||||
|
// AnnoHelper::toggleAnno();
|
||||||
|
// ui->viewContainer->getViewManager()->updateCornerInfoAll();
|
||||||
|
// });
|
||||||
|
|
||||||
|
//视窗操作,显隐测量
|
||||||
|
QMenu *m;
|
||||||
|
m = new QMenu(this);
|
||||||
|
// connect(m, &QMenu::triggered, this, [=] {
|
||||||
|
// //load data
|
||||||
|
// mActionHideMeasure->setChecked(Measure::GetHidden());
|
||||||
|
// });
|
||||||
|
//视窗操作,显隐测量
|
||||||
|
mActionHideMeasure = m->addAction(tr("Hide all measurements"), this, [=](bool value) {
|
||||||
|
Measure::SetHidden(!mActionHideMeasure->isChecked());
|
||||||
|
// ui->viewContainer->getViewManager()->renderAll();
|
||||||
|
});
|
||||||
|
mActionHideMeasure->setCheckable(true);
|
||||||
|
mActionHideMeasure->setChecked(false);
|
||||||
|
|
||||||
|
m->addSeparator();
|
||||||
|
|
||||||
|
//视窗操作,匿名化
|
||||||
|
mActionHidePatData = m->addAction(tr("Hide patient data"), this, [=] {
|
||||||
|
if (mActionHidePatData->isChecked()) {
|
||||||
|
AnnoHelper::PrivacyOn();
|
||||||
|
} else {
|
||||||
|
AnnoHelper::PrivacyOff();
|
||||||
|
}
|
||||||
|
// ui->viewContainer->getViewManager()->updateCornerInfoPrivacy();
|
||||||
|
});
|
||||||
|
mActionHidePatData->setCheckable(true);
|
||||||
|
mActionHidePatData->setChecked(false);
|
||||||
|
|
||||||
|
m->addAction(tr("Show Dicom tags"), this, &DefaultToolBar::showMeta);
|
||||||
|
|
||||||
|
mBtnAnonymize->setPopupMode(QToolButton::MenuButtonPopup);
|
||||||
|
mBtnAnonymize->setMenu(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::SetupMeasureTool() {
|
||||||
|
#define ADD_MEASURE_ACTION(index)\
|
||||||
|
m->addAction(tr(std::get<0>(MEASURE_ACTIIONS[index])), this, [=] {\
|
||||||
|
mBtnMeasure->setChecked(true);\
|
||||||
|
QPixmap map(std::get<1>(MEASURE_ACTIIONS[index]));\
|
||||||
|
mBtnMeasure->setIcon(QIcon(map));\
|
||||||
|
})
|
||||||
|
// MeasureHelper::setMeasureType(std::get<2>(MEASURE_ACTIIONS[index]));\
|
||||||
|
// ui->viewContainer->getViewManager()->activeMeasure();\
|
||||||
|
|
||||||
|
|
||||||
|
#define ADD_DEL_ACTION(text, type, func)\
|
||||||
|
m->addAction(tr(text));
|
||||||
|
|
||||||
|
mBtnMeasure->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
|
mBtnMeasure->setToolTip(QString("Measurements"));
|
||||||
|
|
||||||
|
connect(mBtnMeasure, &QToolButton::clicked, this, &DefaultToolBar::activeMeasure);
|
||||||
|
|
||||||
|
QMenu *m;
|
||||||
|
m = new QMenu(this);
|
||||||
|
|
||||||
|
for (int j = 0; j < ACTION_COUNT; ++j) {
|
||||||
|
ADD_MEASURE_ACTION(j);
|
||||||
|
}
|
||||||
|
m->addSeparator();
|
||||||
|
ADD_DEL_ACTION("Delete selected", AnnotationActorType::DeleteSelectedAnn, deleteSelectedMeasure);
|
||||||
|
ADD_DEL_ACTION("Delete all in current slice", AnnotationActorType::DeleteSliceAnn, deleteCurrentSliceMeasure);
|
||||||
|
ADD_DEL_ACTION("Delete all in current series", AnnotationActorType::DeleteSeriesAnn, deleteCurrentSeriesMeasure);
|
||||||
|
mBtnMeasure->setPopupMode(QToolButton::MenuButtonPopup);
|
||||||
|
mBtnMeasure->setMenu(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::SetupFusionTool() {
|
||||||
|
mBtnFusion->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
|
mBtnFusion->setToolTip(QString("Fusion"));
|
||||||
|
connect(mBtnFusion, &QToolButton::clicked, this, &DefaultToolBar::fusion);
|
||||||
|
mBtnFusion->setCheckable(true);
|
||||||
|
QMenu *m = new QMenu(this);
|
||||||
|
m->addAction(tr("Reset Fusion"), [=](){
|
||||||
|
mBtnFusion->setChecked(false);
|
||||||
|
emit fusion(false);
|
||||||
|
});
|
||||||
|
mBtnFusion->setPopupMode(QToolButton::MenuButtonPopup);
|
||||||
|
mBtnFusion->setMenu(m);
|
||||||
|
mBtnFusion->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::SetupCineTool() {
|
||||||
|
mBtnCine->setToolTip(QString("Cine"));
|
||||||
|
mBtnCine->setCheckable(true);
|
||||||
|
connect(mBtnCine, &QToolButton::clicked, this, &DefaultToolBar::cine);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::SetupEmptyTool() {
|
||||||
|
mBtnClear->setToolTip(QString("Delete current series"));
|
||||||
|
connect(mBtnClear, &QToolButton::clicked, this, &DefaultToolBar::clear);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::SetupTransformTool() {
|
||||||
|
mBtnFlip->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
|
mBtnFlip->setToolTip(QString("Transformations"));
|
||||||
|
QMenu *m = new QMenu(this);
|
||||||
|
|
||||||
|
#define ADD_TRANSFORM_ACTION(text,type)\
|
||||||
|
m->addAction(tr(text), this, [&] {\
|
||||||
|
emit transform(type);\
|
||||||
|
});
|
||||||
|
|
||||||
|
ADD_TRANSFORM_ACTION("Rotate 90 CCW",ROTATE_90_CCW);
|
||||||
|
ADD_TRANSFORM_ACTION("Rotate 90 CW", ROTATE_90_CW);
|
||||||
|
ADD_TRANSFORM_ACTION("Rotate 180",ROTATE_180);
|
||||||
|
m->addSeparator();
|
||||||
|
ADD_TRANSFORM_ACTION("Flip horizontal",H_FLIP);
|
||||||
|
ADD_TRANSFORM_ACTION("Flip vertical",V_FLIP);
|
||||||
|
m->addSeparator();
|
||||||
|
ADD_TRANSFORM_ACTION("Clear transformations",CLEAR);
|
||||||
|
mBtnFlip->setPopupMode(QToolButton::MenuButtonPopup);
|
||||||
|
mBtnFlip->setMenu(m);
|
||||||
|
connect(mBtnFlip, &QPushButton::clicked, this,[=](){
|
||||||
|
emit transform(H_FLIP);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void DefaultToolBar::SetupScreenTool() {
|
||||||
|
mBtnFullScreen->setToolTip(QString("Full screen"));
|
||||||
|
connect(mBtnFullScreen, &QToolButton::clicked, this, [=] {
|
||||||
|
mActionFullScreen->setVisible(false);
|
||||||
|
mActionMinimize->setVisible(true);
|
||||||
|
mActionMaximize->setVisible(true);
|
||||||
|
mActionClose->setVisible(true);
|
||||||
|
|
||||||
|
emit parentWindowStateChange(Qt::WindowState::WindowFullScreen);
|
||||||
|
});
|
||||||
|
|
||||||
|
mBtnMaximize->setToolTip(QString("Exit full screen mode"));
|
||||||
|
connect(mBtnMaximize, &QToolButton::clicked, this, [=] {
|
||||||
|
mActionFullScreen->setVisible(true);
|
||||||
|
mActionMinimize->setVisible(false);
|
||||||
|
mActionMaximize->setVisible(false);
|
||||||
|
mActionClose->setVisible(false);
|
||||||
|
|
||||||
|
emit parentWindowStateChange(Qt::WindowState::WindowMaximized);
|
||||||
|
});
|
||||||
|
|
||||||
|
mBtnMinimize->setToolTip(QString("Minimize"));
|
||||||
|
connect(mBtnMinimize, &QToolButton::clicked, this, [=] {
|
||||||
|
emit parentWindowStateChange(Qt::WindowState::WindowMinimized);
|
||||||
|
});
|
||||||
|
|
||||||
|
mBtnClose->setToolTip(QString("Close"));
|
||||||
|
connect(mBtnClose, &QToolButton::clicked, this, &DefaultToolBar::parentWindowClose);
|
||||||
|
}
|
||||||
92
src/src/UI/Widget/ToolBar/DefaultToolBar.h
Normal file
92
src/src/UI/Widget/ToolBar/DefaultToolBar.h
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/8/1.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef OMEGAV_DEFAULTTOOLBAR_H
|
||||||
|
#define OMEGAV_DEFAULTTOOLBAR_H
|
||||||
|
|
||||||
|
#include <QToolBar>
|
||||||
|
#include "Common/QGlobals.h"
|
||||||
|
|
||||||
|
class QButtonGroup;
|
||||||
|
|
||||||
|
class DefaultToolBar : public QToolBar {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit DefaultToolBar(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
~DefaultToolBar();
|
||||||
|
signals:
|
||||||
|
void openFile();
|
||||||
|
void openFolder();
|
||||||
|
void import();
|
||||||
|
void save();
|
||||||
|
void showGrid(QToolButton* btn);
|
||||||
|
void modeChanged(int mode);
|
||||||
|
void customWindow();
|
||||||
|
void negativeWindow();
|
||||||
|
void fusion(bool on = false);
|
||||||
|
void cine(bool on = false);
|
||||||
|
void activeMeasure();
|
||||||
|
void clear();
|
||||||
|
void parentWindowStateChange(Qt::WindowState state);
|
||||||
|
void parentWindowClose();
|
||||||
|
void transform(TransFormType type);
|
||||||
|
void showMeta();
|
||||||
|
private:
|
||||||
|
QAction *initButton(QToolButton *button, const char *objectName);
|
||||||
|
|
||||||
|
void initGroupedButton(QToolButton *button, const char *objectName, QButtonGroup *group);
|
||||||
|
|
||||||
|
void initButtons();
|
||||||
|
void syncStateChanged() const;
|
||||||
|
|
||||||
|
void SetupFileTool();
|
||||||
|
void SetupImportTool();
|
||||||
|
void SetupExportTool();
|
||||||
|
void SetupGridTool();
|
||||||
|
void SetupSyncTool();
|
||||||
|
void SetupModeTool();
|
||||||
|
void SetupAnnoTool();
|
||||||
|
void SetupMeasureTool();
|
||||||
|
void SetupFusionTool();
|
||||||
|
void SetupCineTool();
|
||||||
|
void SetupEmptyTool();
|
||||||
|
void SetupTransformTool();
|
||||||
|
void SetupScreenTool();
|
||||||
|
|
||||||
|
QIcon mManualIcon;
|
||||||
|
QIcon mAutoIcon;
|
||||||
|
QIcon mDisIcon;
|
||||||
|
QToolButton *mBtnFile;
|
||||||
|
QToolButton *mBtnImport;
|
||||||
|
QToolButton *mBtnSave;
|
||||||
|
QToolButton *mBtnGrid;
|
||||||
|
QToolButton *mBtnSync;
|
||||||
|
QToolButton *mBtnAnonymize;
|
||||||
|
QToolButton *mBtnSlice;
|
||||||
|
QToolButton *mBtnWindow;
|
||||||
|
QToolButton *mBtnPan;
|
||||||
|
QToolButton *mBtnZoom;
|
||||||
|
QToolButton *mBtnMeasure;
|
||||||
|
QToolButton *mBtnClear;
|
||||||
|
QToolButton *mBtnFlip;
|
||||||
|
QToolButton *mBtnCine;
|
||||||
|
QToolButton *mBtnFusion;
|
||||||
|
QToolButton *mBtnMPR;
|
||||||
|
QToolButton *mBtnMinimize;
|
||||||
|
QToolButton *mBtnMaximize;
|
||||||
|
QToolButton *mBtnClose;
|
||||||
|
QToolButton *mBtnFullScreen;
|
||||||
|
QAction *mActionMinimize;
|
||||||
|
QAction *mActionMaximize;
|
||||||
|
QAction *mActionClose;
|
||||||
|
QAction *mActionFullScreen;
|
||||||
|
QAction *mActionSyncState;
|
||||||
|
QAction *mActionHideMeasure;
|
||||||
|
QAction *mActionHidePatData;
|
||||||
|
QAction* mSyncActions[3]={nullptr,nullptr,nullptr};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //OMEGAV_DEFAULTTOOLBAR_H
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "QDicomViewer.h"
|
#include "QDicomViewer.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -9,9 +9,12 @@
|
|||||||
|
|
||||||
#include "Interaction/ActorDraggableInteractorStyle.h"
|
#include "Interaction/ActorDraggableInteractorStyle.h"
|
||||||
#include "UI/Manager/ImageViewManager.h"
|
#include "UI/Manager/ImageViewManager.h"
|
||||||
|
#include "UI/Widget/ToolBar/DefaultToolBar.h"
|
||||||
#include "UI/Widget/Component/gridpopwidget.h"
|
#include "UI/Widget/Component/gridpopwidget.h"
|
||||||
#include "UI/Widget/cine/pqVCRToolbar.h"
|
#include "UI/Widget/cine/pqVCRToolbar.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QDicomViewer::QDicomViewer(QWidget *parent) : QMainWindow(parent),
|
QDicomViewer::QDicomViewer(QWidget *parent) : QMainWindow(parent),
|
||||||
ui(new Ui::QDicomViewerClass),
|
ui(new Ui::QDicomViewerClass),
|
||||||
m_import(nullptr) {
|
m_import(nullptr) {
|
||||||
@@ -19,11 +22,6 @@ QDicomViewer::QDicomViewer(QWidget *parent) : QMainWindow(parent),
|
|||||||
this->statusBar()->showMessage(tr("Ready"));
|
this->statusBar()->showMessage(tr("Ready"));
|
||||||
QWidget::setWindowTitle(Project_NAME);
|
QWidget::setWindowTitle(Project_NAME);
|
||||||
|
|
||||||
//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();
|
this->Initial();
|
||||||
|
|
||||||
loadStyleSheet("Combinear");
|
loadStyleSheet("Combinear");
|
||||||
@@ -48,8 +46,16 @@ QDicomViewer::~QDicomViewer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void QDicomViewer::Initial() {
|
void QDicomViewer::Initial() {
|
||||||
this->createToolButton();
|
SetupFileTool();
|
||||||
this->SetupConnections();
|
SetupImportTool();
|
||||||
|
SetupExportTool();
|
||||||
|
SetupGridTool();
|
||||||
|
SetupSyncTool();
|
||||||
|
SetupTransformTool();
|
||||||
|
SetupEmptyTool();
|
||||||
|
SetupScreenTool();
|
||||||
|
// this->createToolButton();
|
||||||
|
// this->SetupConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDicomViewer::loadStyleSheet(const QString &sheetName) {
|
void QDicomViewer::loadStyleSheet(const QString &sheetName) {
|
||||||
@@ -63,130 +69,39 @@ void QDicomViewer::loadStyleSheet(const QString &sheetName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void QDicomViewer::createToolButton() {
|
void QDicomViewer::createToolButton() {
|
||||||
#define addbutton(name, png)\
|
|
||||||
QToolButton* btn##name = new QToolButton(this);\
|
|
||||||
{\
|
|
||||||
QPixmap map(png);\
|
|
||||||
btn##name->setIcon(QIcon(map));\
|
|
||||||
btn##name->setMinimumSize(QSize(48, 48));\
|
|
||||||
btn##name->setMaximumSize(QSize(48, 48));\
|
|
||||||
btn##name->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);\
|
|
||||||
this->ui->toolBar->addWidget(btn##name);\
|
|
||||||
}
|
|
||||||
|
|
||||||
#define addGroupedButton(name, png, group)\
|
this->SetupFileTool();
|
||||||
QToolButton* btn##name = new QToolButton(this);\
|
this->SetupImportTool();
|
||||||
{\
|
this->SetupExportTool();
|
||||||
QPixmap map(png);\
|
|
||||||
btn##name->setIcon(QIcon(map));\
|
|
||||||
btn##name->setCheckable(true);\
|
|
||||||
btn##name->setAutoExclusive(true);\
|
|
||||||
btn##name->setMinimumSize(QSize(48, 48));\
|
|
||||||
btn##name->setMaximumSize(QSize(48, 48));\
|
|
||||||
btn##name->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);\
|
|
||||||
group->addButton(btn##name);\
|
|
||||||
this->ui->toolBar->addWidget(btn##name);\
|
|
||||||
}
|
|
||||||
|
|
||||||
#define addbutton2(name, png)\
|
this->SetupGridTool();
|
||||||
QToolButton* btn##name = new QToolButton(this);\
|
this->SetupSyncTool();
|
||||||
{\
|
this->SetupAnnoTool();
|
||||||
QPixmap map(png);\
|
|
||||||
btn##name->setIcon(QIcon(map));\
|
|
||||||
btn##name->setMinimumSize(QSize(25, 25));\
|
|
||||||
btn##name->setMaximumSize(QSize(25, 25));\
|
|
||||||
this->ui->toolBar->addWidget(btn##name); \
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->toolBar->setContextMenuPolicy(Qt::ContextMenuPolicy::PreventContextMenu);
|
this->SetupAdjustTool();
|
||||||
ui->toolBar->setFixedHeight(VCRHelper::toolbar_Height);
|
this->SetupMeasureTool();
|
||||||
ui->toolBar->setMovable(false);
|
this->SetupEmptyTool();
|
||||||
ui->toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
|
||||||
|
|
||||||
addbutton(file, ":/InfiniteViewer/Icon/openfile.png")
|
this->SetupTransformTool();
|
||||||
addbutton(import, ":/InfiniteViewer/Icon/import.png")
|
this->SetupFusionTool();
|
||||||
addbutton(save, ":/InfiniteViewer/Icon/save.png")
|
this->SetupCineTool();
|
||||||
this->ui->toolBar->addSeparator();
|
|
||||||
|
|
||||||
addbutton(grid, ":/InfiniteViewer/Icon/grid.png")
|
|
||||||
addbutton(sync, ":/InfiniteViewer/Icon/sync/sync_dis.png")
|
|
||||||
addbutton(anno, ":/InfiniteViewer/Icon/anno.png")
|
|
||||||
this->ui->toolBar->addSeparator();
|
|
||||||
|
|
||||||
QButtonGroup *modegroup = new QButtonGroup(this);
|
|
||||||
addGroupedButton(slice, ":/InfiniteViewer/Icon/slice.png", modegroup)
|
|
||||||
addGroupedButton(windowlevel, ":/InfiniteViewer/Icon/windowlevel.png", modegroup)
|
|
||||||
addGroupedButton(pan, ":/InfiniteViewer/Icon/pan.png", modegroup)
|
|
||||||
addGroupedButton(zoom, ":/InfiniteViewer/Icon/zoom.png", modegroup)
|
|
||||||
addGroupedButton(measure, ":/InfiniteViewer/Icon/distance.png", modegroup)
|
|
||||||
addbutton(empty, ":/InfiniteViewer/Icon/trashbin.png")
|
|
||||||
this->ui->toolBar->addSeparator();
|
|
||||||
|
|
||||||
|
|
||||||
addbutton(flip, ":/InfiniteViewer/Icon/flip.png")
|
// connect(btnMPR, &QToolButton::clicked, [=](){
|
||||||
addbutton(cine, ":/InfiniteViewer/Icon/cine.png")
|
// SyncHelper::setSyncState(DIS_SYNC);
|
||||||
addbutton(fusion, ":/InfiniteViewer/Icon/fusion.png")
|
// syncStateChanged();
|
||||||
addbutton(MPR, ":/InfiniteViewer/Icon/MPR.png")
|
// ui->viewContainer->getViewManager()->switchSliceOrientation();
|
||||||
|
// });
|
||||||
QWidget *spacer = new QWidget(this);
|
// btnMPR->setEnabled(false);
|
||||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
// mprBtn = btnMPR;
|
||||||
this->ui->toolBar->addWidget(spacer);
|
// fusionBtn = btnfusion;
|
||||||
|
// connect(ui->viewContainer->getViewManager(),
|
||||||
act_num_of_minimize = ui->toolBar->actions().count();
|
// &ImageViewManager::currentViewReload,[=](){
|
||||||
addbutton2(minimize, ":/InfiniteViewer/Icon/minimize.png")
|
// btnfusion->setEnabled(false);
|
||||||
|
// btnMPR->setEnabled(false);
|
||||||
act_num_of_maximize = ui->toolBar->actions().count();
|
// SyncHelper::setSyncState(DIS_SYNC);
|
||||||
addbutton2(maximize, ":/InfiniteViewer/Icon/maximize-restore.png")
|
// syncStateChanged();
|
||||||
|
// });
|
||||||
act_num_of_close = ui->toolBar->actions().count();
|
|
||||||
addbutton2(close, ":/InfiniteViewer/Icon/close.png")
|
|
||||||
|
|
||||||
act_num_of_fullscreen = ui->toolBar->actions().count();
|
|
||||||
addbutton2(fullscreen, ":/InfiniteViewer/Icon/full_screen.png")
|
|
||||||
|
|
||||||
ui->toolBar->actions().at(act_num_of_minimize)->setVisible(false);
|
|
||||||
ui->toolBar->actions().at(act_num_of_maximize)->setVisible(false);
|
|
||||||
ui->toolBar->actions().at(act_num_of_close)->setVisible(false);
|
|
||||||
|
|
||||||
this->SetupFileTool(btnfile);
|
|
||||||
this->SetupImportTool(btnimport);
|
|
||||||
this->SetupExportTool(btnsave);
|
|
||||||
|
|
||||||
this->SetupGridTool(btngrid);
|
|
||||||
this->SetupSyncTool(btnsync);
|
|
||||||
this->SetupAnnoTool(btnanno);
|
|
||||||
|
|
||||||
this->SetupSliceTool(btnslice);
|
|
||||||
this->SetupAdjustTool(btnwindowlevel);
|
|
||||||
this->SetupPanTool(btnpan);
|
|
||||||
this->SetupZoomTool(btnzoom);
|
|
||||||
this->SetupMeasureTool(btnmeasure);
|
|
||||||
this->SetupEmptyTool(btnempty);
|
|
||||||
|
|
||||||
this->SetupFlipTool(btnflip);
|
|
||||||
this->SetupFusionTool(btnfusion);
|
|
||||||
this->SetupCineTool(btncine);
|
|
||||||
|
|
||||||
this->SetupFullScreenTool(btnfullscreen);
|
|
||||||
this->SetupMaximizeTool(btnmaximize);
|
|
||||||
this->SetupMinimizeTool(btnminimize);
|
|
||||||
this->SetupCloseTool(btnclose);
|
|
||||||
|
|
||||||
connect(btnMPR, &QToolButton::clicked, [=](){
|
|
||||||
SyncHelper::setSyncState(DIS_SYNC);
|
|
||||||
syncStateChanged();
|
|
||||||
ui->viewContainer->getViewManager()->switchSliceOrientation();
|
|
||||||
});
|
|
||||||
btnMPR->setEnabled(false);
|
|
||||||
mprBtn = btnMPR;
|
|
||||||
fusionBtn = btnfusion;
|
|
||||||
connect(ui->viewContainer->getViewManager(),
|
|
||||||
&ImageViewManager::currentViewReload,[=](){
|
|
||||||
btnfusion->setEnabled(false);
|
|
||||||
btnMPR->setEnabled(false);
|
|
||||||
SyncHelper::setSyncState(DIS_SYNC);
|
|
||||||
syncStateChanged();
|
|
||||||
});
|
|
||||||
|
|
||||||
worker.setManager(ui->viewContainer->getViewManager());
|
worker.setManager(ui->viewContainer->getViewManager());
|
||||||
connect(ui->viewContainer->getViewManager(),
|
connect(ui->viewContainer->getViewManager(),
|
||||||
@@ -197,111 +112,46 @@ void QDicomViewer::createToolButton() {
|
|||||||
workerManager.registerWorker(&worker);
|
workerManager.registerWorker(&worker);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDicomViewer::SetupFullScreenTool(QToolButton *btnfullscreen) {
|
void QDicomViewer::SetupScreenTool() {
|
||||||
btnfullscreen->setToolTip(QString("Full screen"));
|
connect(ui->toolBar,&DefaultToolBar::parentWindowStateChange,this,&QDicomViewer::setWindowState);
|
||||||
connect(btnfullscreen, &QToolButton::clicked, this, [=] {
|
connect(ui->toolBar,&DefaultToolBar::parentWindowClose, this, &QWidget::close);
|
||||||
ui->toolBar->actions().at(act_num_of_fullscreen)->setVisible(false);
|
|
||||||
ui->toolBar->actions().at(act_num_of_minimize)->setVisible(true);
|
|
||||||
ui->toolBar->actions().at(act_num_of_maximize)->setVisible(true);
|
|
||||||
ui->toolBar->actions().at(act_num_of_close)->setVisible(true);
|
|
||||||
|
|
||||||
setWindowState(Qt::WindowState::WindowFullScreen);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDicomViewer::SetupMaximizeTool(QToolButton *btnmaximize) {
|
void QDicomViewer::SetupAnnoTool() {
|
||||||
btnmaximize->setToolTip(QString("Exit full screen mode"));
|
// connect(annoBtn, &QToolButton::clicked, this, [=] {
|
||||||
connect(btnmaximize, &QToolButton::clicked, this, [=] {
|
// AnnoHelper::toggleAnno();
|
||||||
|
// ui->viewContainer->getViewManager()->updateCornerInfoAll();
|
||||||
|
// });
|
||||||
|
|
||||||
ui->toolBar->actions().at(act_num_of_minimize)->setVisible(false);
|
// //视窗操作,显隐测量
|
||||||
ui->toolBar->actions().at(act_num_of_maximize)->setVisible(false);
|
// m_measure_hidden_action = m->addAction(tr("Hide all measurements"), this, [=](bool value) {
|
||||||
ui->toolBar->actions().at(act_num_of_close)->setVisible(false);
|
// Measure::SetHidden(value);
|
||||||
ui->toolBar->actions().at(act_num_of_fullscreen)->setVisible(true);
|
// ui->viewContainer->getViewManager()->renderAll();
|
||||||
|
// });
|
||||||
|
|
||||||
setWindowState(Qt::WindowState::WindowMaximized);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void QDicomViewer::SetupMinimizeTool(QToolButton *btnminimize) {
|
|
||||||
btnminimize->setToolTip(QString("Minimize"));
|
|
||||||
connect(btnminimize, &QToolButton::clicked, this, [=] {
|
|
||||||
setWindowState(Qt::WindowState::WindowMinimized);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void QDicomViewer::SetupCloseTool(QToolButton *btnclose) {
|
|
||||||
btnclose->setToolTip(QString("Close"));
|
|
||||||
connect(btnclose, &QToolButton::clicked, this, &QWidget::close);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QDicomViewer::SetupAnnoTool(QToolButton *annoBtn) {
|
|
||||||
//主要设置了四角标签的操作逻辑
|
|
||||||
annoBtn->setToolTip(QString("Toggle annotations"));
|
|
||||||
//视窗操作,显隐脚注
|
|
||||||
|
|
||||||
connect(annoBtn, &QToolButton::clicked, this, [=] {
|
|
||||||
AnnoHelper::toggleAnno();
|
|
||||||
ui->viewContainer->getViewManager()->updateCornerInfoAll();
|
|
||||||
});
|
|
||||||
|
|
||||||
//视窗操作,显隐测量
|
|
||||||
QMenu *m;
|
|
||||||
m = new QMenu(this);
|
|
||||||
connect(m, &QMenu::triggered, this, [=] {
|
|
||||||
//load data
|
|
||||||
m_measure_hidden_action->setChecked(Measure::GetHidden());
|
|
||||||
});
|
|
||||||
//视窗操作,显隐测量
|
|
||||||
m_measure_hidden_action = m->addAction(tr("Hide all measurements"), this, [=](bool value) {
|
|
||||||
Measure::SetHidden(value);
|
|
||||||
ui->viewContainer->getViewManager()->renderAll();
|
|
||||||
});
|
|
||||||
|
|
||||||
m->addSeparator();
|
|
||||||
|
|
||||||
//视窗操作,匿名化
|
//视窗操作,匿名化
|
||||||
m_patient_hidden_action = m->addAction(tr("Hide patient data"), this, [=] {
|
// m_patient_hidden_action = m->addAction(tr("Hide patient data"), this, [=] {
|
||||||
if (m_patient_hidden_action->isChecked()) {
|
// if (m_patient_hidden_action->isChecked()) {
|
||||||
AnnoHelper::PrivacyOn();
|
// AnnoHelper::PrivacyOn();
|
||||||
} else {
|
// } else {
|
||||||
AnnoHelper::PrivacyOff();
|
// AnnoHelper::PrivacyOff();
|
||||||
}
|
// }
|
||||||
ui->viewContainer->getViewManager()->updateCornerInfoPrivacy();
|
// ui->viewContainer->getViewManager()->updateCornerInfoPrivacy();
|
||||||
});
|
// });
|
||||||
m_patient_hidden_action->setCheckable(true);
|
// m_patient_hidden_action->setCheckable(true);
|
||||||
m_patient_hidden_action->setChecked(false);
|
// m_patient_hidden_action->setChecked(false);
|
||||||
|
|
||||||
m->addAction(tr("Show Dicom tags"), this, [&] {
|
connect(ui->toolBar,&DefaultToolBar::showMeta, this, [&] {
|
||||||
DicomImageView *curV = ui->viewContainer->getCurrentView();
|
DicomImageView *curV = ui->viewContainer->getCurrentView();
|
||||||
if (curV->hasSeries()) {
|
if (curV->hasSeries()) {
|
||||||
curV->showMetaData();
|
curV->showMetaData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
m_measure_hidden_action->setCheckable(true);
|
|
||||||
m_measure_hidden_action->setChecked(false);
|
|
||||||
|
|
||||||
|
|
||||||
annoBtn->setPopupMode(QToolButton::MenuButtonPopup);
|
|
||||||
annoBtn->setMenu(m);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
const int ACTION_COUNT = 7;
|
|
||||||
const ActionProperty MEASURE_ACTIIONS[ACTION_COUNT] = {
|
|
||||||
{"Length", ":/InfiniteViewer/Icon/distance.png", AnnotationActorType::RulerAnn},
|
|
||||||
{"Angle", ":/InfiniteViewer/Icon/angle.png", AnnotationActorType::AngleAnn},
|
|
||||||
{"Closed polygon", ":/InfiniteViewer/Icon/polygon.png", AnnotationActorType::ClosedPolygonAnn},
|
|
||||||
{"Open polygon", ":/InfiniteViewer/Icon/polyline.png", AnnotationActorType::OpenPolygonAnn},
|
|
||||||
{"Arrow", ":/InfiniteViewer/Icon/arrow.png", AnnotationActorType::ArrowAnn},
|
|
||||||
{"Ellipse", ":/InfiniteViewer/Icon/ellipse.png", AnnotationActorType::EllipseAnn},
|
|
||||||
{"Text", ":/InfiniteViewer/Icon/text.png", AnnotationActorType::TextAnn}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//AnnotationActor执行相关
|
//AnnotationActor执行相关
|
||||||
void QDicomViewer::SetupMeasureTool(QToolButton *measureBtn) {
|
void QDicomViewer::SetupMeasureTool() {
|
||||||
#define ADD_MEASURE_ACTION(index)\
|
#define ADD_MEASURE_ACTION(index)\
|
||||||
m->addAction(tr(std::get<0>(MEASURE_ACTIIONS[index])), this, [=] {\
|
m->addAction(tr(std::get<0>(MEASURE_ACTIIONS[index])), this, [=] {\
|
||||||
measureBtn->setChecked(true);\
|
measureBtn->setChecked(true);\
|
||||||
@@ -321,23 +171,23 @@ void QDicomViewer::SetupMeasureTool(QToolButton *measureBtn) {
|
|||||||
curV->func();\
|
curV->func();\
|
||||||
}\
|
}\
|
||||||
})
|
})
|
||||||
|
// measureBtn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
measureBtn->setToolTip(QString("Measurements"));
|
// measureBtn->setToolTip(QString("Measurements"));
|
||||||
|
//
|
||||||
connect(measureBtn, &QToolButton::clicked, this, &QDicomViewer::executeActiveMeasure);
|
// connect(measureBtn, &QToolButton::clicked, this, &QDicomViewer::executeActiveMeasure);
|
||||||
|
//
|
||||||
QMenu *m;
|
// QMenu *m;
|
||||||
m = new QMenu(this);
|
// m = new QMenu(this);
|
||||||
|
//
|
||||||
for (int j = 0; j < ACTION_COUNT; ++j) {
|
// for (int j = 0; j < ACTION_COUNT; ++j) {
|
||||||
ADD_MEASURE_ACTION(j);
|
// ADD_MEASURE_ACTION(j);
|
||||||
}
|
// }
|
||||||
m->addSeparator();
|
// m->addSeparator();
|
||||||
ADD_DEL_ACTION("Delete selected", AnnotationActorType::DeleteSelectedAnn, deleteSelectedMeasure);
|
// ADD_DEL_ACTION("Delete selected", AnnotationActorType::DeleteSelectedAnn, deleteSelectedMeasure);
|
||||||
ADD_DEL_ACTION("Delete all in current slice", AnnotationActorType::DeleteSliceAnn, deleteCurrentSliceMeasure);
|
// ADD_DEL_ACTION("Delete all in current slice", AnnotationActorType::DeleteSliceAnn, deleteCurrentSliceMeasure);
|
||||||
ADD_DEL_ACTION("Delete all in current series", AnnotationActorType::DeleteSeriesAnn, deleteCurrentSeriesMeasure);
|
// ADD_DEL_ACTION("Delete all in current series", AnnotationActorType::DeleteSeriesAnn, deleteCurrentSeriesMeasure);
|
||||||
measureBtn->setPopupMode(QToolButton::MenuButtonPopup);
|
// measureBtn->setPopupMode(QToolButton::MenuButtonPopup);
|
||||||
measureBtn->setMenu(m);
|
// measureBtn->setMenu(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDicomViewer::executeActiveMeasure() {
|
void QDicomViewer::executeActiveMeasure() {
|
||||||
@@ -366,9 +216,8 @@ void QDicomViewer::executeActiveMeasure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//视窗操作,播放相关
|
//视窗操作,播放相关
|
||||||
void QDicomViewer::SetupCineTool(QToolButton *cineBtn) {
|
void QDicomViewer::SetupCineTool() {
|
||||||
cineBtn->setToolTip(QString("Cine"));
|
connect(ui->toolBar, &DefaultToolBar::cine, this, [&] {
|
||||||
connect(cineBtn, &QToolButton::clicked, this, [&] {
|
|
||||||
DicomImageView *curV = ui->viewContainer->getCurrentView();
|
DicomImageView *curV = ui->viewContainer->getCurrentView();
|
||||||
if (curV->hasSeries()) {
|
if (curV->hasSeries()) {
|
||||||
if (curV->IsCine()) {
|
if (curV->IsCine()) {
|
||||||
@@ -379,8 +228,6 @@ void QDicomViewer::SetupCineTool(QToolButton *cineBtn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDicomViewer::createVCRToolbar(DicomImageView *v) {
|
void QDicomViewer::createVCRToolbar(DicomImageView *v) {
|
||||||
@@ -395,51 +242,15 @@ void QDicomViewer::createVCRToolbar(DicomImageView *v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//视窗操作,fusion相关
|
//视窗操作,fusion相关
|
||||||
void QDicomViewer::SetupFusionTool(QToolButton *fusionBtn) {
|
void QDicomViewer::SetupFusionTool() {
|
||||||
fusionBtn->setToolTip(QString("Fusion"));
|
connect(ui->toolBar, &DefaultToolBar::fusion, ui->viewContainer->getViewManager(), &ImageViewManager::switchFusion);
|
||||||
connect(fusionBtn, &QToolButton::clicked, ui->viewContainer->getViewManager(), &ImageViewManager::switchFusion);
|
|
||||||
QMenu *m = new QMenu(this);
|
|
||||||
m->addAction(tr("Reset Fusion"), ui->viewContainer->getViewManager(), &ImageViewManager::unloadFusion);
|
|
||||||
fusionBtn->setPopupMode(QToolButton::MenuButtonPopup);
|
|
||||||
fusionBtn->setMenu(m);
|
|
||||||
fusionBtn->setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//视窗操作,slice
|
|
||||||
void QDicomViewer::SetupSliceTool(QToolButton *sliceBtn) {
|
|
||||||
sliceBtn->setToolTip(QString("Browse series"));
|
|
||||||
connect(sliceBtn, &QToolButton::clicked, this, [&] {
|
|
||||||
ui->viewContainer->getViewManager()->setInteractionMode(VTKIS_IMAGE_SLICING);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//视窗操作,pan
|
|
||||||
void QDicomViewer::SetupPanTool(QToolButton *panBtn) {
|
|
||||||
panBtn->setToolTip(QString("Pan image"));
|
|
||||||
connect(panBtn, &QToolButton::clicked, this, [&] {
|
|
||||||
ui->viewContainer->getViewManager()->setInteractionMode(VTKIS_IMAGE_PAN);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//视窗操作,zoom
|
|
||||||
void QDicomViewer::SetupZoomTool(QToolButton *zoomBtn) {
|
|
||||||
zoomBtn->setToolTip(QString("Zoom image"));
|
|
||||||
connect(zoomBtn, &QToolButton::clicked, this, [&] {
|
|
||||||
ui->viewContainer->getViewManager()->setInteractionMode(VTKIS_IMAGE_ZOOM);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//视窗操作,wwwl
|
//视窗操作,wwwl
|
||||||
void QDicomViewer::SetupAdjustTool(QToolButton *winlevelBtn) {
|
void QDicomViewer::SetupAdjustTool() {
|
||||||
winlevelBtn->setToolTip(QString("Adjust window level"));
|
connect(ui->toolBar, &DefaultToolBar::modeChanged, ui->viewContainer->getViewManager(), &ImageViewManager::setInteractionMode);
|
||||||
connect(winlevelBtn, &QToolButton::clicked, this, [&] {
|
|
||||||
ui->viewContainer->getViewManager()->setInteractionMode(VTKIS_IMAGE_WINDOWLEVEL);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Menu
|
connect(ui->toolBar, &DefaultToolBar::customWindow, [=]() {
|
||||||
QMenu *m = new QMenu(this);
|
|
||||||
m->addAction(tr("Custom Window"), this, [=](bool value) {
|
|
||||||
winlevelBtn->setChecked(true);
|
|
||||||
if (nullptr == m_customwin) {
|
if (nullptr == m_customwin) {
|
||||||
m_customwin = new Customwindow(this);
|
m_customwin = new Customwindow(this);
|
||||||
}
|
}
|
||||||
@@ -449,102 +260,62 @@ void QDicomViewer::SetupAdjustTool(QToolButton *winlevelBtn) {
|
|||||||
m_customwin->exec();
|
m_customwin->exec();
|
||||||
});
|
});
|
||||||
|
|
||||||
m->addAction(tr("Negative"), this, [=](bool value) {
|
connect(ui->toolBar, &DefaultToolBar::negativeWindow, [=]() {
|
||||||
winlevelBtn->setChecked(true);
|
|
||||||
DicomImageView *curV = ui->viewContainer->getViewManager()->getCurrentView();
|
DicomImageView *curV = ui->viewContainer->getViewManager()->getCurrentView();
|
||||||
if (curV != nullptr && curV->hasSeries()) {
|
if (curV != nullptr && curV->hasSeries()) {
|
||||||
curV->negativeWindow();
|
curV->negativeWindow();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
winlevelBtn->setPopupMode(QToolButton::MenuButtonPopup);
|
|
||||||
winlevelBtn->setMenu(m);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//视窗操作,clear
|
//视窗操作,clear
|
||||||
void QDicomViewer::SetupEmptyTool(QToolButton *emptyBtn) {
|
void QDicomViewer::SetupEmptyTool() {
|
||||||
emptyBtn->setToolTip(QString("Delete current series"));
|
connect(ui->toolBar, &DefaultToolBar::clear,
|
||||||
connect(emptyBtn, &QToolButton::clicked, ui->viewContainer->getCurrentView(), &DicomImageView::viewCleared);
|
ui->viewContainer->getViewManager(), &ImageViewManager::clearCurrentView);
|
||||||
}
|
}
|
||||||
|
|
||||||
//视窗操作,flip and rotation
|
//视窗操作,flip and rotation
|
||||||
void QDicomViewer::SetupFlipTool(QToolButton *flipBtn) {
|
void QDicomViewer::SetupTransformTool() {
|
||||||
flipBtn->setToolTip(QString("Transformations"));
|
connect(ui->toolBar, &DefaultToolBar::transform,[=](TransFormType type){
|
||||||
QMenu *m = new QMenu(this);
|
|
||||||
|
|
||||||
#define ADD_TRANSFORM_ACTION(text,func,...)\
|
|
||||||
m->addAction(tr(text), this, [&] {\
|
|
||||||
DicomImageView *curV = ui->viewContainer->getCurrentView();\
|
|
||||||
if (curV != nullptr && curV->hasSeries()) {\
|
|
||||||
curV->func(__VA_ARGS__);\
|
|
||||||
}\
|
|
||||||
})
|
|
||||||
|
|
||||||
ADD_TRANSFORM_ACTION("Rotate 90 CCW",rotateImage,90, ROTATE_90_CCW);
|
|
||||||
ADD_TRANSFORM_ACTION("Rotate 90 CW",rotateImage,-90, ROTATE_90_CW);
|
|
||||||
ADD_TRANSFORM_ACTION("Rotate 180",rotateImage,180, ROTATE_180);
|
|
||||||
m->addSeparator();
|
|
||||||
ADD_TRANSFORM_ACTION("Flip horizontal",hFlipImage);
|
|
||||||
ADD_TRANSFORM_ACTION("Flip vertical",vFlipImage);
|
|
||||||
m->addSeparator();
|
|
||||||
ADD_TRANSFORM_ACTION("Clear transformations",ClearTransformations);
|
|
||||||
flipBtn->setPopupMode(QToolButton::MenuButtonPopup);
|
|
||||||
flipBtn->setMenu(m);
|
|
||||||
connect(flipBtn, &QPushButton::clicked, this, [&] {
|
|
||||||
DicomImageView *curV = ui->viewContainer->getCurrentView();
|
DicomImageView *curV = ui->viewContainer->getCurrentView();
|
||||||
if (curV != nullptr && curV->hasSeries()) {
|
if (curV != nullptr && curV->hasSeries()) {
|
||||||
curV->rotateImage(90, ROTATE_90_CCW);
|
switch (type){
|
||||||
|
case ROTATE_90_CCW:
|
||||||
|
curV->rotateImage(90,ROTATE_90_CCW);
|
||||||
|
break;
|
||||||
|
case ROTATE_90_CW:
|
||||||
|
curV->rotateImage(-90,ROTATE_90_CW);
|
||||||
|
break;
|
||||||
|
case ROTATE_180:
|
||||||
|
curV->rotateImage(180,ROTATE_180);
|
||||||
|
break;
|
||||||
|
case H_FLIP:
|
||||||
|
curV->hFlipImage();
|
||||||
|
break;
|
||||||
|
case V_FLIP:
|
||||||
|
curV->vFlipImage();
|
||||||
|
break;
|
||||||
|
case CLEAR:
|
||||||
|
curV->ClearTransformations();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//视窗操作,sync mode
|
//视窗操作,sync mode
|
||||||
void QDicomViewer::SetupSyncTool(QToolButton *btn) {
|
void QDicomViewer::SetupSyncTool() {
|
||||||
syncBtn = btn;
|
|
||||||
syncBtn->setToolTip(QString("Toggle series synchronization"));
|
|
||||||
// Menu
|
|
||||||
QMenu * m = new QMenu(this);
|
|
||||||
|
|
||||||
//QAction *a;
|
|
||||||
SyncState curst = SyncHelper::getSyncState();
|
|
||||||
m_sync_state_action = m->addAction(QString(tr("CUR STATE: %1")).arg(SyncHelper::SyncStateName[curst]), this,
|
|
||||||
[&](bool value) {
|
|
||||||
});
|
|
||||||
m_sync_state_action->setCheckable(false);
|
|
||||||
|
|
||||||
this->ui->toolBar->addSeparator();
|
|
||||||
|
|
||||||
#define ADD_SYNC_ITEM(index,text,type)\
|
|
||||||
m_sync_item_action[index] = m->addAction(tr(text), this, [&](bool value) {\
|
|
||||||
SyncHelper::setSyncItem(type, value);\
|
|
||||||
});\
|
|
||||||
m_sync_item_action[index]->setCheckable(true);\
|
|
||||||
m_sync_item_action[index]->setChecked(false);\
|
|
||||||
m_sync_item_action[index]->setDisabled(true);
|
|
||||||
|
|
||||||
ADD_SYNC_ITEM(0,"Sychronize slice position",SyncItem::SLICE_POS)
|
|
||||||
ADD_SYNC_ITEM(1,"Sychronize zoom & pan",SyncItem::ZOOM_PAN)
|
|
||||||
ADD_SYNC_ITEM(2,"Sychronize window level & width",SyncItem::WIDTH_LEVEL)
|
|
||||||
|
|
||||||
syncBtn->setPopupMode(QToolButton::MenuButtonPopup);
|
|
||||||
syncBtn->setMenu(m);
|
|
||||||
|
|
||||||
//loop click
|
|
||||||
connect(syncBtn, &QToolButton::clicked, this,
|
|
||||||
&QDicomViewer::switchSyncState);
|
|
||||||
connect(EventsCenter::Default(), &EventsCenter::SyncStateChanged, this, &QDicomViewer::syncStateChanged);
|
connect(EventsCenter::Default(), &EventsCenter::SyncStateChanged, this, &QDicomViewer::syncStateChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDicomViewer::switchSyncState(){
|
|
||||||
SyncHelper::setSyncState((SyncState)((SyncHelper::getSyncState()+1)%3));
|
|
||||||
}
|
|
||||||
|
|
||||||
void QDicomViewer::syncStateChanged() const {
|
void QDicomViewer::syncStateChanged() const {
|
||||||
if (!syncBtn) return;
|
if (!syncBtn) return;
|
||||||
switch (SyncHelper::getSyncState()) {
|
switch (SyncHelper::getSyncState()) {
|
||||||
case AUTO_SYNC:
|
case AUTO_SYNC:
|
||||||
syncBtn->setIcon(icon_auto);
|
// syncBtn->setIcon(mAutoIcon);
|
||||||
m_sync_state_action->setText(QString(tr("CUR STATE: %1")).arg(SyncHelper::SyncStateName[AUTO_SYNC]));
|
m_sync_state_action->setText(QString(tr("CUR STATE: %1")).arg(SyncHelper::SyncStateName[AUTO_SYNC]));
|
||||||
for (int i = 0; i < SYNC_ITEM_NUM; i++) {
|
for (int i = 0; i < SYNC_ITEM_NUM; i++) {
|
||||||
m_sync_item_action[i]->setDisabled(false);
|
m_sync_item_action[i]->setDisabled(false);
|
||||||
@@ -555,7 +326,7 @@ void QDicomViewer::syncStateChanged() const {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MANUAL_SYNC:{
|
case MANUAL_SYNC:{
|
||||||
syncBtn->setIcon(icon_manual);
|
// syncBtn->setIcon(mManualIcon);
|
||||||
m_sync_state_action->setText(QString(tr("CUR STATE: %1")).arg(SyncHelper::SyncStateName[MANUAL_SYNC]));
|
m_sync_state_action->setText(QString(tr("CUR STATE: %1")).arg(SyncHelper::SyncStateName[MANUAL_SYNC]));
|
||||||
m_sync_item_action[SLICE_POS]->setChecked(SyncHelper::getSyncItem(SLICE_POS));
|
m_sync_item_action[SLICE_POS]->setChecked(SyncHelper::getSyncItem(SLICE_POS));
|
||||||
m_sync_item_action[WIDTH_LEVEL]->setChecked(SyncHelper::getSyncItem(WIDTH_LEVEL));
|
m_sync_item_action[WIDTH_LEVEL]->setChecked(SyncHelper::getSyncItem(WIDTH_LEVEL));
|
||||||
@@ -563,7 +334,7 @@ void QDicomViewer::syncStateChanged() const {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIS_SYNC:
|
case DIS_SYNC:
|
||||||
syncBtn->setIcon(icon_dis);
|
// syncBtn->setIcon(mDisIcon);
|
||||||
m_sync_state_action->setText(QString(tr("CUR STATE: %1")).arg(SyncHelper::SyncStateName[DIS_SYNC]));
|
m_sync_state_action->setText(QString(tr("CUR STATE: %1")).arg(SyncHelper::SyncStateName[DIS_SYNC]));
|
||||||
for (int i = 0; i < SYNC_ITEM_NUM; i++) {
|
for (int i = 0; i < SYNC_ITEM_NUM; i++) {
|
||||||
m_sync_item_action[i]->setChecked(false);
|
m_sync_item_action[i]->setChecked(false);
|
||||||
@@ -576,12 +347,8 @@ void QDicomViewer::syncStateChanged() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//视窗操作?,file open相关
|
//视窗操作?,file open相关
|
||||||
void QDicomViewer::SetupFileTool(QToolButton *fileBtn) {
|
void QDicomViewer::SetupFileTool() {
|
||||||
// Menu
|
connect(ui->toolBar,&DefaultToolBar::openFolder, [&] {
|
||||||
fileBtn->setToolTip(QString("Open Dicom series from directory"));
|
|
||||||
QMenu *m;
|
|
||||||
m = new QMenu(this);
|
|
||||||
m->addAction(tr("Open DICOM folder"), this, [&] {
|
|
||||||
QString p = QFileDialog::getExistingDirectory(this, tr("Open dicom directory"),
|
QString p = QFileDialog::getExistingDirectory(this, tr("Open dicom directory"),
|
||||||
m_qs.value("DIR_PATH_ID").toString());
|
m_qs.value("DIR_PATH_ID").toString());
|
||||||
if (!p.isEmpty()) {
|
if (!p.isEmpty()) {
|
||||||
@@ -590,7 +357,7 @@ void QDicomViewer::SetupFileTool(QToolButton *fileBtn) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
m->addAction(tr("Open DICOM file"), this, [&] {
|
connect(ui->toolBar,&DefaultToolBar::openFile, [&] {
|
||||||
//QSettings s;
|
//QSettings s;
|
||||||
//QString p = s.value(FILE_PATH_ID).toString();
|
//QString p = s.value(FILE_PATH_ID).toString();
|
||||||
QString fn = QFileDialog::getOpenFileName(this, tr("Open dicom files"), m_qs.value("FILE_PATH_ID").toString());
|
QString fn = QFileDialog::getOpenFileName(this, tr("Open dicom files"), m_qs.value("FILE_PATH_ID").toString());
|
||||||
@@ -599,26 +366,11 @@ void QDicomViewer::SetupFileTool(QToolButton *fileBtn) {
|
|||||||
openDICOM(fn.toLocal8Bit().toStdString(), FILE_OPEN_MODE);
|
openDICOM(fn.toLocal8Bit().toStdString(), FILE_OPEN_MODE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
m->addSeparator();
|
|
||||||
m->addAction(tr("Quit"), this, &QDicomViewer::close);
|
|
||||||
fileBtn->setPopupMode(QToolButton::MenuButtonPopup);
|
|
||||||
fileBtn->setMenu(m);
|
|
||||||
|
|
||||||
// connect
|
|
||||||
connect(fileBtn, &QToolButton::clicked, this, [&] {
|
|
||||||
QString p = QFileDialog::getExistingDirectory(this, tr("Open dicom directory"),
|
|
||||||
m_qs.value("DIR_PATH_ID").toString());
|
|
||||||
if (!p.isEmpty()) {
|
|
||||||
m_qs.setValue("DIR_PATH_ID", p);
|
|
||||||
openDICOM(p.toLocal8Bit().toStdString(), DIR_OPEN_MODE);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDicomViewer::SetupImportTool(QToolButton *importBtn) {
|
void QDicomViewer::SetupImportTool() {
|
||||||
importBtn->setToolTip(QString("Search and download studies from PACS locations"));
|
|
||||||
connect(importBtn, &QToolButton::clicked, this, [&] {
|
connect(ui->toolBar, &DefaultToolBar::import, this, [&] {
|
||||||
if (nullptr == m_import) {
|
if (nullptr == m_import) {
|
||||||
m_import = new ImportWidget(this);
|
m_import = new ImportWidget(this);
|
||||||
connect(m_import, &ImportWidget::sigMoveDone, this, &QDicomViewer::openDICOMFromPACS);
|
connect(m_import, &ImportWidget::sigMoveDone, this, &QDicomViewer::openDICOMFromPACS);
|
||||||
@@ -627,49 +379,32 @@ void QDicomViewer::SetupImportTool(QToolButton *importBtn) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDicomViewer::SetupExportTool(QToolButton *saveBtn) {
|
void QDicomViewer::SetupExportTool() {
|
||||||
saveBtn->setToolTip(QString("Export images"));
|
|
||||||
connect(saveBtn, &QToolButton::clicked, this, [=] {
|
connect(ui->toolBar, &DefaultToolBar::save, this, [=] {
|
||||||
if (nullptr == exportDialog) {
|
if (nullptr == exportDialog) {
|
||||||
exportDialog = new ExportDialog(this);
|
exportDialog = new ExportDialog(this);
|
||||||
//exportDialog->setViewContainer(ui->viewContainer);
|
|
||||||
exportDialog->setCurView(ui->viewContainer->getCurrentView());
|
exportDialog->setCurView(ui->viewContainer->getCurrentView());
|
||||||
exportDialog->setModal(false);
|
exportDialog->setModal(false);
|
||||||
}
|
}
|
||||||
exportDialog->show();
|
exportDialog->show();
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDicomViewer::displayThumbnailBar(bool value) {
|
void QDicomViewer::displayThumbnailBar(bool value) {
|
||||||
VCRHelper::setThumbnailbar(value);
|
// VCRHelper::setThumbnailbar(value);
|
||||||
ui->thumbnailBar->setVisible(value);
|
// ui->thumbnailBar->setVisible(value);
|
||||||
m_preview_display_action->setChecked(value);
|
// m_preview_display_action->setChecked(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDicomViewer::SetupGridTool(QToolButton *gridBtn) {
|
void QDicomViewer::SetupGridTool() {
|
||||||
// Menu
|
|
||||||
//qDebug() << &gridBtn;
|
|
||||||
gridBtn->setToolTip(QString("Split Screen"));
|
|
||||||
QMenu *m;
|
|
||||||
m = new QMenu(this);
|
|
||||||
m_preview_display_action = m->addAction(tr("Preview bar"), this, [&](bool value) {
|
|
||||||
displayThumbnailBar(value);
|
|
||||||
|
|
||||||
});
|
|
||||||
m_preview_display_action->setCheckable(true);
|
|
||||||
m_preview_display_action->setChecked(false);
|
|
||||||
|
|
||||||
gridBtn->setPopupMode(QToolButton::MenuButtonPopup);
|
|
||||||
gridBtn->setMenu(m);
|
|
||||||
// connect
|
// connect
|
||||||
connect(gridBtn, &QToolButton::clicked, this, [=] {
|
connect(ui->toolBar, &DefaultToolBar::showGrid, this, [=](QToolButton* btn) {
|
||||||
// auto delete while hidden
|
// auto delete while hidden
|
||||||
//qDebug() << &gridBtn;
|
GridPopWidget *gpw = new GridPopWidget(btn);
|
||||||
GridPopWidget *gpw = new GridPopWidget(gridBtn);
|
|
||||||
connect(gpw, &GridPopWidget::Signal_ViewLayout,
|
connect(gpw, &GridPopWidget::Signal_ViewLayout,
|
||||||
ui->viewContainer, &ViewContainerWidget::viewLayoutChanged);
|
ui->viewContainer, &ViewContainerWidget::viewLayoutChanged);
|
||||||
gpw->move(this->geometry().topLeft() + gridBtn->geometry().bottomLeft() + QPoint(5, 5));
|
gpw->move(this->geometry().topLeft() + btn->geometry().bottomLeft() + QPoint(5, 5));
|
||||||
gpw->show();
|
gpw->show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#include "UI/Manager/ImageViewStateCheckWorker.h"
|
#include "UI/Manager/ImageViewStateCheckWorker.h"
|
||||||
#include "UI/Widget/Measure/pqFontPropertyWidget.h"
|
#include "UI/Widget/Measure/pqFontPropertyWidget.h"
|
||||||
|
|
||||||
typedef tuple<const char *, const char *, int> ActionProperty;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 主窗口Class
|
* @brief 主窗口Class
|
||||||
@@ -48,30 +47,24 @@ private:
|
|||||||
* 用于设置ToolButton相关的属性(文字、图标、槽等)的一组函数
|
* 用于设置ToolButton相关的属性(文字、图标、槽等)的一组函数
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
void SetupFileTool(QToolButton* fileBtn);
|
void SetupFileTool();
|
||||||
void SetupImportTool(QToolButton* importBtn);
|
void SetupImportTool();
|
||||||
void SetupExportTool(QToolButton *saveBtn);
|
void SetupExportTool();
|
||||||
|
|
||||||
void SetupGridTool(QToolButton *gridBtn);
|
void SetupGridTool();
|
||||||
void SetupSyncTool(QToolButton *syncBtn);
|
void SetupSyncTool();
|
||||||
void SetupAnnoTool(QToolButton *annoBtn);
|
void SetupAnnoTool();
|
||||||
|
|
||||||
void SetupSliceTool(QToolButton* sliceBtn);
|
|
||||||
void SetupAdjustTool(QToolButton *winlevelBtn);
|
|
||||||
void SetupPanTool(QToolButton* panBtn);
|
|
||||||
void SetupZoomTool(QToolButton* zoomBtn);
|
|
||||||
void SetupMeasureTool(QToolButton *measureBtn);
|
|
||||||
|
|
||||||
void SetupFlipTool(QToolButton *flipBtn);
|
void SetupAdjustTool();
|
||||||
void SetupFusionTool(QToolButton* fusionBtn);
|
void SetupMeasureTool();
|
||||||
void SetupCineTool(QToolButton* cineBtn);
|
|
||||||
void SetupEmptyTool(QToolButton* emptyBtn);
|
void SetupTransformTool();
|
||||||
|
void SetupFusionTool();
|
||||||
|
void SetupCineTool();
|
||||||
|
void SetupEmptyTool();
|
||||||
|
|
||||||
|
|
||||||
void SetupFullScreenTool(QToolButton *btnfullscreen);
|
void SetupScreenTool();
|
||||||
void SetupMaximizeTool(QToolButton *btnmaximize);
|
|
||||||
void SetupMinimizeTool(QToolButton *btnminimize);
|
|
||||||
void SetupCloseTool(QToolButton *btnclose);
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,9 +97,8 @@ private:
|
|||||||
*/
|
*/
|
||||||
void createVCRToolbar(DicomImageView *v);
|
void createVCRToolbar(DicomImageView *v);
|
||||||
|
|
||||||
QIcon icon_manual;
|
void resetToolBarButtons(ViewFunctionState state);
|
||||||
QIcon icon_auto;
|
|
||||||
QIcon icon_dis;
|
|
||||||
QToolButton* syncBtn = nullptr;
|
QToolButton* syncBtn = nullptr;
|
||||||
QToolButton* fusionBtn = nullptr;
|
QToolButton* fusionBtn = nullptr;
|
||||||
QToolButton* mprBtn = nullptr;
|
QToolButton* mprBtn = nullptr;
|
||||||
@@ -114,12 +106,7 @@ private:
|
|||||||
QAction* m_sync_state_action;
|
QAction* m_sync_state_action;
|
||||||
QAction* m_measure_hidden_action;
|
QAction* m_measure_hidden_action;
|
||||||
QAction* m_patient_hidden_action;
|
QAction* m_patient_hidden_action;
|
||||||
QAction* m_preview_display_action;
|
|
||||||
|
|
||||||
int act_num_of_close;
|
|
||||||
int act_num_of_maximize;
|
|
||||||
int act_num_of_fullscreen;
|
|
||||||
int act_num_of_minimize;
|
|
||||||
|
|
||||||
ExportDialog *exportDialog = nullptr;
|
ExportDialog *exportDialog = nullptr;
|
||||||
ImportWidget *m_import =nullptr;
|
ImportWidget *m_import =nullptr;
|
||||||
@@ -132,6 +119,5 @@ private:
|
|||||||
ImageViewStateCheckWorker worker;
|
ImageViewStateCheckWorker worker;
|
||||||
|
|
||||||
void syncStateChanged() const;
|
void syncStateChanged() const;
|
||||||
void switchSyncState();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -125,7 +125,7 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="toolBar">
|
<widget class="DefaultToolBar" name="toolBar">
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>toolBar</string>
|
<string>toolBar</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -152,11 +152,17 @@
|
|||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>ThumbnailBarWidget</class>
|
<class>DefaultToolBar</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QToolBar</extends>
|
||||||
<header location="global">UI/Widget/thumbnailbarwidget.h</header>
|
<header location="global">UI/Widget/ToolBar/DefaultToolBar.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>ThumbnailBarWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header location="global">UI/Widget/Thumbnail/thumbnailbarwidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../QDicomViewer.qrc"/>
|
<include location="../QDicomViewer.qrc"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user