]> Creatis software - clitk.git/commitdiff
Parsing fusion image from command line
authorsrit <srit>
Thu, 16 Sep 2010 13:29:04 +0000 (13:29 +0000)
committersrit <srit>
Thu, 16 Sep 2010 13:29:04 +0000 (13:29 +0000)
vv/vv.cxx
vv/vvMainWindow.cxx
vv/vvMainWindow.h

index d06d05c74be2bec0cda5b8d7ab2a05f81e3f0dd5..71974f1e6124dea74f279b35825a76edf7b369c2 100644 (file)
--- a/vv/vv.cxx
+++ b/vv/vv.cxx
@@ -87,7 +87,12 @@ int main( int argc, char** argv )
             if (!n_image_loaded) load_image_first_error();
             window.AddROI(n_image_loaded-1,argv[i+1]);
             i++; //skip roi name
-          } 
+          }
+        else if (current=="--fusion") {
+            if (!n_image_loaded) load_image_first_error();
+            window.AddFusionImage(n_image_loaded-1,argv[i+1]);
+            i++; //skip fusion name
+          }
         else if (current == "--sequence") {
           n_image_loaded++; //count only one for the sequence
           parse_mode=P_SEQUENCE; }
index d65be28c2d6901dca3e5d0d7a26bf06901cfdfbe..4c8564f0697b78e7731293d41a72a448eedc03ca 100644 (file)
@@ -1902,9 +1902,10 @@ void vvMainWindow::AddROI(int index, QString file)
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvMainWindow::AddFusionImage()
+void vvMainWindow::AddFusionImage(int index, QString file)
 {
-  int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
+  if (index==-1)
+    index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
 
   //check if one fusion image is added
   for (int child = 0; child < DataTree->topLevelItem(index)->childCount(); child++)
@@ -1918,7 +1919,8 @@ void vvMainWindow::AddFusionImage()
 
   QString Extensions = EXTENSIONS;
   Extensions += ";;All Files (*)";
-  QString file = QFileDialog::getOpenFileName(this,tr("Load Fusion image"),mInputPathName,Extensions);
+  if(file.isEmpty())
+    file = QFileDialog::getOpenFileName(this,tr("Load Fusion image"),mInputPathName,Extensions);
   if (!file.isEmpty()) {
     mInputPathName = itksys::SystemTools::GetFilenamePath(file.toStdString()).c_str();
     itk::ImageIOBase::Pointer reader = itk::ImageIOFactory::CreateImageIO(
index d4f23b101702d3a1f23eb69006afa608d62559ca..27c0861d2958b635e7f2e483eb2ec42ca454b2fe 100644 (file)
@@ -48,6 +48,7 @@ class vvMainWindow: public vvMainWindowBase,
   vvSlicerManager * AddImage(vvImage::Pointer image,std::string filename);
   void AddField(QString file,int index);
   void AddOverlayImage(int index, QString filename);
+  void AddFusionImage(int index=-1, QString filename="");
   void AddROI(int index, QString filename);
   ///Adds a mesh to a SlicerManager, with optional warping by vector field
   void AddContour(int image_index, vvMesh::Pointer contour, bool propagation);
@@ -132,7 +133,6 @@ public slots:
   void ReloadImage();
   void OpenField();
   void SelectOverlayImage();
-  void AddFusionImage();
 
   void SetVFProperty(int subsampling,int scale,int lut, int width);
   void SetOverlayProperty(int color);