]> Creatis software - creaContours.git/blobdiff - appli/wxContourGUIExample/wxContourGUIExample.cxx
*** empty log message ***
[creaContours.git] / appli / wxContourGUIExample / wxContourGUIExample.cxx
index 39e109f67753a40681b0e66549e33cdef3ab33a2..9849c424834c19e768a347039e3e57682311a8d8 100644 (file)
@@ -5,31 +5,34 @@
 
 #include "wxContourGUIExample.h"
 #include "wxContourMainFrame.h"
-#include "OutlineModelManager.h"
-#include "wxContourEventHandler.h"
+//#include "OutlineModelManager.h"
+//#include "wxContourEventHandler.h"
 
-#include "wxContourMainPanel.h"
+
+#include <creaImageIOWxGimmickDialog.h>
+
+#include <creaVtkBasicSlicer.h>
+//#include "wxContourMainPanel.h"
 
 #include "vtkMetaImageReader.h"
 #include <map>
 #include "vtkImageData.h"
-#include "OutlineModelBuilder.h"
-#include "ContourThing.h"
-#include "AxeThing.h"
-#include "ImageSourceThing.h"
-#include "ImageSectionThing.h"
-#include "SomeEnvironment.h"
-#include "ReaderEnvironment.h"
 
 #include "wx/artprov.h"
 #include <wx/filedlg.h>
+//#include "OutlineModelBuilder.h"
+//#include "ContourThing.h"
+//#include "AxeThing.h"
+//#include "ImageSourceThing.h"
+//#include "ImageSectionThing.h"
+//#include "SomeEnvironment.h"
+//#include "ReaderEnvironment.h"
 
 
-#include "interfMainPanel.h"
 
-#include <creaImageIOWxGimmickDialog.h>
 
-#include <creaVtkBasicSlicer.h>
+//#include "interfMainPanel.h"
+
 
 wxContourMainFrame* wxTheApplication::frame = 0;
 //----------------------------------------------------------------------------------------------------------------
@@ -49,24 +52,24 @@ bool wxTheApplication :: OnInit()
        
 //-------------------------------------------------------------
 // Doing what is done by the bbtk boxes 
-       /*vtkMetaImageReader *reader = vtkMetaImageReader::New();
+       //vtkMetaImageReader *reader = vtkMetaImageReader::New();
 //     reader->SetFileName( "data\\hola.mhd" );
 //     reader->SetFileName( "C:/Program Files/bbtk-1.0/data/vtk/img02.maracas.mhd" );
 //     reader->SetFileName( "C:/Program Files/bbtk-1.0/data/vtk/test01.maracas.mhd" );
 //     reader->SetFileName( "C:/download/Elise/Elise_IRM_Helium/A/test01b.maracas.mhd" );
        
-       wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.mhd"), wxOPEN );
-       if (dialog.ShowModal() == wxID_OK)
-       {
-               std::string filename = (const char *)(dialog.GetPath().mb_str());
-               reader->SetFileName( filename.c_str() );
-       } else {
-               reader->SetFileName( "data\\hola.mhd" );
+       //wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.mhd"), wxOPEN );
+       //if (dialog.ShowModal() == wxID_OK)
+       //{
+       //      std::string filename = (const char *)(dialog.GetPath().mb_str());
+       //      reader->SetFileName( filename.c_str() );
+       //} else {
+       //      reader->SetFileName( "data\\hola.mhd" );
 //             Halt(0);
-       }
-
-       reader->Update();*/
+       //}
 
+       //reader->Update();
+/*JCP 17-10-2008
        wxInitAllImageHandlers();
 
    int image_type = GIMMICK_3D_IMAGE_SELECTION;
@@ -128,8 +131,8 @@ bool wxTheApplication :: OnInit()
        
 //-------------------------------------------------------------
 
-       /*frame = new wxContourMainFrame(_builder->getImSourceEnv(), _builder->getImSectionEnv(), _builder->getAxesEnv(),  _builder->getContourEnv(),NULL, wxID_ANY, wxT("ROI Application Sample"), wxPoint(50,50), wxSize(800, 600)); 
-       frame->Show(TRUE);*/
+       //frame = new wxContourMainFrame(_builder->getImSourceEnv(), _builder->getImSectionEnv(), _builder->getAxesEnv(),  _builder->getContourEnv(),NULL, wxID_ANY, wxT("ROI Application Sample"), wxPoint(50,50), wxSize(800, 600)); 
+       //frame->Show(TRUE);
 
        //Creating the evtHandler of the panels
        wxContourEventHandler * eventHandler = new wxContourEventHandler();
