From 473cb0db7da37740926a0ec36b3f449ef27ef565 Mon Sep 17 00:00:00 2001 From: Simon Rit Date: Wed, 8 Jun 2011 17:45:12 +0200 Subject: [PATCH] Added "Reset transformation to identity" in image right-click menu --- vv/icons/identity.png | Bin 0 -> 337 bytes vv/vvIcons.qrc | 1 + vv/vvMainWindow.cxx | 15 +++++++++++++++ vv/vvMainWindow.h | 1 + vv/vvSlicerManager.cxx | 21 +++++++++++++++++++++ vv/vvSlicerManager.h | 1 + 6 files changed, 39 insertions(+) create mode 100644 vv/icons/identity.png diff --git a/vv/icons/identity.png b/vv/icons/identity.png new file mode 100644 index 0000000000000000000000000000000000000000..dbce16d9dfd64abba13c53c24b257549bea618b0 GIT binary patch literal 337 zcmV-X0j~auP)X1^@s6D=Y3@00001b5ch_0Itp) z=>Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipb+ z4k|WOmhZR#007ZRL_t(Y$HmmKYC=H}M&XZbv`H;!W#tQ5r4hlGF_6weA4e?n7*SJ* zy;j#|+j|{%qi(YU^TV+0Il~Lj0!>SAgf))&9z`=LH>ddS82*JlCiuhh(aaC#9WU5p zoa-@u3p1?)uIS~uk4rR@g8y^IAlE~jqM7J`9cK8zC$@!|PKs7IVADa-z07k?gz;im zQjqZ~S3>;OxDsK!*p(Dyyx5f#<+sL_NBOOB<$WF$yAt)F%9VfH^=+;c@A?P`Q4fk; jiF#1w$}@I-^D+l+mPd0KqzXj)00000NkvXXu0mjf7UzgE literal 0 HcmV?d00001 diff --git a/vv/vvIcons.qrc b/vv/vvIcons.qrc index 9dd0d96..15a8648 100644 --- a/vv/vvIcons.qrc +++ b/vv/vvIcons.qrc @@ -39,5 +39,6 @@ icons/adjustsize.png icons/standardbutton-apply-16.png icons/standardbutton-cancel-16.png + icons/identity.png diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index d965069..882bc2b 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -160,6 +160,11 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() connect(actionAdd_fusion_image,SIGNAL(triggered()),this,SLOT(SelectFusionImage())); contextActions.push_back(actionAdd_fusion_image); + contextMenu.addSeparator(); + QAction* actionResetMatrix = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/identity.png")), + tr("Reset transformation to identity")); + connect(actionResetMatrix, SIGNAL(triggered()), this,SLOT(ResetTransformationToIdentity())); + // TRIAL DS /* QMenu * m = new QMenu(menubar); @@ -1903,6 +1908,16 @@ void vvMainWindow::SelectFusionImage() } //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +void vvMainWindow::ResetTransformationToIdentity() +{ + std::string actorType = DataTree->selectedItems()[0]->data(1,Qt::UserRole).toString().toStdString(); + int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); + mSlicerManagers[index]->ResetTransformationToIdentity(actorType); + ImageInfoChanged(); +} +//------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::AddFusionImage(int index, QString file) { diff --git a/vv/vvMainWindow.h b/vv/vvMainWindow.h index dcfe9ed..7da8a91 100644 --- a/vv/vvMainWindow.h +++ b/vv/vvMainWindow.h @@ -139,6 +139,7 @@ public slots: void OpenField(); void SelectOverlayImage(); void SelectFusionImage(); + void ResetTransformationToIdentity(); void SetVFProperty(int subsampling,int scale,int lut, int width, double r, double g, double b); void SetOverlayProperty(int color); diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 987162c..fd8f09f 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -736,6 +736,27 @@ double vvSlicerManager::GetColorLevel() } //---------------------------------------------------------------------------- +//------------------------------------------------------------------------------ +void vvSlicerManager::ResetTransformationToIdentity(const std::string actorType) +{ + if(actorType == "image") + this->GetImage()->GetTransform()->Identity(); + else if(actorType == "overlay") + this->GetSlicer(0)->GetOverlay()->GetTransform()->Identity(); + else if(actorType == "fusion") + this->GetSlicer(0)->GetFusion()->GetTransform()->Identity(); + else if(actorType == "vf") + this->GetVF()->GetTransform()->Identity(); + else + return; + + for(int i=0; i< this->GetNumberOfSlicers(); i++){ + this->GetSlicer(i)->ForceUpdateDisplayExtent(); + this->GetSlicer(i)->ResetCamera(); + this->GetSlicer(i)->Render(); + } +} +//------------------------------------------------------------------------------ //---------------------------------------------------------------------------- void vvSlicerManager::Render() diff --git a/vv/vvSlicerManager.h b/vv/vvSlicerManager.h index 581f9a3..5e0ef60 100644 --- a/vv/vvSlicerManager.h +++ b/vv/vvSlicerManager.h @@ -166,6 +166,7 @@ class vvSlicerManager : public QObject { void UpdateViews(int current, int slicer); void UpdateLinked(int slicer); void UpdateLinkedNavigation(vvSlicer *slicer, bool bPropagate=false); + void ResetTransformationToIdentity(const std::string actorType); void Render(); void AddLink(std::string newId) { -- 2.47.1