1 /*=========================================================================
4 Module: creaMaracasVisu
7 =========================================================================*/
9 #include <vtkMetaImageReader.h>
10 #include "ManualPaintModel.h"
11 #include "wxManualPaintPanel.h"
18 // Define a new application type, each program should derive a class from wxApp
19 class MyApp : public wxApp
22 // this one is called on application startup and is a good place for the app
23 // initialization (doing it here and not in the ctor allows to have an error
24 // return: if OnInit() returns false, the application terminates)
25 virtual bool OnInit();
28 // Define a new frame type: this is going to be our main frame
29 class MyFrame : public wxFrame
33 MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
36 // event handlers (these functions should _not_ be virtual)
37 void OnQuit(wxCommandEvent& event);
41 // wxRenderWindow *MyRenderWindow;
45 // any class wishing to process wxWindows events must use this macro
49 // IDs for the controls and the menu commands
58 #define MY_VTK_WINDOW 102
60 // the event tables connect the wxWindows events with the functions (event
61 // handlers) which process them. It can be also done at run-time, but for the
62 // simple menu events like this the static method is much simpler.
63 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
64 EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
67 // Create a new application object: this macro will allow wxWindows to create
68 // the application object during program execution (it's better than using a
69 // static object for many reasons) and also declares the accessor function
70 // wxGetApp() which will return the reference of the right type (i.e. MyApp and
74 // 'Main program' equivalent: the program execution "starts" here
77 // create the main application window
78 MyFrame *frame = new MyFrame(_T("wxWindows-VTK App"),
79 wxPoint(50, 50), wxSize(450, 340));
81 // and show it (the frames, unlike simple controls, are not shown when
87 // success: wxApp::OnRun() will be called which will enter the main message
88 // loop and the application will run. If we returned FALSE here, the
89 // application would exit immediately.
94 MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
95 : wxFrame((wxFrame *)NULL, -1, title, pos, size)
98 vtkMetaImageReader *Reader=vtkMetaImageReader::New();
99 // Reader->SetFileName(argv[1]);
100 Reader->SetFileName("/home/valette/sphere.mhd");
104 ManualPaintModel *mpModel = new ManualPaintModel;
105 mpModel->SetImage(Reader->GetOutput());
107 wxManualPaintPanel *mpPanel = new wxManualPaintPanel(this);
108 mpPanel->SetManualPaintModel(mpModel);
110 MyRenderWindow=wxRenderWindow::New(this, MY_VTK_WINDOW);
112 vtkConeSource *pConeSource;
113 pConeSource = vtkConeSource::New();
114 pConeSource->SetResolution(800);
116 MyRenderWindow->SetInput(pConeSource->GetOutput());
117 pConeSource->Delete();
118 RenderWindowWidgets *RWidgets= new RenderWindowWidgets(this, 1000,wxPanelNameStr,
119 wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS | wxNO_FULL_REPAINT_ON_RESIZE);
120 RWidgets->Show(TRUE);*/
130 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
132 // TRUE is to force the frame to close
136 int main( int argc, char *argv[] )
139 vtkMetaImageReader *Reader=vtkMetaImageReader::New();
140 Reader->SetFileName(argv[1]);
144 ManualPaintModel *mpModel = new ManualPaintModel;
145 mpModel->SetImage(Reader->GetOutput());
147 wxManualPaintPanel *mpPanel = new wxManualPaintPanel;
148 mpPanel->SetManualPaintModel(mpModel);