From 097d5fd525a35dd8fa4b847ca4f6e1c6541c122c Mon Sep 17 00:00:00 2001 From: srit Date: Thu, 16 Sep 2010 13:29:04 +0000 Subject: [PATCH] Parsing fusion image from command line --- vv/vv.cxx | 7 ++++++- vv/vvMainWindow.cxx | 8 +++++--- vv/vvMainWindow.h | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/vv/vv.cxx b/vv/vv.cxx index d06d05c..71974f1 100644 --- 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; } diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index d65be28..4c8564f 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -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( diff --git a/vv/vvMainWindow.h b/vv/vvMainWindow.h index d4f23b1..27c0861 100644 --- a/vv/vvMainWindow.h +++ b/vv/vvMainWindow.h @@ -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); -- 2.45.1