]> Creatis software - clitk.git/commitdiff
maximizes the selected slicer
authorRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Tue, 16 Oct 2012 14:40:04 +0000 (16:40 +0200)
committerRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Tue, 16 Oct 2012 14:40:04 +0000 (16:40 +0200)
- before it was just the NW one.

vv/vvMainWindow.cxx
vv/vvSlicerManager.cxx
vv/vvSlicerManager.h

index 8f94ff664c8bdb033e3228d57f54f4126d81b4ba..948c8e12da32159972d82a6eecef34924cf3df39 100644 (file)
@@ -1237,25 +1237,57 @@ void vvMainWindow::ShowHelpDialog()
 //------------------------------------------------------------------------------
 void vvMainWindow::ChangeViewMode()
 {
-  QList<int> size;
+  typedef struct _SIZE{
+    QSplitter* splitter;
+    QList<int> size1, size2;
+  }SplitterSize;
+  SplitterSize sizes[4];
+  sizes[0].splitter = OSplitter;
+  sizes[0].size1.push_back(1);
+  sizes[0].size1.push_back(0);
+  sizes[0].size2.push_back(1);
+  sizes[0].size2.push_back(0);
+
+  sizes[1].splitter = ESplitter;
+  sizes[1].size1.push_back(0);
+  sizes[1].size1.push_back(1);
+  sizes[1].size2.push_back(1);
+  sizes[1].size2.push_back(0);
+
+  sizes[2].splitter = OSplitter;
+  sizes[2].size1.push_back(1);
+  sizes[2].size1.push_back(0);
+  sizes[2].size2.push_back(0);
+  sizes[2].size2.push_back(1);
+
+  sizes[3].splitter = ESplitter;
+  sizes[3].size1.push_back(0);
+  sizes[3].size1.push_back(1);
+  sizes[3].size2.push_back(0);
+  sizes[3].size2.push_back(1);
+  
+  int slicer = mSlicerManagers[mCurrentPickedImageIndex]->GetSelectedSlicer();
   if (viewMode == 1) {
-    viewMode = 0;
-    size.push_back(1);
-    size.push_back(0);
-    splitter_3->setSizes(size);
-    OSplitter->setSizes(size);
-    DataTree->setColumnHidden(2,1);
-    DataTree->setColumnHidden(3,1);
-    DataTree->setColumnHidden(4,1);
+    if (slicer >= 0) {
+      viewMode = 0;
+      splitter_3->setSizes(sizes[slicer].size1);
+      sizes[slicer].splitter->setSizes(sizes[slicer].size2);
+      DataTree->setColumnHidden(2,1);
+      DataTree->setColumnHidden(3,1);
+      DataTree->setColumnHidden(4,1);
+    }
   } else {
-    viewMode = 1;
-    size.push_back(1);
-    size.push_back(1);
-    splitter_3->setSizes(size);
-    OSplitter->setSizes(size);
-    DataTree->setColumnHidden(2,0);
-    DataTree->setColumnHidden(3,0);
-    DataTree->setColumnHidden(4,0);
+    QList<int> size;
+    if (slicer >= 0) {
+      viewMode = 1;
+      size.push_back(1);
+      size.push_back(1);
+      splitter_3->setSizes(size);
+      sizes[slicer].splitter->setSizes(size);
+      DataTree->setColumnHidden(2,0);
+      DataTree->setColumnHidden(3,0);
+      DataTree->setColumnHidden(4,0);
+    }
   }
   UpdateRenderWindows();
   /*
@@ -1263,10 +1295,12 @@ void vvMainWindow::ChangeViewMode()
   ** the associated Slicer to redraw crosses.
   */
   for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
-    if (DataTree->topLevelItem(i)->data(COLUMN_UL_VIEW,Qt::CheckStateRole).toInt() > 1)
+//     if (DataTree->topLevelItem(i)->data(COLUMN_UL_VIEW,Qt::CheckStateRole).toInt() > 1)
       mSlicerManagers[i]->GetSlicer(0)->Render();
-    if (DataTree->topLevelItem(i)->data(COLUMN_DL_VIEW,Qt::CheckStateRole).toInt() > 1)
+      mSlicerManagers[i]->GetSlicer(1)->Render();
+//     if (DataTree->topLevelItem(i)->data(COLUMN_DL_VIEW,Qt::CheckStateRole).toInt() > 1)
       mSlicerManagers[i]->GetSlicer(2)->Render();
+      mSlicerManagers[i]->GetSlicer(3)->Render();
   }
 }
 //------------------------------------------------------------------------------
index eb8977dd0548b890388f5cda415785e644d69ac1..9ff163eb1990e519bb1a2668b80cc5c54b0539ef 100644 (file)
@@ -69,7 +69,8 @@ vvSlicerManager::vvSlicerManager(int numberOfSlicers)
 
   for ( int i = 0; i < numberOfSlicers; i++)
     mSlicers.push_back(vtkSmartPointer<vvSlicer>::New());
-
+  mSelectedSlicer = -1;
+  
   mPreviousSlice.resize(numberOfSlicers);
   mPreviousTSlice.resize(numberOfSlicers);
   mSlicingPreset = WORLD_SLICING;
@@ -605,6 +606,7 @@ void vvSlicerManager::UpdateViews(int current,int slicer)
       z <= mSlicers[slicer]->GetInput()->GetWholeExtent()[5]+0.5) {
     mSlicers[slicer]->UpdateCursorPosition();
     mSlicers[slicer]->SetCursorColor(10,212,255);
+    mSelectedSlicer = slicer;
 
     switch (mSlicers[slicer]->GetSliceOrientation()) {
     case vtkImageViewer2::SLICE_ORIENTATION_XY:
index 088df6171a39d2fa7467b63ff42843d86e448271..6cc9333ca8b157846236f27a75a0b549187435a9 100644 (file)
@@ -86,6 +86,10 @@ class vvSlicerManager : public QObject {
   ///Switch between nearest neighbor and linear interpolation
   void ToggleInterpolation();
   vvSlicer* GetSlicer(int i);
+  int GetSelectedSlicer() {
+    return mSelectedSlicer;
+  }
+  
   void UpdateSlicer(int num, bool state);
   void SetSlicerWindow(int i, vtkRenderWindow* RW);
   void SetInteractorStyleNavigator(int i,vtkInteractorStyle* style);
@@ -240,6 +244,7 @@ signals :
 
 protected:
   std::vector< vtkSmartPointer<vvSlicer> > mSlicers;
+  int mSelectedSlicer;
   vvImageReader::Pointer mReader;
   vvImageReader::Pointer mOverlayReader;
   vvImageReader::Pointer mFusionReader;