]> Creatis software - clitk.git/commitdiff
Added "Reset transformation to identity" in image right-click menu
authorSimon Rit <simon.rit@creatis.insa-lyon.fr>
Wed, 8 Jun 2011 15:45:12 +0000 (17:45 +0200)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Thu, 9 Jun 2011 09:18:00 +0000 (11:18 +0200)
vv/icons/identity.png [new file with mode: 0644]
vv/vvIcons.qrc
vv/vvMainWindow.cxx
vv/vvMainWindow.h
vv/vvSlicerManager.cxx
vv/vvSlicerManager.h

diff --git a/vv/icons/identity.png b/vv/icons/identity.png
new file mode 100644 (file)
index 0000000..dbce16d
Binary files /dev/null and b/vv/icons/identity.png differ
index 9dd0d96908e9470018c54055fdaaf9ba36c44079..15a864843ba26c5767d6a665b72bd65063f245ca 100644 (file)
@@ -39,5 +39,6 @@
     <file>icons/adjustsize.png</file>
     <file>icons/standardbutton-apply-16.png</file>
     <file>icons/standardbutton-cancel-16.png</file>
+    <file>icons/identity.png</file>
   </qresource>
 </RCC>
index d965069f7a356fc6778e65fa9d755bae6c0e55a5..882bc2b16d631c7cf68233f30ac3fe0c3640cf81 100644 (file)
@@ -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)
 {
index dcfe9ed464798f904625ac7249f44e3a3b993122..7da8a9171ecc8e0018cdf5606daef1f947eb75ed 100644 (file)
@@ -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);
index 987162cc6b420a0d3c8d25e557174c5b5e27945e..fd8f09fccc30b4667a6e271076ca5000f2839512 100644 (file)
@@ -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()
index 581f9a351ba3e2b3fd5bd203961ed76b1556e2f9..5e0ef60c24194669ebf78e5d30a4eb0aa2aca145 100644 (file)
@@ -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) {