]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOWxGimmickView.cpp
Add GetSelectImagesInVector()
[creaImageIO.git] / src2 / creaImageIOWxGimmickView.cpp
index 3b8d507ff11a0e286cd3e6de1433c246f337bacb..ddf43617e16dad7484f5f54dfbba364caf1d3cbb 100644 (file)
@@ -49,7 +49,7 @@ namespace creaImageIO
         TOOL_SETTINGS_ID    = 7,
         TOOL_TOOLS_ID       = 8,
         TOOL_CREATEDB_ID    = 9,
-               TOOL_PACS_ID                    = 10
+        TOOL_PACS_ID        = 10
     };
   //======================================================================
 
@@ -117,23 +117,21 @@ namespace creaImageIO
 
     // Create the tool bar
     CreateToolBar(); 
-    sizer->Add( mToolBar ,0, wxGROW  ,0);
+    sizer->Add( mToolBar, 0, wxGROW, 0);
 
     // Split part below toolbar into notebook for views and panel
     // for preview, messages...
     mSplitter = new wxSplitterWindow( this , -1);
-   
+
     // Notebook
     mNotebook = new wxNotebook(mSplitter,
-                              -1,wxDefaultPosition, wxDefaultSize, 0);
+                              -1, wxDefaultPosition, wxDefaultSize, 0);
 
     //Gimmick
     mGimmick=gimmick;
 
-      
-    mSelectionMaxDimension= max_dim;
-    mSelectionMinDimension= min_dim;
+    mSelectionMaxDimension = max_dim;
+    mSelectionMinDimension = min_dim;
     
     // Create the views
     CreateTreeViews();
@@ -173,14 +171,14 @@ namespace creaImageIO
     mSplitter->SplitHorizontally( mNotebook, mBottomPanel, 
                                  top_minsize);
 
-    sizer->Add( mSplitter,1,wxGROW  ,0);
+    sizer->Add( mSplitter, 1, wxGROW, 0);
 
     mProgressDialog=0;
     SetSizer( sizer );     
     SetAutoLayout(true);
     Layout();
     mListener=new Listener();
-    mListener->ConnectObserver(boost::bind( &WxGimmickView::OnDriveMount , this, _1 ) );
+    mListener->ConnectObserver(boost::bind( &WxGimmickView::OnDriveMount, this, _1 ) );
     mListener->Create();
     mListener->Run();
     mListener->Pause();
@@ -280,7 +278,7 @@ namespace creaImageIO
     GimmickMessage(2,"Creating the tree view for '"<<
                   name<<"'"<<std::endl);
     // Create the WxTreeView
-    WxTreeView* view = new WxTreeView(h,this,mNotebook,-1);
+    WxTreeView* view = new WxTreeView(h, this, mNotebook, -1);
 
     // TO DO : TEST THAT A VIEW WITH SAME NAME IS NOT
     // ALREADY IN THE MAP
@@ -296,7 +294,15 @@ namespace creaImageIO
   {
        std::vector<std::string> files;
        GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->GetSelectedAsString(files);
-       ReadImagesNotThreaded(s,files,dim);
+       ReadImagesNotThreaded(s, files, dim);
+  }
+
+  //======================================================================
+  void WxGimmickView::GetSelectedImagesInVector(std::vector<vtkImageData*>& s, int dim)
+  {
+       std::vector<std::string> files;
+       GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->GetSelectedAsString(files);
+       ReadImagesNotThreadedInVector(s, files, dim);
   }
   //======================================================================
 
@@ -325,17 +331,17 @@ namespace creaImageIO
 
     wxIcon icons[20];
     // should correspond to Icon_xxx enum
-    icons[Icon_accept] = wxIcon(accept_xpm);
-    icons[Icon_add] = wxIcon(add_xpm);
-    icons[Icon_folder_down] = wxIcon(folder_down_xpm);
-    icons[Icon_page_down] = wxIcon(page_down_xpm);
-    icons[Icon_remove] = wxIcon(remove_xpm);
-    icons[Icon_database_add] = wxIcon(database_add_xpm);
-    icons[Icon_help] = wxIcon(help_xpm);
-    icons[Icon_synchronize] = wxIcon(synchronize_xpm);
+    icons[Icon_accept]          = wxIcon(accept_xpm);
+    icons[Icon_add]             = wxIcon(add_xpm);
+    icons[Icon_folder_down]     = wxIcon(folder_down_xpm);
+    icons[Icon_page_down]       = wxIcon(page_down_xpm);
+    icons[Icon_remove]          = wxIcon(remove_xpm);
+    icons[Icon_database_add]    = wxIcon(database_add_xpm);
+    icons[Icon_help]            = wxIcon(help_xpm);
+    icons[Icon_synchronize]     = wxIcon(synchronize_xpm);
     icons[Icon_create_database] = wxIcon(create_database_xpm);
