]> Creatis software - clitk.git/commitdiff
Open overlay sequence as sequence
authorSimon Rit <simon.rit@creatis.insa-lyon.fr>
Wed, 5 Sep 2012 16:13:08 +0000 (18:13 +0200)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Wed, 5 Sep 2012 16:13:08 +0000 (18:13 +0200)
vv/vv.cxx
vv/vvMainWindow.cxx
vv/vvMainWindow.h
vv/vvReadState.cxx
vv/vvSlicerManager.cxx
vv/vvSlicerManager.h

index 1d43584bd3a64b125a71f80e46f151b87314de7f..ef8d0259bfa2bba32e0c361b8db4b46daa8c50d7 100644 (file)
--- a/vv/vv.cxx
+++ b/vv/vv.cxx
@@ -127,8 +127,8 @@ int main( int argc, char** argv )
           if(open_mode==O_BASE)
             window.LoadImages(sequence_filenames, vvImageReader::MERGEDWITHTIME);
           else if (open_mode==O_OVERLAY)
-            window.AddOverlayImage(n_image_loaded-1,sequence_filenames);
-          else{
+            window.AddOverlayImage(n_image_loaded-1,sequence_filenames,vvImageReader::IMAGE);
+          else {
             std::cerr << "Sequences are not managed for opening " << open_mode_names[open_mode] << std::endl;
             exit(1);
           }
@@ -176,9 +176,9 @@ int main( int argc, char** argv )
         } else if (current == "--level") {
           parse_mode=P_LEVEL;
         } else if (current == "--linkall") {
-                                       link_images = true;
-                               }
-                               else if (current == "--log") {
+         link_images = true;
+       }
+       else if (current == "--log") {
           std::string log_dir = QDir::tempPath().toStdString() + std::string("/vv-log");
 
           if(itksys::SystemTools::FileExists(log_dir.c_str()) &&
@@ -229,7 +229,7 @@ int main( int argc, char** argv )
         else if (open_mode==O_VF)
           window.AddField(current.c_str(), n_image_loaded-1);
         else if (open_mode==O_OVERLAY)
-          window.AddOverlayImage(n_image_loaded-1,image);
+          window.AddOverlayImage(n_image_loaded-1,image,vvImageReader::IMAGE);
         else if (open_mode==O_CONTOUR)
           window.AddDCStructContour(n_image_loaded-1,current.c_str());
         else if (open_mode==O_FUSION)
@@ -241,8 +241,8 @@ int main( int argc, char** argv )
       if(open_mode==O_BASE)
         window.LoadImages(sequence_filenames, vvImageReader::MERGEDWITHTIME);
       else if (open_mode==O_OVERLAY)
-        window.AddOverlayImage(n_image_loaded-1,sequence_filenames);
-      else{
+        window.AddOverlayImage(n_image_loaded-1,sequence_filenames, vvImageReader::MERGEDWITHTIME);
+      else {
         std::cerr << "Sequences are not managed for opening " << open_mode_names[open_mode] << std::endl;
         exit(1);
       }
@@ -256,8 +256,8 @@ int main( int argc, char** argv )
     window.ApplyWindowLevelToAllImages();
   }
 
-       if (link_images)
-               window.LinkAllImages();
+  if (link_images)
+    window.LinkAllImages();
 
   int ret = app.exec();
   
index d42d11ce44a958f1c84ea2077bcf935e4ce3d2a0..e82590e4f02435ce0058cbeb90d2c671b6af3e59 100644 (file)
@@ -1866,12 +1866,12 @@ void vvMainWindow::SelectOverlayImage()
   for (int i = 0; i < files.size(); i++) {
     vecFileNames.push_back(files[i].toStdString());
   }
-  AddOverlayImage(index,vecFileNames);
+  AddOverlayImage(index,vecFileNames,vvImageReader::IMAGE);
 }
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvMainWindow::AddOverlayImage(int index, std::vector<std::string> fileNames)
+void vvMainWindow::AddOverlayImage(int index, std::vector<std::string> fileNames, vvImageReader::LoadedImageType type)
 {
   QString file(fileNames[0].c_str());
   if (QFile::exists(file))
@@ -1888,7 +1888,7 @@ void vvMainWindow::AddOverlayImage(int index, std::vector<std::string> fileNames
     qApp->processEvents();
 
     std::string filename = itksys::SystemTools::GetFilenameWithoutExtension(file.toStdString()).c_str();
-    if (mSlicerManagers[index]->SetOverlay(fileNames,dimension, component)) {
+    if (mSlicerManagers[index]->SetOverlay(fileNames,dimension, component,type)) {
       //create an item in the tree with good settings
       QTreeWidgetItem *item = new QTreeWidgetItem();
       item->setData(0,Qt::UserRole,file.toStdString().c_str());
index fa29b0ce5fd288f36c599188ea7d4cae4e1d60ca..015a468924ec6a1e9836d24aeae884352cd781b5 100644 (file)
@@ -54,7 +54,7 @@ class vvMainWindow: public vvMainWindowBase,
   void LoadImages(std::vector<std::string> filenames, vvImageReader::LoadedImageType type);
   vvSlicerManager * AddImage(vvImage::Pointer image,std::string filename);
   void AddField(QString file,int index);
-  void AddOverlayImage(int index, std::vector<std::string> fileNames);
+  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
index 434f79939722ede476689baf28df07dc30c06e44..6d61ca5df6b8d0132fb75be64459bfe18bac46fe 100644 (file)
@@ -195,7 +195,7 @@ std::string vvReadState::ReadOverlay(int index)
           // TODO: manage sequence of images
           std::vector<std::string> vec;
           vec.push_back(file.c_str());
-          m_Window->AddOverlayImage(index, vec);
+          m_Window->AddOverlayImage(index, vec, vvImageReader::IMAGE);
         }
       }
       if (value == "OverlayColorWindow") {
index 9a51c4b0a427cc5bb950cae079c77853f0662287..bc03ebd7f715f4f56bc9f8069b1e8207c5abc89d 100644 (file)
@@ -242,18 +242,18 @@ bool vvSlicerManager::SetImages(std::vector<std::string> filenames, vvImageReade
 
 
 //----------------------------------------------------------------------------
-bool vvSlicerManager::SetOverlay(std::vector<std::string> filenames,int dim, std::string component)
+bool vvSlicerManager::SetOverlay(std::vector<std::string> filenames,int dim, std::string component, vvImageReader::LoadedImageType type)
 {
   mOverlayName = filenames[0];
   mOverlayComponent = component;
   if (dim > mImage->GetNumberOfDimensions()) {
-    mLastError = " Overlay dimension cannot be greater then reference image!";
+    mLastError = " Overlay dimension cannot be greater than reference image!";
     return false;
   }
   if (mOverlayReader.IsNull())
     mOverlayReader = vvImageReader::New();
   mOverlayReader->SetInputFilenames(filenames);
-  mOverlayReader->Update(mImage->GetNumberOfDimensions(),component.c_str(),mType);
+  mOverlayReader->Update(type);
   if (mOverlayReader->GetLastError().size() == 0) {
     for ( unsigned int i = 0; i < mSlicers.size(); i++) {
       mSlicers[i]->SetOverlay(mOverlayReader->GetOutput());
index c5ce55cf952906cd097a98ae1032b3d62e76fff8..088df6171a39d2fa7467b63ff42843d86e448271 100644 (file)
@@ -64,7 +64,7 @@ class vvSlicerManager : public QObject {
   void SetImage(vvImage::Pointer image);
   bool SetImages(std::vector<std::string> filenames, vvImageReader::LoadedImageType type, int n=0);
 
-  bool SetOverlay(std::vector<std::string> filenames, int dim, std::string component);
+  bool SetOverlay(std::vector<std::string> filenames, int dim, std::string component, vvImageReader::LoadedImageType type);
   bool SetFusion(std::string filename, int dim, std::string component);
   ///Set a VF by loading it from the disk
   bool SetVF(std::string filename);