]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOGimmickReaderDialog.cpp
*** empty log message ***
[creaImageIO.git] / src2 / creaImageIOGimmickReaderDialog.cpp
index d8c52e1d947fa096d9f26588aad5118b3d183b51..3bf6f22122bf2771be8343665cbc4f55b2b13277 100644 (file)
@@ -1,11 +1,95 @@
 #include <creaImageIOGimmickReaderDialog.h>
 #include <creaImageIOWxGimmickReaderDialog.h>
-#include <BlockScopeWxApp.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+
+CREAIMAGEIO_EXPORT vtkImageData* getImageDataDialog() {
+       //      wxApp::OnInit();
+       #ifdef __WXGTK__
+         //See http://www.wxwindows.org/faqgtk.htm#locale
+         setlocale(LC_NUMERIC, "C");
+       #endif
+          wxInitAllImageHandlers();
+
+          creaImageIO::SetGimmickMessageLevel(5);
+          creaImageIO::SetGimmickDebugMessageLevel(0);
+
+          int min_dim = GIMMICK_2D_IMAGE_SELECTION;
+          int max_dim = GIMMICK_3D_IMAGE_SELECTION;
+          int output_dim = NATIVE;
+          int threads = 1;
+
+          creaImageIO::WxGimmickReaderDialog w(
+                                               0,
+                                          -1, 
+                                          "localdatabase_Descriptor.dscp",
+                                          "Local Database",
+                                          _T("Select image(s)        - Gimmick! (c) CREATIS-LRMN 2008"),
+                                          wxDefaultPosition,
+                                          wxSize(810,750),
+                                          min_dim,
+                                          max_dim,
+                                          output_dim,
+                                          threads);
+          w.ShowModal();
+
+          if (w.GetReturnCode() == wxID_OK)
+                {
+                  std::cout << "$$$$ main : user clicked 'OK' $$$$"<<std::endl;
+                  std::cout << "$$$$ selected files : "<<std::endl;
+                  //Puts filenames
+                  std::vector<std::string> s;
+                  w.GetSelectedFiles(s);
+                  std::vector<std::string>::iterator i;
+                  for (i=s.begin();i!=s.end();++i) 
+                        {
+                          std::cout << *i << std::endl;
+                        }
+                  std::cout << "$$$$ "<<std::endl;
+
+                  //Puts images
+                  std::vector<vtkImageData*> images;
+                  w.GetSelectedImages(images,output_dim);
+                  std::cout<<images.size()<<std::endl;
+
+                  w.OnExit();
+                  return images[0];
+
+                  //crea::VtkBasicSlicer(images.front());
+                  //images.front()->Delete();
+                  
+
+                }
+          else if (w.GetReturnCode() == wxID_CANCEL)
+                {
+                  w.OnExit();
+                  std::cout << "$$$$ main : user clicked 'CANCEL' $$$$"<<std::endl;
+                }
+          else 
+                {
+                  w.OnExit();
+                  std::cout << "$$$$ main : dialog ended without return code ! $$$$"
+                                        <<std::endl;    
+                }
+
+          //   std::cout << "$$$$ main : deleting dialog"<<std::endl;
+          //   delete w;
+          std::cout << "$$$$$$$$$$$$$$$$$$$$ main ended "<<std::endl;
+          return NULL;
+       }
+//             
 
 namespace creaImageIO
 {
+       
 
   bool GimmickReaderDialog(std::vector<vtkImageData*>& images,
+                          const std::string i_namedescp , 
+                          const std::string i_namedb ,
                           const std::string& title,
                           int posx, 
                           int posy,
@@ -16,10 +100,11 @@ namespace creaImageIO
                           int image_out_dim,
                           int nb_threads)
   {
-    BlockScopeWxApp app;
-    
+         
     creaImageIO::WxGimmickReaderDialog w(0,
                                         -1,
+                                        i_namedescp,
+                                        i_namedb,
                                         crea::std2wx(title),
                                         wxPoint(posx,posy),
                                         wxSize(sizex,sizey),