Add annotations and referenceLine hide or show functions.

This commit is contained in:
Krad
2022-08-12 14:10:31 +08:00
parent b85b1ac717
commit 433613e851
10 changed files with 43 additions and 11 deletions

View File

@@ -200,13 +200,13 @@ public:
EventsCenter::TriggerEvent(AnonymizeStateChanged);
}
static bool IsAnno()
static bool GetVisibility()
{
return annotOn;
}
static void toggleAnno()
static void setVisibility(bool v)
{
annotOn = !annotOn;
annotOn = v;
EventsCenter::TriggerEvent(AnnotationStateChanged);
}

View File

@@ -211,7 +211,7 @@ void ActorDraggableInteractorStyle::OnChar() {
void ActorDraggableInteractorStyle::NoneStatePick() {
if (AnnoHelper::IsAnno()) {
if (AnnoHelper::GetVisibility()) {
int *pos = this->Interactor->GetEventPosition();
this->FindPokedRenderer(pos[0], pos[1]);
int result = picker->PickProp(pos[0], pos[1], this->CurrentRenderer);

View File

@@ -14,6 +14,8 @@
#include <vtkProperty2D.h>
#include <vtkPolyLineSource.h>
bool ReferenceLineLegendActor::TypeVisibility = true;
vtkStandardNewMacro(ReferenceLineLegendActor)
ReferenceLineLegendActor::ReferenceLineLegendActor() {
@@ -53,7 +55,7 @@ int ReferenceLineLegendActor::RenderOverlay(vtkViewport *viewport) {
auto renderer = vtkRenderer::SafeDownCast(viewport);
if (!renderer) return 0;
BuildShape(renderer);
if (Visibility){
if (Visibility && ReferenceLineLegendActor::TypeVisibility){
shadow2D->RenderOverlay(viewport);
return actor2D->RenderOverlay(viewport);
}

View File

@@ -58,6 +58,14 @@ public:
Modified();
}
static bool GetTypeVisibility(){
return TypeVisibility;
};
static void SetTypeVisibility(bool v){
TypeVisibility = v;
}
protected:
ReferenceLineLegendActor();
@@ -73,6 +81,7 @@ private:
void operator=(const ReferenceLineLegendActor &) = delete;
vtkTimeStamp mModifyTime;
static bool TypeVisibility;
};

View File

@@ -1129,7 +1129,7 @@ void infinitiViewer::InitTopLeftCornerInfo(const std::string &lbl_ser_num, const
}
void infinitiViewer::UpdateCornerInfo(int index) {
if (AnnoHelper::IsAnno()) {
if (AnnoHelper::GetVisibility()) {
if (index == TOP_LEFT) {
int maxSlice = this->GetSliceMax();
@@ -1167,7 +1167,7 @@ void infinitiViewer::UpdateCornerInfo(int index) {
}
void infinitiViewer::UpdateCornerInfoAll() {
if (AnnoHelper::IsAnno()) {
if (AnnoHelper::GetVisibility()) {
UpdateCornerInfo(TOP_LEFT);
UpdateCornerInfo(BOTTOM_RIGHT);
UpdateCornerInfo(TOP_RIGHT);
@@ -1184,7 +1184,7 @@ void infinitiViewer::UpdateCornerInfoAll() {
}
void infinitiViewer::UpdateTopLeftCornerInfo() {
if (AnnoHelper::IsAnno()) {
if (AnnoHelper::GetVisibility()) {
int maxSlice = this->GetSliceMax();
int currentSlice = this->GetSlice();
std::string msg_const = m_cornerInfo.ConstAnno[TOP_LEFT];
@@ -1334,7 +1334,7 @@ void infinitiViewer::UnActiveReferenceLine() {
}
void infinitiViewer::RenderLegend() {
if (AnnoHelper::IsAnno()) {
if (AnnoHelper::GetVisibility()) {
if (Renderer) {
if (rulerActive)ruler->RenderOverlay(Renderer);
referenceLine->RenderOverlay(Renderer);

View File

@@ -514,3 +514,8 @@ void ImageViewManager::reloadCurrentView(DicomImageView * view){
emit currentViewReloaded(view);
}
void ImageViewManager::switchReferenceLineVisibility(bool v) {
ReferenceLineLegendActor::SetTypeVisibility(v);
renderAll();
}

View File

@@ -88,6 +88,8 @@ public:
void switchSliceOrientation();
void switchReferenceLineVisibility(bool v);
void updateCornerInfoAll();
void updateCornerInfoPrivacy();

View File

@@ -280,6 +280,16 @@ void DefaultToolBar::initAnonymizeButton() {
mBtnAnonymize->setCheckable(true);
QMenu *m;
m = new QMenu(this);
//显隐 Annotations
mActionHideAnnotations = m->addAction(tr("Annotations"), this, [=](bool value) {
AnnoHelper::setVisibility(value);
});
mActionHideAnnotations->setCheckable(true);
mActionHideAnnotations->setChecked(true);
//显隐 reference line
mActionHideReferenceLine = m->addAction(tr("Cross Reference Line"), this, &DefaultToolBar::referenceLineStateChange);
mActionHideReferenceLine->setCheckable(true);
mActionHideReferenceLine->setChecked(true);
//视窗操作,显隐测量
mActionHideMeasure = m->addAction(tr("Hide all measurements"), this, [=](bool value) {
Measure::SetHidden(mActionHideMeasure->isChecked());

View File

@@ -39,6 +39,7 @@ signals:
void parentWindowClose();
void transform(TransFormType type);
void showMeta();
void referenceLineStateChange(bool isShow);
private:
QAction *addButton(QToolButton *button, const char *objectName);
@@ -90,6 +91,8 @@ private:
QAction *mActionClose;
QAction *mActionFullScreen;
QAction *mActionSyncState;
QAction *mActionHideAnnotations;
QAction *mActionHideReferenceLine;
QAction *mActionHideMeasure;
QAction *mActionHidePatData;
QAction* mSyncActions[3]={nullptr,nullptr,nullptr};

View File

@@ -116,9 +116,10 @@ void QDicomViewer::createVCRToolbar(DicomImageView *v) {
//视窗操作wwwl
void QDicomViewer::initViewOperation() {
// operation mode change
// operation reference line hide and show
connect(ui->toolBar, &DefaultToolBar::referenceLineStateChange,
ui->viewContainer->getViewManager(), &ImageViewManager::switchReferenceLineVisibility); // operation mode change
connect(ui->toolBar, &DefaultToolBar::modeChanged, [=](int mode) {
printf("mode:%d\r\n",mode);
ui->viewContainer->getViewManager()->setInteractionMode(mode);
});
// custom window level