]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/OpenLoadImageDialog.cxx
open dialog y ya funciona el NV
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / OpenLoadImageDialog.cxx
1
2 #include "OpenLoadImageDialog.h"
3
4 typedef vtkImageData* (*GETIMAGEDATADIALOG)();
5
6 OpenLoadImageDialog::OpenLoadImageDialog()
7 {
8
9
10         img = NULL;
11         bool gimmicknotfound = true;
12         
13 #ifdef WIN32
14         HINSTANCE gimmickhandle; 
15         gimmickhandle = LoadLibrary(TEXT("creaImageIO2.dll"));  
16         if(gimmickhandle!=NULL){        
17
18                 
19                 GETIMAGEDATADIALOG getImageDataDialog;
20
21                 getImageDataDialog = (GETIMAGEDATADIALOG)GetProcAddress(gimmickhandle, "getImageDataDialog");
22
23                 std::cout<<"imagehandle "<<gimmickhandle<<std::endl;
24                 std::cout<<"imagedatadialog "<<getImageDataDialog<<std::endl;
25
26                 if(getImageDataDialog!=NULL){
27                         img = getImageDataDialog();
28                         gimmicknotfound = false;
29                 }
30         }       
31
32 #endif
33
34         if(gimmicknotfound){
35
36                 wxFileDialog* FD = 
37                   new wxFileDialog( 0, _T("Read Image"),wxEmptyString,wxEmptyString, _T("*.mhd"));
38                 
39                 if (FD->ShowModal()==wxID_OK)
40                 {
41                         std::string  path= FD->GetPath();
42
43                         vtkMetaImageReader *reader =  vtkMetaImageReader::New();        
44                         reader->SetFileName(path.c_str());              
45                         img = reader->GetOutput();              
46                 }               
47         }       
48
49
50         
51 }
52
53 //-------------------------------------------------------------------
54 OpenLoadImageDialog::~OpenLoadImageDialog()
55 {
56 }
57
58 vtkImageData* OpenLoadImageDialog::getImageData(){
59         return img;
60 }