]> Creatis software - creaContours.git/blobdiff - appli/wxContourGUIExample/wxContourGUIExample.cxx
Version with out wxEventHandler
[creaContours.git] / appli / wxContourGUIExample / wxContourGUIExample.cxx
index 9adaee30bea7d2a16e5b597bfff6d7571252f142..87ace3927871d229105a7da8c3324d3a7342d9af 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();
@@ -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,6 +197,56 @@ 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( "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;
 }