2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
27 /*=========================================================================
30 Module: creaMaracasVisu
33 =========================================================================*/
35 #include <vtkMetaImageReader.h>
36 #include "ManualPaintModel.h"
37 #include "wxManualPaintPanel.h"
44 // Define a new application type, each program should derive a class from wxApp
45 class MyApp : public wxApp
48 // this one is called on application startup and is a good place for the app
49 // initialization (doing it here and not in the ctor allows to have an error
50 // return: if OnInit() returns false, the application terminates)
51 virtual bool OnInit();
54 // Define a new frame type: this is going to be our main frame
55 class MyFrame : public wxFrame
59 MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
62 // event handlers (these functions should _not_ be virtual)
63 void OnQuit(wxCommandEvent& event);
67 // wxRenderWindow *MyRenderWindow;
71 // any class wishing to process wxWindows events must use this macro
75 // IDs for the controls and the menu commands
84 #define MY_VTK_WINDOW 102
86 // the event tables connect the wxWindows events with the functions (event
87 // handlers) which process them. It can be also done at run-time, but for the
88 // simple menu events like this the static method is much simpler.
89 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
90 EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
93 // Create a new application object: this macro will allow wxWindows to create
94 // the application object during program execution (it's better than using a
95 // static object for many reasons) and also declares the accessor function
96 // wxGetApp() which will return the reference of the right type (i.e. MyApp and
100 // 'Main program' equivalent: the program execution "starts" here
103 // create the main application window
104 MyFrame *frame = new MyFrame(_T("wxWindows-VTK App"),
105 wxPoint(50, 50), wxSize(450, 340));
107 // and show it (the frames, unlike simple controls, are not shown when
108 // created initially)
113 // success: wxApp::OnRun() will be called which will enter the main message
114 // loop and the application will run. If we returned FALSE here, the
115 // application would exit immediately.
120 MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
121 : wxFrame((wxFrame *)NULL, -1, title, pos, size)
124 vtkMetaImageReader *Reader=vtkMetaImageReader::New();
125 // Reader->SetFileName(argv[1]);
126 Reader->SetFileName("/home/valette/sphere.mhd");
130 ManualPaintModel *mpModel = new ManualPaintModel;
131 mpModel->SetImage(Reader->GetOutput());
133 wxManualPaintPanel *mpPanel = new wxManualPaintPanel(this);
134 mpPanel->SetManualPaintModel(mpModel);
136 MyRenderWindow=wxRenderWindow::New(this, MY_VTK_WINDOW);
138 vtkConeSource *pConeSource;
139 pConeSource = vtkConeSource::New();
140 pConeSource->SetResolution(800);
142 MyRenderWindow->SetInput(pConeSource->GetOutput());
143 pConeSource->Delete();
144 RenderWindowWidgets *RWidgets= new RenderWindowWidgets(this, 1000,wxPanelNameStr,
145 wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS | wxNO_FULL_REPAINT_ON_RESIZE);
146 RWidgets->Show(TRUE);*/
156 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
158 // TRUE is to force the frame to close
162 int main( int argc, char *argv[] )
165 vtkMetaImageReader *Reader=vtkMetaImageReader::New();
166 Reader->SetFileName(argv[1]);
170 ManualPaintModel *mpModel = new ManualPaintModel;
171 mpModel->SetImage(Reader->GetOutput());
173 wxManualPaintPanel *mpPanel = new wxManualPaintPanel;
174 mpPanel->SetManualPaintModel(mpModel);