]> Creatis software - creaImageIO.git/blobdiff - appli/TestWxGimmickDialog/main.cxx
correction sur la sélection.
[creaImageIO.git] / appli / TestWxGimmickDialog / main.cxx
index 63b001ccc2345b5f17d3e91d6b3d17af19bf3cb2..8f5f0c8b31cf5a68c073f6654e7076237f6b9586 100644 (file)
@@ -1,6 +1,7 @@
 #include <creaImageIOSystem.h>
 #include <creaWx.h>
 #include <creaImageIOWxGimmickDialog.h>
+#include <creaVtkBasicSlicer.h>
 
 class myApp : public wxApp
 {
@@ -11,20 +12,7 @@ public:
 
 IMPLEMENT_APP(myApp);
 
-#if defined(_WIN32) 
-
-//  How to have a Console and wxWidgets
-//  http://www.wxwidgets.org/wiki/index.php/MSVC_Setup_Guide
-//   In Visual C++ 6 (7 should be similar), to create an application that is both a console application 
-//  (cout's to the console are visible) and has a wxWidgets GUI, 
-//  you need to use the linker option "/subsystem:console" and the following code:
-int main(int argc, char* argv[])
-{
-       return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
-}
-
-#endif // defined(_WIN32) 
-
+CREA_WXMAIN_WITH_CONSOLE
 
 bool myApp::OnInit( )
 {       
@@ -35,28 +23,37 @@ bool myApp::OnInit( )
 #endif
    wxInitAllImageHandlers();
 
+   int image_type = GIMMICK_3D_IMAGE_SELECTION;
    int threads = 1;
 
    creaImageIO::WxGimmickDialog w(0,
-                          -1,
-                          _T("WxGimmickDialog test"),
-                          wxDefaultPosition,
-                          wxSize(1200,800),
-                          threads);
+                                 -1,
+                                 _T("Select image(s)        - Gimmick! (c) CREATIS-LRMN 2008"),
+                                 wxDefaultPosition,
+                                 wxSize(1200,800),
+                                 image_type,
+                                 threads);
    w.ShowModal();
    
    if (w.GetReturnCode() == wxID_OK)
      {
+
        std::cout << "$$$$ main : user clicked 'OK' $$$$"<<std::endl;
        std::cout << "$$$$ selected files : "<<std::endl;
        std::vector<std::string> s;
-       w.GetSelectedImages(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;
+
+       std::vector<vtkImageData*> images;
+       w.GetSelectedImages(images);
+       crea::VtkBasicSlicer(images.front());
+       images.front()->Delete();
+   
      }
    else if (w.GetReturnCode() == wxID_CANCEL)
      {
@@ -68,7 +65,7 @@ bool myApp::OnInit( )
                  <<std::endl;
       
      }
-
+  
    //   std::cout << "$$$$ main : deleting dialog"<<std::endl;
    //   delete w;
    std::cout << "$$$$$$$$$$$$$$$$$$$$ main ended "<<std::endl;