Go to the documentation of this file.00001 #include <creaImageIOSystem.h>
00002 #include <creaWx.h>
00003 #include <creaImageIOWxGimmickReaderDialog.h>
00004 #include "vtkMetaImageWriter.h"
00005 #include "vtkMetaImageReader.h"
00006 #include <creaVtkBasicSlicer.h>
00007
00008
00009
00010
00011
00012
00013
00014
00017
00019
00020
00021
00022 class myApp : public wxApp
00023 {
00024 public:
00025 bool OnInit( );
00026 int OnExit() { return true; }
00027 };
00028
00029 IMPLEMENT_APP(myApp);
00030
00031 CREA_WXMAIN_WITH_CONSOLE
00032
00033
00034
00035 bool myApp::OnInit( )
00036 {
00037 wxApp::OnInit();
00038 #ifdef __WXGTK__
00039
00040 setlocale(LC_NUMERIC, "C");
00041 #endif
00042 wxInitAllImageHandlers();
00043
00044 creaImageIO::SetGimmickMessageLevel(5);
00045 creaImageIO::SetGimmickDebugMessageLevel(0);
00046
00047 int min_dim = GIMMICK_2D_IMAGE_SELECTION;
00048 int max_dim = GIMMICK_3D_IMAGE_SELECTION;
00049
00050
00051
00052 int output_dim = _3D;
00053
00054 int threads = 1;
00055
00056 creaImageIO::WxGimmickReaderDialog w(
00057 0,
00058 -1,
00059 "localdatabase_Descriptor.dscp",
00060 "Local Database",
00061 _T("Select image(s) - creaImageIOApp (c) CREATIS ( cnrs)"),
00062 wxDefaultPosition,
00063 wxSize(810,750),
00064 min_dim,
00065 max_dim,
00066 output_dim,
00067
00068 threads);
00069
00070
00071
00072 w.ShowModal();
00073
00074 if (w.GetReturnCode() == wxID_OK)
00075 {
00076 std::cout << "$$$$ main : user clicked 'OK' $$$$"<<std::endl;
00077 std::cout << "$$$$ selected files : "<<std::endl;
00078
00079 std::vector<std::string> s;
00080 w.GetSelectedFiles(s);
00081 std::vector<std::string>::iterator i;
00082 for (i=s.begin();i!=s.end();++i)
00083 {
00084 std::cout << *i << std::endl;
00085 }
00086 std::cout << "$$$$ "<<std::endl;
00087
00088
00089 std::vector<vtkImageData*> images;
00090 w.GetSelectedImages(images,3);
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 std::vector<creaImageIO::OutStrGimmick> out;
00117 std::vector<std::string> attr;
00118 attr.push_back("D0028_0010");
00119 attr.push_back("D0008_0023");
00120 attr.push_back("D0008_1070");
00121 w.getSelected(out, attr,true,"");
00122 std::cout<<out.size()<<std::endl;
00123 crea::VtkBasicSlicer(out.front().img);
00124 out.front().img->Delete();
00125 w.OnExit();
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152 crea::VtkBasicSlicer(out.front().img);
00153 images.front()->Delete();
00154 w.OnExit();
00155
00156 }
00157 else if (w.GetReturnCode() == wxID_CANCEL)
00158 {
00159
00160 w.OnExit();
00161 std::cout << "$$$$ main : user clicked 'CANCEL' $$$$"<<std::endl;
00162 }
00163 else
00164 {
00165 w.OnExit();
00166 std::cout << "$$$$ main : dialog ended without return code ! $$$$"
00167 <<std::endl;
00168 }
00169
00170
00171
00172
00173 std::cout << "$$$$$$$$$$$$$$$$$$$$ main ended "<<std::endl;
00174 return false;
00175 }