From: Simon Rit Date: Wed, 8 Jun 2011 15:45:12 +0000 (+0200) Subject: Added "Reset transformation to identity" in image right-click menu X-Git-Tag: v1.3.0~321^2~3^2~2^2~3 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=473cb0db7da37740926a0ec36b3f449ef27ef565;p=clitk.git Added "Reset transformation to identity" in image right-click menu --- diff --git a/vv/icons/identity.png b/vv/icons/identity.png new file mode 100644 index 0000000..dbce16d Binary files /dev/null and b/vv/icons/identity.png differ 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) {