]> Creatis software - clitk.git/commitdiff
added new cmd line option: --landmarks
authorRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Thu, 6 Dec 2012 13:01:31 +0000 (14:01 +0100)
committerRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Thu, 6 Dec 2012 13:01:31 +0000 (14:01 +0100)
- guess what it does...

vv/vv.cxx
vv/vvLandmarksPanel.cxx
vv/vvLandmarksPanel.h
vv/vvMainWindow.cxx
vv/vvMainWindow.h

index 47057e4a0ed335cc3720cec279c5ffcfab6f9c29..d4ef1eac3e629e8d60a816b9aa984e246759d6c7 100644 (file)
--- a/vv/vv.cxx
+++ b/vv/vv.cxx
@@ -45,7 +45,7 @@
 #include <sys/stat.h>
 #include <errno.h>
 
-typedef enum {O_BASE,O_OVERLAY,O_FUSION,O_VF,O_CONTOUR} OpenModeType;
+typedef enum {O_BASE,O_OVERLAY,O_FUSION,O_VF,O_CONTOUR,O_LANDMARKS} OpenModeType;
 typedef enum {P_NORMAL,P_SEQUENCE,P_WINDOW,P_LEVEL} ParseModeType;
 
 void load_image_first_error()
@@ -195,6 +195,9 @@ int main( int argc, char** argv )
         } else if (current=="--fusion") {
           if (!n_image_loaded) load_image_first_error();
           open_mode = O_FUSION;
+        } else if (current=="--landmarks") {
+          if (!n_image_loaded) load_image_first_error();
+          open_mode = O_LANDMARKS;
         } else if (current == "--sequence") {
           if(open_mode==O_BASE) n_image_loaded++; //count only one for the whole sequence
           parse_mode=P_SEQUENCE;
@@ -273,6 +276,8 @@ int main( int argc, char** argv )
           window.AddDCStructContour(n_image_loaded-1,current.c_str());
         else if (open_mode==O_FUSION)
           window.AddFusionImage(n_image_loaded-1,current.c_str());
+        else if (open_mode==O_LANDMARKS)
+          window.AddLandmarks(n_image_loaded-1,current.c_str());
         open_mode = O_BASE;
       }
     }
index 83296ec3f9c8866635788380fc86518bcee08c90..46c7c0e80b12ddded4dd20da624208e50b950bcc 100644 (file)
@@ -48,7 +48,12 @@ void vvLandmarksPanel::Load()
   QString file = QFileDialog::getOpenFileName(this,tr("Load Landmarks"),
                  mCurrentPath.c_str(),tr("Landmarks ( *.txt *.pts)"));
   if (!file.isEmpty())
-    mCurrentLandmarks->LoadFile(file.toStdString());
+    LoadFromFile(file.toStdString());
+}
+
+void vvLandmarksPanel::LoadFromFile(std::string file)
+{
+  mCurrentLandmarks->LoadFile(file);
   SetCurrentLandmarks(mCurrentLandmarks,2);
   emit UpdateRenderWindows();
 }
index 9966d8820f6672802e8e597d5795c03ac1847c6a..d352a9a0f1077f99ac833292305d39c10c44d1ec 100644 (file)
@@ -41,6 +41,7 @@ public:
 
 public slots:
     void Load();
+    void LoadFromFile(std::string file);
     void Save();
     void RemoveSelectedPoints();
     void AddPoint();
index 1964b7e02335dcb744fd92e3a83d7efa7cfeea90..3980ef6f3eafd98004ec539807438f1e3cc674bf 100644 (file)
@@ -2159,7 +2159,18 @@ void vvMainWindow::AddFusionImage(int index, QString file)
     QMessageBox::information(this,tr("Problem reading Fusion !"),"File doesn't exist!");
 }
 //------------------------------------------------------------------------------
-
+//------------------------------------------------------------------------------
+void vvMainWindow::AddLandmarks(int index, QString file)
+{
+  if (QFile::exists(file))
+  {
+    landmarksPanel->LoadFromFile(file.toStdString());
+    landmarksPanel->SetCurrentPath(mInputPathName.toStdString());
+    landmarksPanel->SetCurrentImage(mSlicerManagers[index]->GetFileName().c_str());
+  }
+  else
+    QMessageBox::information(this,tr("Problem reading Landmarks !"),"File doesn't exist!");
+}
 
 //------------------------------------------------------------------------------
 void vvMainWindow::OpenField()
index e308314c59620094e59ac7bb778856154089283c..efcd6a26b41f8b7c89b5f6854f1ff730ad88ad8e 100644 (file)
@@ -57,7 +57,8 @@ class vvMainWindow: public vvMainWindowBase,
   void AddOverlayImage(int index, std::vector<std::string> fileNames, vvImageReader::LoadedImageType type);
   void AddFusionImage(int index, QString filename);
   void AddROI(int index, QString filename);
-  ///Adds a mesh to a SlicerManager, with optional warping by vector field
+  void AddLandmarks(int index, QString file);
+///Adds a mesh to a SlicerManager, with optional warping by vector field
   void AddContour(int image_index, vvMesh::Pointer contour, bool propagation);
   ///This is used to show an image when opened or computed
   void ShowLastImage();