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 zcmeAS@N?(olHy`uVBq!ia0vp^50; z%El}wM*+8o{kdB_bu&_*az`!|JUHEO!Z{~-cb(4?fx#Vn!>*^@u9hudoVS_z^WhC| zEDv*^XY%#VZ!zurDd%deX}v|Cy}*jpRA64ePj#*D|kr@pMf2gp`gMg_BwTj9xc5x4U(3g&@Sq7FwZfhLT-za( zxaY=HkrWW|bo;TX?myQSKCP7#*)8;S!KtbBx4-7D6M6rOgCmf?E4H&L;OQyjvf9r^ a?0M7NizSwDx%>utj=|H_&t;ucLK6TM=ZG=@ 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.45.1