OpenImageDialog.cxx

Go to the documentation of this file.
00001 
00002 #include "OpenImageDialog.h"
00003 #include "creaWx.h"
00004 
00005 typedef vtkImageData* (*GETIMAGEDATADIALOG)();
00006 
00007 namespace creaMaracasVisuKernel{
00008         OpenImageDialog::OpenImageDialog()
00009         {
00010                 img = NULL;
00011                 bool gimmicknotfound = true;
00012 
00013         #ifdef WIN32
00014                 HINSTANCE gimmickhandle;
00015                 gimmickhandle = LoadLibrary(TEXT("creaImageIO2.dll"));
00016                 std::cout<<"imagehandle "<<gimmickhandle<<std::endl;
00017                 if(gimmickhandle!=NULL){
00018 
00019                         GETIMAGEDATADIALOG getImageDataDialog;
00020 
00021                         getImageDataDialog = (GETIMAGEDATADIALOG)GetProcAddress(gimmickhandle, "getImageDataDialog");
00022 
00023                         std::cout<<"imagedatadialog "<<getImageDataDialog<<std::endl;
00024 
00025                         if(getImageDataDialog!=NULL){
00026                                 img = getImageDataDialog();
00027                                 gimmicknotfound = false;
00028                         }
00029                 }
00030 
00031         #endif
00032 
00033                 if(gimmicknotfound){
00034 
00035                         wxFileDialog* FD =
00036                           new wxFileDialog( 0, _T("Read Image"),wxEmptyString,wxEmptyString, _T("*.mhd"));
00037 
00038                         if (FD->ShowModal()==wxID_OK)
00039                         {
00040                                 std::string  path= crea::wx2std(FD->GetPath());
00041 
00042                                 vtkMetaImageReader *reader =  vtkMetaImageReader::New();
00043                                 reader->SetFileName(path.c_str());
00044                                 img = reader->GetOutput();
00045                         }
00046                 }
00047         }
00048 
00049         //-------------------------------------------------------------------
00050         OpenImageDialog::~OpenImageDialog()
00051         {
00052         }
00053 
00054         vtkImageData* OpenImageDialog::getImageData(){
00055                 return img;
00056         }
00057 }

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1