@@ -138,7 +141,7 @@ bool wxTheApplication :: OnInit()
 //JCP 21 - 10 - 08
        //wxFrame* frame1 = new wxFrame(NULL, wxID_ANY, wxT("ROI Application  -    Evaluation version, 23 Oct 2008 -  Use limited to the research team (Creatis-LRMN)"), wxPoint(50,50), wxSize(800, 600) );
        wxFrame* frame1 = new wxFrame(NULL, wxID_ANY, wxT("ROI Application  -    Evaluation version, 23 Oct 2008 "), wxPoint(50,50), wxSize(800, 600) );
-       frame = new wxContourMainFrame( frame1, wxID_ANY, wxString(""), wxPoint(50,50), wxSize(800, 600) ); 
+       frame = new wxContourMainFrame( frame1, wxID_ANY, wxString(_T("")), wxPoint(50,50), wxSize(800, 600) ); 
                                                                        
        //frame = new wxContourMainFrame( NULL, wxID_ANY, wxT("ROI Application  -    Evaluation version, 17 Oct 2008 -  Use limited to the research team (Creatis-LRMN)"), wxPoint(50,50), wxSize(800, 600) ); 
        frame1->CreateStatusBar();
@@ -177,11 +180,11 @@ bool wxTheApplication :: OnInit()
 
        //frame->Show(TRUE);
        frame1->Show(TRUE);
-       /*JCP 17 - 10 - 08
-       if ( successConfiuration )
-       {
-               frame->Show(TRUE);
-       }*/
+       //JCP 17 - 10 - 08
+       //if ( successConfiuration )
+       //{
+       //      frame->Show(TRUE);
+       //}
        
 //     SetTopWindow(frame);
 
@@ -194,13 +197,66 @@ bool wxTheApplication :: OnInit()
        //pannew->addContourCheckBox("contour4");
 //JCP -- new Interface
 
+JCP 17-10-2008*/
+
+
+       wxInitAllImageHandlers();
+
+   int image_type = GIMMICK_3D_IMAGE_SELECTION;
+   int threads = 1;
+
+   creaImageIO::WxGimmickDialog w(0,
+                                 -1,
+                                 _T("WxGimmickDialog test"),
+                                 wxDefaultPosition,
+                                 wxSize(1200,800),
+                                 image_type,
+                                 threads);
+   w.ShowModal();
+   
+   //vtkImageData* selectedimage=NULL;
+   std::vector<vtkImageData*> images;
+       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){
+                  std::cout << *i << std::endl;
+          }
+               
+          std::cout << "$$$$ "<<std::endl;
+       w.GetSelectedImages(images);
+          //selectedimage = images[0];
+       //crea::VtkBasicSlicer(images.front());
+       //images.front()->Delete();
+
+       }else if (w.GetReturnCode() == wxID_CANCEL){
+          vtkMetaImageReader *reader = vtkMetaImageReader::New();
+          reader->SetFileName( "D:/CAT08/Datos/Imagenes/image06.mhd"); //"data/hola.mhd" );
+          reader->Update();
+          images.push_back(reader->GetOutput());
+       }else{        
+               return -1;
+       }   
+
+
+       wxFrame* frame1 = new wxFrame(NULL, wxID_ANY, wxT("ROI Application  -    Evaluation version, 23 Oct 2008 "), wxPoint(400,50), wxSize(800, 600) );
+       //frame = new wxContourMainFrame( frame1, wxID_ANY, wxString(_T("")), wxPoint(50,50), wxSize(800, 600), images ); 
+       frame = wxContourMainFrame::getInstance(frame1, wxID_ANY, wxString(_T("")), wxPoint(200,50), wxSize(800, 600), images );
+       frame1->CreateStatusBar();
+       frame1->Show(TRUE);
+
 
        return TRUE;
 }
 
+#if(WIN32)
 int main(int argc, char* argv[])                                       
   {                                                                    
     return WinMain(::GetModuleHandle(NULL), NULL,                      
                   ::GetCommandLine(), SW_SHOWNORMAL);                  
   }            
+#else
+#endif