]> Creatis software - clitk.git/commitdiff
Merge branch 'master' of /home/dsarrut/clitk3.server
authordsarrut <david.sarrut@gmail.com>
Thu, 9 Jun 2011 12:35:51 +0000 (14:35 +0200)
committerdsarrut <david.sarrut@gmail.com>
Thu, 9 Jun 2011 12:35:51 +0000 (14:35 +0200)
tools/clitkCropImageGenericFilter.cxx
vv/icons/identity.png [new file with mode: 0644]
vv/vvIcons.qrc
vv/vvInfoPanel.cxx
vv/vvInfoPanel.h
vv/vvMainWindow.cxx
vv/vvMainWindow.h
vv/vvMainWindow.txx [deleted file]
vv/vvSlicer.cxx
vv/vvSlicerManager.cxx
vv/vvSlicerManager.h

index 5c78d4ea436355e1d8e459ba8a69e9eac3f5d36d..aeae1f988806c100c6198f407f59baefc5134222 100644 (file)
@@ -165,14 +165,21 @@ namespace clitk
       output->SetOrigin(origin);
     }
     
-    // force index to zero
-    typename ImageType::RegionType region;
-    region = output->GetLargestPossibleRegion();
-    typename ImageType::IndexType index;
+    // adjust image origin and force index to zero 
+    typename ImageType::RegionType region = output->GetLargestPossibleRegion();
+    typename ImageType::IndexType index = region.GetIndex();
+    typename ImageType::PointType origin = output->GetOrigin();
+    typename ImageType::SpacingType spacing = output->GetSpacing();
+    if (mArgsInfo.verbose_flag) std::cout << "origin before crop " << origin << std::endl;
+    for (unsigned int i = 0; i < output->GetImageDimension(); i++)
+      origin[i] += index[i]*spacing[i];
+    if (mArgsInfo.verbose_flag) std::cout << "origin after crop " << origin << std::endl;
+    output->SetOrigin(origin);
+
     index.Fill(itk::NumericTraits<double>::Zero);
     region.SetIndex(index);
     output->SetRegions(region);
-
+    
     // Write/Save results
     this->template SetNextOutput<ImageType>(output); 
   }
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 da2bda3828c8bdb081e4786184eb49e1568c191f..e8d3ba8187718616c917a166ae14e7e5476f4654 100644 (file)
@@ -122,55 +122,6 @@ void vvInfoPanel::setCurrentInfo(int visibility, double x, double y, double z, d
 //------------------------------------------------------------------------------
 
 
-//------------------------------------------------------------------------------
-void vvInfoPanel::setViews(int window, int view, int slice)
-{/*
-  QString viewString;
-  switch (view) {
-  case 0: {
-    viewString = "Sagital,  ";
-    break;
-  }
-  case 1: {
-    viewString = "Coronal, ";
-    break;
-  }
-  case 2: {
-    viewString = "Axial,   ";
-    break;
-  }
-  }
-
-  QString text = viewString;
-  if (view != -1) {
-    text += "current slice : ";
-    text += QString::number(slice);
-  } else {
-    text = "Disable";
-  }
-
-  switch (window) {
-  case 0: {
-    ULLabel->setText(text);
-    break;
-  }
-  case 1: {
-    URLabel->setText(text);
-    break;
-  }
-  case 2: {
-    DLLabel->setText(text);
-    break;
-  }
-  case 3: {
-    DRLabel->setText(text);
-    break;
-  }
-  }*/
-}
-//------------------------------------------------------------------------------
-
-
 //------------------------------------------------------------------------------
 void vvInfoPanel::setMemoryInMb(QString text)
 {
index 5418703e04cc4f74b21e225341db76a65a1a0191..4a665e1aaa34ba09029fa843a5130cf5feabc43c 100644 (file)
@@ -39,7 +39,6 @@ public:
     void setDimension(QString text);
     void setSizePixel(QString text);
     void setCurrentInfo(int visibility, double x, double y, double z, double X, double Y, double Z, double value);
-    void setViews(int window, int view, int slice);
     void setMemoryInMb(QString text);
 
 public slots:
index 07e027951af623749b2408d3afe56e02139b7006..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);
@@ -910,8 +915,6 @@ void vvMainWindow::LoadImages(std::vector<std::string> files, vvImageReader::Loa
                 this, SLOT(OverlayChanged(int,double,double)));
         connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)),
                 this, SLOT(FusionChanged(int,double)));
