main.cxx

Go to the documentation of this file.
00001 #include <creaImageIOSystem.h>
00002 #include <creaWx.h>
00003 #include <creaImageIOWxGimmickReaderDialog.h>
00004 
00005 #include <creaVtkBasicSlicer.h>
00006 
00007 class myApp : public wxApp
00008 {
00009 public:
00010   bool OnInit( );
00011   int  OnExit() { return true; }
00012 };
00013 
00014 IMPLEMENT_APP(myApp);
00015 
00016 CREA_WXMAIN_WITH_CONSOLE
00017 
00018 bool myApp::OnInit( )
00019 {        
00020   wxApp::OnInit();
00021 #ifdef __WXGTK__
00022   //See http://www.wxwindows.org/faqgtk.htm#locale
00023   setlocale(LC_NUMERIC, "C");
00024 #endif
00025    wxInitAllImageHandlers();
00026 
00027    
00028    creaImageIO::SetGimmickMessageLevel(5);
00029    creaImageIO::SetGimmickDebugMessageLevel(0);
00030    
00031 
00032    int min_dim = GIMMICK_2D_IMAGE_SELECTION;
00033    int max_dim = GIMMICK_3D_IMAGE_SELECTION;
00034    int output_dim = NATIVE;
00035    int threads = 1;
00036 
00037    creaImageIO::WxGimmickReaderDialog w(0,
00038                                         -1,
00039                                         _T("Select image(s)        - Gimmick! (c) CREATIS-LRMN 2008"),
00040                                         wxDefaultPosition,
00041                                         wxSize(810,750),
00042                                         min_dim,
00043                                         max_dim,
00044                                         output_dim,
00045                                         threads);
00046    w.ShowModal();
00047    
00048    if (w.GetReturnCode() == wxID_OK)
00049      {
00050        std::cout << "$$$$ main : user clicked 'OK' $$$$"<<std::endl;
00051        std::cout << "$$$$ selected files : "<<std::endl;
00052            //Puts filenames
00053        std::vector<std::string> s;
00054        w.GetSelectedFiles(s);
00055        std::vector<std::string>::iterator i;
00056        for (i=s.begin();i!=s.end();++i) 
00057          {
00058            std::cout << *i << std::endl;
00059          }
00060        std::cout << "$$$$ "<<std::endl;
00061 
00062            //Puts images
00063        std::vector<vtkImageData*> images;
00064            w.GetSelectedImages(images,output_dim);
00065            std::cout<<images.size()<<std::endl;
00066 
00067            crea::VtkBasicSlicer(images.front());
00068        images.front()->Delete();
00069            w.OnExit();
00070 
00071      }
00072    else if (w.GetReturnCode() == wxID_CANCEL)
00073      {
00074            w.OnExit();
00075        std::cout << "$$$$ main : user clicked 'CANCEL' $$$$"<<std::endl;
00076      }
00077    else 
00078      {
00079                  w.OnExit();
00080         std::cout << "$$$$ main : dialog ended without return code ! $$$$"
00081                   <<std::endl;
00082       
00083      }
00084 
00085    //   std::cout << "$$$$ main : deleting dialog"<<std::endl;
00086    //   delete w;
00087    std::cout << "$$$$$$$$$$$$$$$$$$$$ main ended "<<std::endl;
00088    return false;
00089 }
00090 
00091 

Generated on Mon Jun 22 10:49:30 2009 for CreaImageIO by  doxygen 1.5.3