-    icons[Icon_settings] = wxIcon(settings_xpm);
-    icons[Icon_tools] = wxIcon(tools_xpm);
+    icons[Icon_settings]        = wxIcon(settings_xpm);
+    icons[Icon_tools]           = wxIcon(tools_xpm);
 
     //   unsigned int NbIcons = 8;
     // Make an image list containing small icons
@@ -392,8 +398,8 @@ namespace creaImageIO
                               1000,
                               this,
                               wxPD_ELAPSED_TIME |
-                              //                              wxPD_ESTIMATED_TIME | 
-                              //                              wxPD_REMAINING_TIME |
+                              // wxPD_ESTIMATED_TIME |
+                              // wxPD_REMAINING_TIME |
                               wxPD_CAN_ABORT );
 
        // TO DO : select the current tree handler
@@ -424,15 +430,13 @@ namespace creaImageIO
     
     if (FD->ShowModal()==wxID_OK)
     {
-
-       
        std::string dirname = wx2std (FD->GetPath());
        bool recurse =  isNeedRecursive(dirname);
        if (recurse)
        {
-             recurse = wxMessageBox(_T("Recurse into sub-directories ?"),  _T("Scan directory"),        wxYES_NO,this ) == wxYES ? true : false;
+             recurse = wxMessageBox(_T("Recurse into sub-directories ?"), _T("Scan directory"), wxYES_NO,this ) == wxYES ? true : false;
        }
-               
+
                wxBusyCursor busy;
                wxString title(_T("Adding directory"));
                if (recurse) 
@@ -444,24 +448,23 @@ namespace creaImageIO
                                        this,
                                        wxPD_ELAPSED_TIME | 
                                        wxPD_SMOOTH |
-                                       //                             wxPD_ESTIMATED_TIME | 
-                                       //                             wxPD_REMAINING_TIME |
+                                       // wxPD_ESTIMATED_TIME |
+                                       // wxPD_REMAINING_TIME |
                                        wxPD_CAN_ABORT );
-               
+
                mCurrentDirectory = FD->GetPath();  
                mGimmick->AddDir(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),dirname,recurse);
                mProgressDialog->Pulse(_T("Updating view..."));
-               
+
                UpdateTreeViewLevel(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),1);
                delete mProgressDialog;
                DisplayAddSummary();
-
          }
     mViewer->StartPlayer();
   }
 
 
-   //=================================================
+  //=================================================
   // Determines number of files potentially to add to database
    int WxGimmickView::NumberFilesToAdd(const std::string &dirpath, bool recursive)
   {
@@ -484,10 +487,9 @@ namespace creaImageIO
                }
          }
        return nb;
-
   }
 
-    //=================================================
+   //=================================================
    // Test a directory to know if contains sub-directory to analyze
   bool WxGimmickView::isNeedRecursive(std::string i_name)
   {
@@ -557,8 +559,6 @@ namespace creaImageIO
                  ClearSelection();
       }*/
        ReadImageThreaded(sel);
-
-    
    }
 
   //==================================================
@@ -676,7 +676,7 @@ namespace creaImageIO
        mViewer->RefreshIfNecessary();
        ResetExtent();
   }
-  
+
   //=================================================
  
   //=================================================
@@ -689,7 +689,7 @@ namespace creaImageIO
   }
   //=================================================
 
-  
+
   //=================================================
   void WxGimmickView::AddIgnoreFile(tree::Node* toRemove)
   {
@@ -764,6 +764,7 @@ namespace creaImageIO
     dial->SetSizer(siz);
     dial->ShowModal();
   }
+
   //=================================================
   void WxGimmickView::OnImportExport(wxCommandEvent &Event)
   {
@@ -857,7 +858,6 @@ namespace creaImageIO
                                        }       
                                }
                        }
-
                        else
                        {
                                wxMessageBox(_T("One or both of the directory fields are empty"),_T("Empty Fields"),wxOK,this);
@@ -866,9 +866,9 @@ namespace creaImageIO
        delete gimmickTools;
 #endif
        }
-
        mViewer->StartPlayer();
   }
+
   //=================================================
 
   void WxGimmickView::CreateSettingsDialog(wxNotebook* nb, wxDialog* dial)
@@ -1138,4 +1138,3 @@ namespace creaImageIO
 
 } // EO namespace creaImageIO
 
-