30 #include <bias_config.h>
33 #include <Gui/ImageCanvas.hh>
34 #include <Gui/StringConv.hh>
35 #include <Base/Image/ImageIO.hh>
43 class MyApp:
public wxApp
45 virtual bool OnInit();
50 class MyFrame: public wxFrame
54 MyFrame(
const wxString& title,
const wxPoint& pos,
const wxSize& size);
56 void OnQuit(wxCommandEvent& event);
57 void OnAbout(wxCommandEvent& event);
58 void OnLoad(wxCommandEvent& event);
67 MyFrame *frame =
new MyFrame( wxT(
"ImageCanvas"), wxPoint(50,50),
74 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
75 EVT_MENU(
ID_Quit, MyFrame::OnQuit)
77 EVT_MENU(ID_Load, MyFrame::OnLoad)
81 MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
82 : wxFrame((wxFrame *)NULL, -1, title, pos, size)
84 wxMenu *menuFile =
new wxMenu;
86 menuFile->Append( ID_About, wxT(
"&About...") );
87 menuFile->Append( ID_Load, wxT(
"&Load...") );
88 menuFile->AppendSeparator();
89 menuFile->Append( ID_Quit, wxT(
"E&xit") );
91 wxMenuBar *menuBar =
new wxMenuBar;
92 menuBar->Append(menuFile, wxT(
"&File"));
96 SetStatusText(wxT(
"ImageName"), 0);
98 wxBoxSizer *box=
new wxBoxSizer(wxVERTICAL);
100 box->Add(_ic, 1, wxALL| wxGROW |wxALIGN_CENTER, 5);
101 box->SetSizeHints(
this);
105 const string fn(BIAS_TESTS_DATA
"r4.jpg" );
109 cout<<
"could not load "<<fn<<endl;
110 wxMessageBox(_T(
"could not load image. aborting. ") );
113 SetStatusText(_T(
"image"), 0);
114 _ic->Show(im,
"image" );
118 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
121 void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
123 wxMessageBox(wxT(
"This is a wxWidgets Hello world sample"),
124 wxT(
"About Hello World"), wxOK | wxICON_INFORMATION,
this);
127 void MyFrame::OnLoad(wxCommandEvent& WXUNUSED(event))
129 wxFileDialog fileDialog(
this, wxT(
"Choose a file"), wxT(
"."), wxT(
"ucim.pgm"));
130 if (fileDialog.ShowModal() == wxID_OK){
131 string fname=WxToAscii(fileDialog.GetPath());
134 BIASERR(
"errro loading "<<fname);
136 SetStatusText(fileDialog.GetFilename(), 0);
137 _ic->Show(im, WxToAscii(fileDialog.GetFilename()));
140 cerr <<
"canceled loadin image" << endl;
display image in wx application, provides zoom and investigation functionality
static int Load(const std::string &FileName, ImageBase &img)
first tries a call to Read MIP image and if that fails, tries to Import Image with all other availabl...