-        connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)),
-                this,SLOT(WindowsChanged(int, int, int)));
         connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)),
                 this,SLOT(WindowLevelChanged(double, double, int, int)));
         connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)),
@@ -1625,13 +1628,6 @@ void vvMainWindow::FusionChanged(int visibility, double value)
 }
 //------------------------------------------------------------------------------
 
-//------------------------------------------------------------------------------
-void vvMainWindow::WindowsChanged(int window, int view, int slice)
-{
-  infoPanel->setViews(window, view, slice);
-}
-//------------------------------------------------------------------------------
-
 //------------------------------------------------------------------------------
 void vvMainWindow::WindowLevelChanged(double window, double level,int preset,int colormap)
 {
@@ -1912,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)
 {
@@ -2831,8 +2837,6 @@ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filen
           this, SLOT(OverlayChanged(int,double,double)));
   connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)),
           this, SLOT(FusionChanged(int,double)));
-  connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)),
-          this,SLOT(WindowsChanged(int, int, int)));
   connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)),
           this,SLOT(WindowLevelChanged(double, double, int, int)));
   connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)),
index d47dacce49a837b32d8dc2cd7877bc3cdfad7fff..7da8a9171ecc8e0018cdf5606daef1f947eb75ed 100644 (file)
@@ -101,7 +101,6 @@ public slots:
   void SegmentationOnCurrentImage();
   void SurfaceViewerLaunch();
 
-  void WindowsChanged(int window, int view, int slice);
   void WindowLevelChanged(double window, double level,int preset, int colormap);
   void UpdateSlice(int slicer, int slice);
   void UpdateTSlice(int slicer, int slice);
@@ -140,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);
@@ -211,6 +211,4 @@ private:
   
 };
 
-#include "vvMainWindow.txx"
-
 #endif
diff --git a/vv/vvMainWindow.txx b/vv/vvMainWindow.txx
deleted file mode 100644 (file)
index 7cdb613..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*=========================================================================
-  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
-
-  Authors belong to:
-  - University of LYON              http://www.universite-lyon.fr/
-  - Léon Bérard cancer center       http://www.centreleonberard.fr
-  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
-
-  This software is distributed WITHOUT ANY WARRANTY; without even
-  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-  PURPOSE.  See the copyright notices for more information.
-
-  It is distributed under dual licence
-
-  - BSD        See included LICENSE.txt file
-  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-===========================================================================**/
-// }
index 43583571456b3d12d6253bc27e7fb17449eb893a..6100c56dfcc84aa5ad97ca19c980bad135cfd6c6 100644 (file)
@@ -836,8 +836,8 @@ void vvSlicer::UpdateDisplayExtent()
   
   // Overlay image actor
   if (mOverlay && mOverlayActor->GetVisibility()) {
+    AdjustResliceToSliceOrientation(mOverlayReslice);
     int overExtent[6];
-    mOverlayReslice->GetOutput()->UpdateInformation();
     this->ConvertImageToImageDisplayExtent(input, w_ext, mOverlayReslice->GetOutput(), overExtent);
     ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetWholeExtent());
     mOverlayActor->SetDisplayExtent( overExtent );
@@ -845,8 +845,8 @@ void vvSlicer::UpdateDisplayExtent()
 
   // Fusion image actor
   if (mFusion && mFusionActor->GetVisibility()) {
+    AdjustResliceToSliceOrientation(mFusionReslice);
     int fusExtent[6];
-    mFusionReslice->GetOutput()->UpdateInformation();
     this->ConvertImageToImageDisplayExtent(input, w_ext, mFusionReslice->GetOutput(), fusExtent);
     ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetWholeExtent());
     mFusionActor->SetDisplayExtent(fusExtent);
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 a148d196e6ebdeeb175c4d7407b2276e3c77a2ff..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) {
@@ -211,7 +212,6 @@ signals :
   void UpdateVector(int display, double x, double y, double z, double value);
   void UpdateOverlay(int display, double valueOver, double valueRef);
   void UpdateFusion(int display, double valueFus);
-  void UpdateWindows(int slicer, int view, int slice);
   void UpdateOrientation(int slicer, int orientation);
   void UpdateSlice(int slicer, int slice);
   void UpdateTSlice(int slicer, int slice);