]> Creatis software - creaContours.git/blobdiff - appli/wxContourGUIExample/wxContourGUIExample.cxx
*** empty log message ***
[creaContours.git] / appli / wxContourGUIExample / wxContourGUIExample.cxx
index 3b2b4231fcdf964bed0a69e20ff201f0780ce2d0..39dcc2d0cdf31c15bc4182242c1166fdad4ec628 100644 (file)
@@ -64,31 +64,7 @@ wxContourMainFrame* wxTheApplication::frame = 0;
 
 
 
-#if defined(_WIN32)
-#define CREACONTOUR_VALID_FILE_SEPARATOR_CHAR '\\'
-#else
-#define CREACONTOUR_VALID_FILE_SEPARATOR_CHAR '/'
-#endif
 
-//=========================================================================
-std::string GetExecutablePath()
-{
-    char name[PATH_MAX];
-       //EED    int err = get_app_path(name, PATH_MAX);
-       int err = crea::System::GetAppPath(name,PATH_MAX);
-    if (err) 
-       {
-               printf("Could not determine current executable path ?  ");  
-       }    
-    // remove the exe name
-    char *slash;               
-    slash = strrchr(name, CREACONTOUR_VALID_FILE_SEPARATOR_CHAR);
-    if (slash)
-       {
-               *slash = 0;
-       }
-    return name;
-}
 
 //=========================================================================
 //=========================================================================
@@ -120,7 +96,6 @@ bool wxTheApplication :: OnInit()
        int threads = 1;
 
        std::vector<vtkImageData*> images;
-
        creaImageIO::WxGimmickReaderDialog w(0,
                                                                                -1,
                                                                                "creaContours_Descriptor.dscp",
@@ -137,29 +112,53 @@ bool wxTheApplication :: OnInit()
 
 //JCP
        //std::string datadir(  crea::wx2std(GetExecutablePath()) );    
-       std::string datadir(  GetExecutablePath() );
+       std::string datadir(  crea::System::GetExecutablePath() );
 //JCP
+
+           #ifdef LINUX /* assume this is OSX */
+                  datadir=datadir+"/../share/creaContours";
+           #endif // MACOSX    
        
                #ifdef MACOSX /* assume this is OSX */
-                       datadir=datadir+"/../../..";
+                       datadir=datadir+"/../../../../share/creaContours";
                #endif // MACOSX        
                
                
-                       if(w.GetReturnCode() == wxID_OK)
-                       {
+               if(w.GetReturnCode() == wxID_OK)
+               {
                                std::vector<std::string> s;
                                w.GetSelectedFiles(s);
-                               std::vector<std::string>::iterator i;
-                               for (i=s.begin();i!=s.end();++i)
+
+
+//EED                  std::vector<std::string>::iterator i;
+//                             for (i=s.begin();i!=s.end();++i)
+//                             {
+//                                     std::cout << *i << std::endl;
+//                             }
+//                             std::cout << "$$$$ "<<std::endl;
+                               //w.GetSelectedImages(images);
+
+//EED31mai2010                         w.GetSelectedImages(images,output_dim);
+
+                               std::vector<creaImageIO::OutStrGimmick> out;
+                               std::vector<std::string> attr;
+//                             attr.push_back("D0028_0010");
+//                             attr.push_back("D0008_0023");
+//                             attr.push_back("D0008_1070");
+                               w.getSelected(out, attr,true,"");
+ //                            std::cout<<out.size()<<std::endl;
+//                             crea::VtkBasicSlicer(out.front().img);
+                               int size=out.size();
+                               int ii;
+                               for (ii=0;ii<size;ii++)
                                {
-                                       std::cout << *i << std::endl;
+                                       images.push_back(out[ii].img);
                                }
-                               std::cout << "$$$$ "<<std::endl;
-                               //w.GetSelectedImages(images);
-                               w.GetSelectedImages(images,output_dim);
-                       }
-                       else if (w.GetReturnCode() == wxID_CANCEL)
-                       {
+
+
+               }
+               else if (w.GetReturnCode() == wxID_CANCEL)
+               {
                                vtkMetaImageReader *reader = vtkMetaImageReader::New();
                                std::string filename= datadir + "/data/hola.mhd";          
                                reader->SetFileName( filename.c_str() );