1 /*=========================================================================
4 Module: $RCSfile: wxMaracasFrame02.cxx,v $
6 Date: $Date: 2008/10/31 16:32:10 $
7 Version: $Revision: 1.1 $
9 Copyright: (c) 2002, 2003
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notice for more information.
16 =========================================================================*/
22 #include <wx/arrstr.h>
24 #include <vtkCommand.h>
25 #include <vtkImageChangeInformation.h>
26 #include <vtkImageCast.h>
27 #include <vtkImageData.h>
28 #include <vtkImageViewer2.h>
29 #include <vtkCamera.h>
30 #include <vtkRenderer.h>
35 #include "vtkGdcmReader.h"
38 #include "wxMaracasParametersDialog.h"
39 #include "wxMaracasDataBrowser.h"
40 #include "widgets/wxSTLWidget_02.h"
41 #include "widgets/wxSTLWidget_03.h"
42 #include "widgets/wxMPRWidget.h"
46 #include <wx/toolbar.h>
47 #include <wx/dialog.h>
48 #include <wx/colordlg.h>
49 #include <wx/listctrl.h>
50 #include <wx/textctrl.h>
52 // EED Borrame not used
53 #include "wxMaracasImageBrowser.h"
55 #include "wxMaracasHelpDialog.h"
56 #include "marDictionary.h"
57 #include "kernel/marImageData.h"
61 //using namespace std;
62 #include "wxMaracasFrame02.h"
64 #include "ILPD/src/controlerInterface/ILPDViewListPatient.h"
65 #include "ILPD/src/wxInterface/ILPDViewWxWindow.h"
68 // ----------------------------------------------------------------------------
69 // Maracas "logic world" headers
70 // ----------------------------------------------------------------------------
71 //#include <kernel/marInterface.h>
74 #include "res/bitmaps/connect.xpm"
75 #include "res/bitmaps/params.xpm"
76 #include "res/bitmaps/imagebrowser.xpm"
77 #include "res/bitmaps/3D.xpm"
78 #include "res/bitmaps/plans.xpm"
79 #include "res/bitmaps/quant.xpm"
80 #include "res/bitmaps/rotate.xpm"
81 #include "res/bitmaps/bright.xpm"
82 #include "res/bitmaps/pan.xpm"
83 #include "res/bitmaps/zoom.xpm"
84 #include "res/bitmaps/clear.xpm"
85 #include "res/bitmaps/intensity.xpm"
86 #include "res/bitmaps/help.xpm"
87 #include "res/bitmaps/stl.xpm"
88 #include "res/bitmaps/creatis_logo.xpm"
89 #include "res/bitmaps/MPR.xpm"
90 #include "res/bitmaps/Axis_JF.xpm"
91 #include "res/bitmaps/Axis_JF_MH1.xpm"
92 #include "res/bitmaps/Axis_JF_MH2.xpm"
93 #include "res/bitmaps/ProcessingCT.xpm"
94 #include "res/bitmaps/QuantificationCT.xpm"
95 #include "res/icons/maracas.xpm"
98 #include "res/bitmaps2/v2_bi_bl_CTQuantification.xpm"
99 #include "res/bitmaps2/v2_bi_bl_Information.xpm"
100 #include "res/bitmaps2/v2_bi_bl_IRMQuantification.xpm"
101 #include "res/bitmaps2/v2_bi_bl_ListPatient_Voi.xpm"
102 #include "res/bitmaps2/v2_bi_bl_Logo.xpm"
103 #include "res/bitmaps2/v2_bi_bl_ManualRegistration.xpm"
104 #include "res/bitmaps2/v2_bi_bl_Params.xpm"
105 #include "res/bitmaps2/v2_bi_bl_Processing.xpm"
106 #include "res/bitmaps2/v2_bi_bl_STLFormat.xpm"
107 #include "res/bitmaps2/v2_bi_bl_Tests.xpm"
108 #include "res/bitmaps2/v2_bi_bl_VascularTree.xpm"
109 #include "res/bitmaps2/v2_bi_mask.xpm"
110 #include "res/bitmaps2/v2_bi_re_CTQuantification.xpm"
111 #include "res/bitmaps2/v2_bi_re_IRMQuantification.xpm"
112 #include "res/bitmaps2/v2_bi_re_ListPatient_Voi.xpm"
113 #include "res/bitmaps2/v2_bi_re_Logo.xpm"
114 #include "res/bitmaps2/v2_bi_re_ManualRegistration.xpm"
115 #include "res/bitmaps2/v2_bi_re_Params.xpm"
116 #include "res/bitmaps2/v2_bi_re_Processing.xpm"
117 #include "res/bitmaps2/v2_bi_re_STLFormat.xpm"
118 #include "res/bitmaps2/v2_bi_re_Tests.xpm"
119 #include "res/bitmaps2/v2_bi_re_VascularTree.xpm"
120 #include "res/bitmaps2/v2_sm_bl_AddAllPatients.xpm"
121 #include "res/bitmaps2/v2_sm_bl_AddPatient.xpm"
122 #include "res/bitmaps2/v2_sm_bl_AxisExtraction.xpm"
123 #include "res/bitmaps2/v2_sm_bl_CreateDICOMDIR.xpm"
124 #include "res/bitmaps2/v2_sm_bl_ListPatient.xpm"
125 #include "res/bitmaps2/v2_sm_bl_MPR.xpm"
126 #include "res/bitmaps2/v2_sm_bl_OpenDICOMDIR.xpm"
127 #include "res/bitmaps2/v2_sm_bl_OpenDirectory.xpm"
128 #include "res/bitmaps2/v2_sm_bl_ProcessingCT.xpm"
129 #include "res/bitmaps2/v2_sm_bl_Processing.xpm"
130 #include "res/bitmaps2/v2_sm_bl_Quantification.xpm"
131 #include "res/bitmaps2/v2_sm_bl_STLFormat.xpm"
132 #include "res/bitmaps2/v2_sm_bl_TreeExtraction_JF_MH.xpm"
133 #include "res/bitmaps2/v2_sm_bl_voi.xpm"
134 #include "res/bitmaps2/v2_sm_mask.xpm"
135 #include "res/bitmaps2/v2_sm_re_ListPatient.xpm"
136 #include "res/bitmaps2/v2_sm_re_voi.xpm"
137 #include "res/bitmaps2/v2_sm_tr_MPR.xpm"
138 #include "res/bitmaps2/v2_sm_tr_Processing.xpm"
139 #include "res/bitmaps2/v2_sm_tr_Quantification.xpm"
140 #include "res/bitmaps2/v2_sm_tr_STLFormat.xpm"
141 #include "res/bitmaps2/v2_sm_tr_VOI.xpm"
149 BEGIN_EVENT_TABLE( wxMaracasFrame02, wxFrame )
150 EVT_MENU( ID_TOOLBAR_DATA_BROWSER , wxMaracasFrame02::OnLoadPatientData )
152 EVT_MENU( ID_TOOLBAR_PARAMETERS , wxMaracasFrame02::OnParameters )
153 EVT_MENU( ID_TOOLBAR_IMAGE_BROWSER , wxMaracasFrame02::OnLoadImageData02 )
154 EVT_MENU( ID_TOOLBAR_3D_BROWSER , wxMaracasFrame02::OnStartExperiment )
155 EVT_MENU( ID_TOOLBAR_HELP , wxMaracasFrame02::OnHelp )
156 EVT_MENU( ID_TOOLBAR_PLANS , wxMaracasFrame02::OnQuant )
158 EVT_MENU( ID_TOOLBAR_MPR , wxMaracasFrame02::OnMPR )
159 EVT_MENU( ID_TOOLBAR_PROCESSING_CT , wxMaracasFrame02::OnProcessingCT )
160 EVT_MENU( ID_TOOLBAR_QUANTIFICATION_CT, wxMaracasFrame02::OnQuantificationCT )
162 EVT_MENU( ID_TOOLBAR_EMPTY_PANEL , wxMaracasFrame02::OnEmptyPanel )
163 EVT_MENU( ID_TOOLBAR_EMPTY_PANEL_2 , wxMaracasFrame02::OnEmptyPanel_2 )
165 EVT_MENU( ID_TOOLBAR_STL , wxMaracasFrame02::OnStl )
166 EVT_CLOSE( wxMaracasFrame02::OnQuit )
168 // EED : This is not top !!!!!!!!!!!
169 EVT_TOOL( 19999 , wxMaracasFrame02::OnRegenerateAll )
170 EVT_TOOL( 19998 , wxMaracasFrame02::OnRegenerateSplineAxe )
171 EVT_TOOL( 19997 , wxMaracasFrame02::OnCleanContours )
172 EVT_TOOL( 19996 , wxMaracasFrame02::OnRegenerateSignal )
174 EVT_LIST_ITEM_ACTIVATED( ID_SERIES_LIST, wxMaracasFrame02::OnLoadImageData )
176 EVT_TOOL(wxSurfaceWidget::ID_BUTTON_NEW_AXIS, wxMaracasFrame02::OnNewAxis )
177 EVT_TOOL(wxSurfaceWidget::ID_BUTTON_DELETE_AXIS,wxMaracasFrame02::OnDeleteAxis )
180 //----------------------------------------------------------------------------
181 wxMaracasFrame02::wxMaracasFrame02( wxFrame *parent, wxWindowID id,
182 marInterface *mar, marInterfaceCT *marCT,
183 char *dictionaryFileName,
184 const wxString& title, const wxPoint& pos,
185 const wxSize& size, long style)
186 : wxFrame( parent, id, title, pos, size, style)
188 marDictionary marDict;
189 // marDict.LoadDictionary_French();
190 marDict.LoadDictionary_English();
191 // marDict.LoadDictionary_Japanese();
195 if (!marDict.LoadDictionaryFile(dictionaryFileName)){
196 wxMessageBox( _T("Error: File(s) marDict.txt not found..."),
197 _T("DxMM : MARACAS"), wxOK | wxCENTRE | wxICON_ERROR , this);
205 vtkObject *a = vtkObject::New();
206 a->GlobalWarningDisplayOff();
209 // At the begining, there were nothing, just a window...
210 _actual_panel = NULL;
212 // And the programmer said: let there be a status bar
213 this->CreateStatusBar( );
215 this->GetStatusBar()->SetFieldsCount( 2 );
217 this->GetStatusBar()->GetFieldRect(1, rect);
220 //_progressGauge = new wxGauge( this->GetStatusBar(), -1, 100);
221 // _progressGauge = new wxGauge( this->GetStatusBar(), -1, 50,
222 // rect.GetPosition(), rect.GetSize());
223 this->GetStatusBar()->Show();
224 this->PositionStatusBar();
226 // And an icon (to be unique)
227 //TODO change the icon to the real one!
228 this->SetIcon( wxICON( maracas_icon ) );
230 // And a toolbar (for dummy users)
231 this->RecreateToolbar( );
234 //----------------------------------------------------------------------------
235 void wxMaracasFrame02::RecreateToolbar( )
237 wxToolBar* toolBar = this->GetToolBar( );
239 this->SetToolBar( NULL );
241 toolBar = this->CreateToolBar( TOOLBAR_STYLE, ID_TOOLBAR );
244 wxBitmap toolBarBitmaps[ 28+1 ];
247 * wxBitmap vs. wxBITMAP -> add _xpm at the end of the file
249 toolBarBitmaps[ 0 ] = wxBITMAP( toolbar_connect );
250 toolBarBitmaps[ 4 ] = wxBITMAP( toolbar_params );
251 toolBarBitmaps[ 7 ] = wxBITMAP( toolbar_imagebrowser );
252 toolBarBitmaps[ 9 ] = wxBITMAP( toolbar_triD );
253 toolBarBitmaps[ 10 ] = wxBITMAP( toolbar_plans );
254 toolBarBitmaps[ 11 ] = wxBITMAP( toolbar_quant );
255 toolBarBitmaps[ 12 ] = wxBITMAP( toolbar_rotate );
256 toolBarBitmaps[ 13 ] = wxBITMAP( toolbar_bright );
257 toolBarBitmaps[ 14 ] = wxBITMAP( toolbar_pan );
258 toolBarBitmaps[ 15 ] = wxBITMAP( toolbar_zoom );
259 toolBarBitmaps[ 16 ] = wxBITMAP( toolbar_clear );
260 toolBarBitmaps[ 17 ] = wxBITMAP( toolbar_intensity );
261 toolBarBitmaps[ 20 ] = wxBITMAP( toolbar_help );
263 toolBarBitmaps[ 21 ] = wxBITMAP( vesselstoolbar_stl );
265 toolBarBitmaps[ 22 ] = wxBITMAP( creatis_logo );
266 toolBarBitmaps[ 23 ] = wxBITMAP( TOOLBAR_MPR );
267 toolBarBitmaps[ 24 ] = wxBITMAP( TOOLBAR_AXIS_JF );
268 toolBarBitmaps[ 25 ] = wxBITMAP( TOOLBAR_AXIS_JF_MH1 );
269 toolBarBitmaps[ 26 ] = wxBITMAP( TOOLBAR_AXIS_JF_MH2 );
270 toolBarBitmaps[ 27 ] = wxBITMAP( TOOLBAR_PROCESSINGCT );
271 toolBarBitmaps[ 28 ] = wxBITMAP( TOOLBAR_QUANTIFICATIONCT );
274 toolBarBitmaps[ 1 ] = wxBitmap( toolbar_loadexp );
275 toolBarBitmaps[ 2 ] = wxBitmap( toolbar_save );
276 toolBarBitmaps[ 3 ] = wxBitmap( toolbar_excel );
277 toolBarBitmaps[ 5 ] = wxBitmap( toolbar_wizard );
278 toolBarBitmaps[ 6 ] = wxBitmap( toolbar_back );
279 toolBarBitmaps[ 8 ] = wxBitmap( toolbar_subtract );
281 toolBarBitmaps[ 18 ] = wxBitmap( toolbar_linear );
282 toolBarBitmaps[ 19 ] = wxBitmap( toolbar_area );
284 // Set size & margins
285 toolBar->SetMargins( 4, 4 );
286 toolBar->SetToolBitmapSize( wxSize( toolBarBitmaps[ 0 ].GetWidth( ), toolBarBitmaps[ 0 ].GetHeight( ) ) );
289 toolBar->AddTool( ID_TOOLBAR_DATA_BROWSER, toolBarBitmaps[ 0 ], _T("Patient data"), _T("Load patient data: studies & series") );
290 toolBar->AddSeparator( );
291 toolBar->AddTool( ID_TOOLBAR_IMAGE_BROWSER, toolBarBitmaps[ 7 ], _T("Load image data"), _T("Load DICOM images from disk") );
292 toolBar->AddSeparator( );
293 toolBar->AddTool( ID_TOOLBAR_3D_BROWSER, toolBarBitmaps[ 9 ], _T("Start 3D"), _T("Load 3D representation") );
294 toolBar->AddSeparator( );
295 toolBar->AddTool( ID_TOOLBAR_PLANS, toolBarBitmaps[ 10 ], _T("Plan"), _T("Planes") );
296 toolBar->AddSeparator( );
297 toolBar->AddTool( ID_TOOLBAR_STL, toolBarBitmaps[ 21 ], _T("STL"), _T("Stl") );
298 toolBar->AddSeparator( );
302 //EED toolBar->AddTool( ID_TOOLBAR_QUANT, toolBarBitmaps[ 11 ], "Quant", "Quant" );
303 //EED toolBar->AddSeparator( );
304 //The following has been commented out temporarlily
306 toolBar->AddTool( ID_TOOLBAR_ROTATE, toolBarBitmaps[ 12 ], "Rotate", "Rotate" );
307 toolBar->AddSeparator( );
308 toolBar->AddTool( ID_TOOLBAR_BRIGHT, toolBarBitmaps[ 13 ], "Bright", "Bright" );
309 toolBar->AddSeparator( );
310 toolBar->AddTool( ID_TOOLBAR_PAN, toolBarBitmaps[ 14 ], "Pan", "Pan" );
311 toolBar->AddSeparator( );
312 toolBar->AddTool( ID_TOOLBAR_ZOOM, toolBarBitmaps[ 15 ], "Zoom", "Zoom" );
313 toolBar->AddSeparator( );
314 toolBar->AddTool( ID_TOOLBAR_CLEAR, toolBarBitmaps[ 16 ], "Clear", "Clear" );
315 toolBar->AddSeparator( );
316 toolBar->AddTool( ID_TOOLBAR_INTENSITY, toolBarBitmaps[ 17 ], "Intensity", "Intensity" );
317 toolBar->AddSeparator( );*/
318 toolBar->AddTool( ID_TOOLBAR_PARAMETERS , toolBarBitmaps[ 4 ] , _T("Parameters"), _T("Load parameters for modifying") );
319 toolBar->AddTool( ID_TOOLBAR_HELP , toolBarBitmaps[ 20 ] , _T("Help"), _T("Help") );
321 toolBar->AddSeparator( );
322 toolBar->AddTool( ID_TOOLBAR_MPR , toolBarBitmaps[ 23 ], _T("MPR"), _T("MPR") );
323 toolBar->AddTool( ID_TOOLBAR_PROCESSING_CT , toolBarBitmaps[ 27 ], _T("ProcessingCT"), _T("ProcessingCT") );
324 toolBar->AddTool( ID_TOOLBAR_QUANTIFICATION_CT , toolBarBitmaps[ 28 ], _T("QuantificationCT"), _T("QuantificationCT") );
325 toolBar->AddSeparator( );
326 toolBar->AddTool( ID_TOOLBAR_EMPTY_PANEL , toolBarBitmaps[ 24 ], _T("EmptyPanel"), _T("EmptyPanel") );
327 toolBar->AddTool( ID_TOOLBAR_EMPTY_PANEL_2 , toolBarBitmaps[ 26 ], _T("EmptyPanel_2"), _T("EmptyPanel_2") );
328 toolBar->AddSeparator( );
331 wxBitmapButton *btnCreatisLogo = new wxBitmapButton(toolBar,-1/*ID_BUTTON_ABOUTCREATIS*/,toolBarBitmaps[ 22 ] );
332 btnCreatisLogo->SetSize(81+10,20+10);
333 btnCreatisLogo->SetBackgroundColour(wxColour(0,0,153));
334 Connect(btnCreatisLogo->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasFrame02::OnAboutCreatis );
336 toolBar->AddControl(btnCreatisLogo);
339 toolBar->SetRows( 1 );
343 //----------------------------------------------------------------------------
344 void wxMaracasFrame02::OnAboutCreatis( wxCommandEvent& event ){
346 wxMaracasHelpDialog *dlg = new wxMaracasHelpDialog(this, -1, "Creatis", wxPoint(200,200), wxDefaultSize, wxDEFAULT_DIALOG_STYLE);
352 //----------------------------------------------------------------------------
353 void wxMaracasFrame02::OnQuit( wxCloseEvent& event ){
355 if( _actual_panel != NULL ) delete _actual_panel;
362 //----------------------------------------------------------------------------
363 void wxMaracasFrame02::OnLoadPatientData( wxCommandEvent& event )
366 wxToolBar* toolBar = this->GetToolBar( );
368 //wxToolBar::EnableTool This function should only be called after Realize.
369 toolBar->EnableTool(ID_TOOLBAR_IMAGE_BROWSER , true);
370 toolBar->EnableTool(ID_TOOLBAR_3D_BROWSER , false);
371 toolBar->EnableTool(ID_TOOLBAR_PLANS , false);
372 toolBar->EnableTool(ID_TOOLBAR_QUANT , false);
373 toolBar->EnableTool(ID_TOOLBAR_STL , false);
375 toolBar->EnableTool(ID_TOOLBAR_MPR , false);
376 toolBar->EnableTool(ID_TOOLBAR_PROCESSING_CT , false);
377 toolBar->EnableTool(ID_TOOLBAR_QUANTIFICATION_CT , false);
378 toolBar->EnableTool(ID_TOOLBAR_EMPTY_PANEL , false);
379 toolBar->EnableTool(ID_TOOLBAR_EMPTY_PANEL_2 , false );
383 if( _actual_panel != NULL ) delete _actual_panel;
388 ver esto para reconectar ILPD
389 wxMaracasFrame02::OnLoadPatientData
390 wxMaracasFrame02::OnLoadImageData02
391 wxMaracasApp02::OnInit
395 wxILPD* pnl = new wxILPD( this );
396 ILPDViewListPatient* _ilpdViewListPatient = new ILPDViewListPatient( new ILPDViewWxWindow(pnl) );
398 // wxMaracasDataBrowser* pnl = new wxMaracasDataBrowser( this, _mar, -1 );
403 // cf.: http://www.wxwindows.org/manuals/2.4.0/wx490.htm
404 // Force a resize. This should probably be replaced by a call to a wxFrame
405 // function that lays out default decorations and the remaining content window.
406 wxSizeEvent myevent(wxSize(-1, -1), this->GetId());
407 this->OnSize(myevent);
417 //----------------------------------------------------------------------------
418 void wxMaracasFrame02::OnParameters( wxCommandEvent& event )
420 wxMaracasParametersDialog *d = new wxMaracasParametersDialog( this, _mar );
425 // EED Borrme not used
426 //----------------------------------------------------------------------------
427 void wxMaracasFrame02::OnLoadImageData( wxListEvent& event ){
431 if( _actual_panel != NULL ) delete _actual_panel;
432 wxMaracasImageBrowser* pnl = new wxMaracasImageBrowser( this, _mar, -1 );
438 wxSizeEvent myevent(wxSize(-1, -1), this->GetId());
439 this->OnSize(myevent);
442 //wxDialog dialog(this, -1, "coucou");
443 //dialog.ShowModal();
445 //wxGauge gauge( this, -1, 50);
448 AS a first step I'll pass a wxGauge as parameter this doesn't
449 sound very good, should use EVT_TIMER instead...
451 _mar->_dicom->loadActualSerie( this->_progressGauge );
452 vtkImageData *dummy = _mar->_dicom->getVolume( )->castVtk();
454 //dummy->GetScalarRange( range );
456 pnl->LoadData( dummy );
457 //_view_image->ConstructVTK( (vtkImageData *)_mar->_dicom->getVolume( ));
458 //^ this is not working ??? I don't understand why, some VTK pipeline mystery
460 this->GetToolBar()->EnableTool(ID_TOOLBAR_IMAGE_BROWSER, false);
461 this->GetToolBar()->EnableTool(ID_TOOLBAR_3D_BROWSER, true);
463 this->GetToolBar()->EnableTool(ID_TOOLBAR_PLANS, false);
464 this->GetToolBar()->EnableTool(ID_TOOLBAR_STL, false);
466 //Add patient name to the frame title
467 this->SetTitle( _T("Patient Name : ") + _mar->_dicom->GetPatientName() );
471 //----------------------------------------------------------------------------
472 void wxMaracasFrame02::OnLoadImageData02( wxCommandEvent& event ){
477 wxILPD *wxilpd=(wxILPD*)_actual_panel;
478 vector <string*> lstStringFileName;
479 wxilpd->GetLstImageFiles(&lstStringFileName);
480 if (lstStringFileName.size()!=0)
482 marGdcmDicomILPD *margdcmdicomILPD = (marGdcmDicomILPD*)_mar->_dicom;
483 marGdcmDicomILPD *margdcmdicomILPD2 = (marGdcmDicomILPD*)_marCT->_dicom;
484 // margdcmdicomILPD->SetListImages( &lstStringFileName );
485 // margdcmdicomILPD2->SetListImages( &lstStringFileName );
489 if( _actual_panel != NULL ) delete _actual_panel;
490 wxMaracasImageBrowser02* pnl = new wxMaracasImageBrowser02( this, _mar->_dicom, _mar->_parameters );
496 wxSizeEvent myevent(wxSize(-1, -1), this->GetId());
497 this->OnSize(myevent);
499 _mar->_dicom->loadActualSerie( this->_progressGauge );
500 _marCT->_dicom->loadActualSerie( this->_progressGauge);
501 vtkImageData *dummy = _mar->_dicom->getVolume( )->castVtk();
502 pnl->LoadData( new marImageData(dummy) );
505 this->GetToolBar()->EnableTool(ID_TOOLBAR_IMAGE_BROWSER , false );
506 this->GetToolBar()->EnableTool(ID_TOOLBAR_3D_BROWSER , true );
507 this->GetToolBar()->EnableTool(ID_TOOLBAR_PLANS , false );
508 this->GetToolBar()->EnableTool(ID_TOOLBAR_STL , false );
509 this->GetToolBar()->EnableTool(ID_TOOLBAR_MPR , true );
510 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL , false );
511 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL_2 , true );
513 } // if lstStringFileName.size
517 //Add patient name to the frame title
519 // this->SetTitle( "Patient Name : " + _mar->_dicom->GetPatientName() );
524 //----------------------------------------------------------------------------
526 void wxMaracasFrame02::OnStartExperiment( wxCommandEvent& event )
530 if (((wxMaracasImageBrowser02*)_actual_panel )->GetRoiSelected()){
531 ((wxMaracasImageBrowser02*)_actual_panel )->ForceToFinisReadActiveImages( );
532 ((wxMaracasImageBrowser02*)_actual_panel )->GetROI( voi );
534 _mar->_experiment->setVOI( voi );
535 _mar->initExperiment( );
538 if( _actual_panel != NULL ) { delete _actual_panel; }
539 _wxmaracas3dbrowser = new wxMaracas3DBrowser( this, _mar, -1,ID_TOOLBAR_PLANS );
540 _actual_panel = _wxmaracas3dbrowser;
542 wxSizeEvent myevent(wxSize(-1, -1), this->GetId());
543 this->OnSize(myevent);
547 _wxmaracas3dbrowser->LoadData( );
549 //this->GetToolBar()->EnableTool(ID_TOOLBAR_DATA_BROWSER, false);
550 this->GetToolBar()->EnableTool(ID_TOOLBAR_IMAGE_BROWSER , true);
551 this->GetToolBar()->EnableTool(ID_TOOLBAR_3D_BROWSER , false);
552 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL , false );
553 this->GetToolBar()->EnableTool(ID_TOOLBAR_MPR , false );
554 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL , false );
555 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL_2 , false );
557 wxMessageDialog *msg =new wxMessageDialog(this, _T("VOI not selected"), _T("Warning"), wxOK );
562 //----------------------------------------------------------------------------
563 void wxMaracasFrame02::OnHelp (wxCommandEvent& event )
565 wxMaracasHelpDialog* help = new wxMaracasHelpDialog(this, -1);
568 //----------------------------------------------------------------------------
569 void wxMaracasFrame02::OnStl(wxCommandEvent& event ){
573 _wxmaracassurfaceSTLwidget = new wxSurfaceSTLWidget(this);
574 _wxmaracassurfaceSTLwidget->ShowMARACASData( _mar );
575 _actual_panel = _wxmaracassurfaceSTLwidget;
577 wxSizeEvent myevent(wxSize(-1, -1), this->GetId());
578 this->OnSize(myevent);
582 this->GetToolBar()->EnableTool(ID_TOOLBAR_PLANS , true );
583 this->GetToolBar()->EnableTool(ID_TOOLBAR_3D_BROWSER , false );
584 this->GetToolBar()->EnableTool(ID_TOOLBAR_STL , false );
585 this->GetToolBar()->EnableTool(ID_TOOLBAR_IMAGE_BROWSER , true );
586 this->GetToolBar()->EnableTool(ID_TOOLBAR_MPR , false );
587 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL , false );
588 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL_2 , false );
590 //----------------------------------------------------------------------------
591 void wxMaracasFrame02::OnQuant (wxCommandEvent& event )
594 _wxmaracasquantification = new wxMaracasQuantification( this, _mar, -1 );
595 _actual_panel = _wxmaracasquantification;
598 wxSizeEvent myevent(wxSize(-1, -1), this->GetId());
599 this->OnSize(myevent);
603 _wxmaracasquantification->LoadData( );
604 this->GetToolBar()->EnableTool(ID_TOOLBAR_PLANS, false);
605 this->GetToolBar()->EnableTool(ID_TOOLBAR_3D_BROWSER, false);
608 //----------------------------------------------------------------------------
609 void wxMaracasFrame02::OnQuantificationCT (wxCommandEvent& event )
612 _wxmaracasquantification_ct = new wxMaracasQuantificationCT( this, _marCT, -1 );
613 _actual_panel = _wxmaracasquantification;
616 wxSizeEvent myevent(wxSize(-1, -1), this->GetId());
617 this->OnSize(myevent);
621 _wxmaracasquantification_ct->LoadData( );
622 // this->GetToolBar()->EnableTool(ID_TOOLBAR_PLANS, false);
623 // this->GetToolBar()->EnableTool(ID_TOOLBAR_3D_BROWSER, false);
628 //----------------------------------------------------------------------------
629 void wxMaracasFrame02::OnMPR(wxCommandEvent& event ){
630 printf("EED wxMaracasFrame02::OnMPR A\n");
634 if (((wxMaracasImageBrowser02*)_actual_panel )->GetRoiSelected()){
635 ((wxMaracasImageBrowser02*)_actual_panel )->ForceToFinisReadActiveImages( );
636 ((wxMaracasImageBrowser02*)_actual_panel )->GetROI( voi );
638 _mar->_experiment->setVOI( voi );
639 _mar->initExperiment( );
641 _marCT->SetDicom(_mar->_dicom);
642 _marCT->initExperiment();
645 vtkImageData *imagedata;
646 imagedata = _marCT->getDynData( )->getVolume( )->castVtk();
647 marImageData *marimagedata = new marImageData(imagedata);
650 if( _actual_panel != NULL ) { delete _actual_panel; }
651 _wxMaracasMPR = new wxMaracasMPR( this, marimagedata ,_mar->_parameters->getVoxelSize() );
652 _wxMaracasMPR->ConfigureVTK();
654 _actual_panel = _wxMaracasMPR;
656 wxSizeEvent myevent(wxSize(-1, -1), this->GetId());
657 this->OnSize(myevent);
660 //this->GetToolBar()->EnableTool(ID_TOOLBAR_DATA_BROWSER, false);
661 this->GetToolBar()->EnableTool(ID_TOOLBAR_IMAGE_BROWSER , true );
662 this->GetToolBar()->EnableTool(ID_TOOLBAR_3D_BROWSER , false );
663 this->GetToolBar()->EnableTool(ID_TOOLBAR_MPR , false );
664 this->GetToolBar()->EnableTool(ID_TOOLBAR_PROCESSING_CT , true );
665 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL , true );
666 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL_2 , false );
668 wxMessageDialog *msg =new wxMessageDialog(this, _T("VOI not selected"), _T("Warning"), wxOK );
674 printf("EED wxMaracasFrame02::OnMPR B\n");
678 //----------------------------------------------------------------------------
679 void wxMaracasFrame02::OnEmptyPanel(wxCommandEvent& event )
684 vtkMPRBaseData *vtkmpr2DData = ((wxMaracasMPR*)_actual_panel )->GetVtkMPRBaseData();
685 vtkImageData *imagedata = vtkmpr2DData->GetImageData();
687 int x = (int)vtkmpr2DData->GetX();
688 int y = (int)vtkmpr2DData->GetY();
689 int z = (int)vtkmpr2DData->GetZ();
691 if( _actual_panel != NULL ) { delete _actual_panel; }
692 _wxMaracasEmptyPanel = new wxMaracasEmptyPanel(this);
693 _wxMaracasEmptyPanel->ConfigureVTK(imagedata, x , y , z );
695 _actual_panel = _wxMaracasEmptyPanel;
697 wxSizeEvent myevent(wxSize(-1, -1), this->GetId());
698 this->OnSize(myevent);
701 //this->GetToolBar()->EnableTool(ID_TOOLBAR_DATA_BROWSER, false);
702 this->GetToolBar()->EnableTool(ID_TOOLBAR_IMAGE_BROWSER , true );
703 this->GetToolBar()->EnableTool(ID_TOOLBAR_3D_BROWSER , false );
704 this->GetToolBar()->EnableTool(ID_TOOLBAR_MPR , false );
705 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL , false );
706 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL_2 , false );
711 vtkMPRBaseData *vtkmprbaseData = ((wxMaracasMPR*)_actual_panel )->GetVtkMPRBaseData();
713 vtkImageData *imagedata = vtkmprbaseData->GetImageData();
715 _mar->initExperiment( );
717 int x = vtkmprbaseData->GetX();
718 int y = vtkmprbaseData->GetY();
719 int z = vtkmprbaseData->GetZ();
721 if( _actual_panel != NULL ) { delete _actual_panel; }
722 _wxMaracasEmptyPanel = new wxMaracasEmptyPanel(this, _mar);
723 _wxMaracasEmptyPanel->ConfigureVTK(imagedata, x , y , z );
725 _actual_panel = _wxMaracasEmptyPanel;
727 wxSizeEvent myevent(wxSize(-1, -1), this->GetId());
728 this->OnSize(myevent);
731 //this->GetToolBar()->EnableTool(ID_TOOLBAR_DATA_BROWSER, false);
732 this->GetToolBar()->EnableTool(ID_TOOLBAR_IMAGE_BROWSER , true );
733 this->GetToolBar()->EnableTool(ID_TOOLBAR_3D_BROWSER , false );
734 this->GetToolBar()->EnableTool(ID_TOOLBAR_MPR , false );
735 this->GetToolBar()->EnableTool(ID_TOOLBAR_PLANS , true );
736 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL , false );
737 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL_2 , false );
741 //----------------------------------------------------------------------------
742 void wxMaracasFrame02::OnProcessingCT(wxCommandEvent& event )
744 printf("EED wxMaracasFrame02::OnProcessingCT \n");
746 vtkMPRBaseData *vtkmprbaseData = ((wxMaracasMPR*)_actual_panel )->GetVtkMPRBaseData();
748 marImageData *marimagedata = vtkmprbaseData->GetMarImageData();
750 _marCT->initExperiment( );
752 int x = (int)vtkmprbaseData->GetX();
753 int y = (int)vtkmprbaseData->GetY();
754 int z = (int)vtkmprbaseData->GetZ();
756 if( _actual_panel != NULL ) { delete _actual_panel; }
757 _wxMaracasProcessingCT = new wxMaracasProcessingCT(this, _marCT);
758 _wxMaracasProcessingCT->ConfigureVTK(marimagedata, x , y , z );
760 _actual_panel = _wxMaracasProcessingCT;
762 wxSizeEvent myevent(wxSize(-1, -1), this->GetId());
763 this->OnSize(myevent);
766 //this->GetToolBar()->EnableTool(ID_TOOLBAR_DATA_BROWSER, false);
767 this->GetToolBar()->EnableTool(ID_TOOLBAR_IMAGE_BROWSER , true );
768 this->GetToolBar()->EnableTool(ID_TOOLBAR_3D_BROWSER , false );
769 this->GetToolBar()->EnableTool(ID_TOOLBAR_MPR , false );
770 this->GetToolBar()->EnableTool(ID_TOOLBAR_PLANS , false );
771 this->GetToolBar()->EnableTool(ID_TOOLBAR_QUANTIFICATION_CT , true );
772 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL , false );
773 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL_2 , false );
778 //----------------------------------------------------------------------------
779 void wxMaracasFrame02::OnEmptyPanel_2(wxCommandEvent& event )
784 if (((wxMaracasImageBrowser02*)_actual_panel )->GetRoiSelected()){
785 ((wxMaracasImageBrowser02*)_actual_panel )->ForceToFinisReadActiveImages( );
786 ((wxMaracasImageBrowser02*)_actual_panel )->GetROI( voi );
788 _mar->_experiment->setVOI( voi );
789 _mar->initExperiment( );
792 if( _actual_panel != NULL ) { delete _actual_panel; }
793 _wxMaracasEmptyPanel_2 = new wxMaracasEmptyPanel_2(this,_mar);
794 _wxMaracasEmptyPanel_2->ConfigureVTK();
796 _actual_panel = _wxMaracasEmptyPanel_2;
798 wxSizeEvent myevent(wxSize(-1, -1), this->GetId());
799 this->OnSize(myevent);
802 //this->GetToolBar()->EnableTool(ID_TOOLBAR_DATA_BROWSER, false);
803 this->GetToolBar()->EnableTool(ID_TOOLBAR_IMAGE_BROWSER , true );
804 this->GetToolBar()->EnableTool(ID_TOOLBAR_3D_BROWSER , false );
805 this->GetToolBar()->EnableTool(ID_TOOLBAR_MPR , false );
806 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL , false );
807 this->GetToolBar()->EnableTool(ID_TOOLBAR_EMPTY_PANEL_2 , false );
809 wxMessageDialog *msg =new wxMessageDialog(this, _T("VOI not selected"), _T("Warning"), wxOK );
816 //----------------------------------------------------------------------------
817 void wxMaracasFrame02::OnNewAxis(wxCommandEvent &WXUNUSED(event))
819 this->GetToolBar()->EnableTool(ID_TOOLBAR_PLANS, true);
820 this->GetToolBar()->EnableTool(ID_TOOLBAR_STL, true);
822 //----------------------------------------------------------------------------
823 void wxMaracasFrame02::OnDeleteAxis(wxCommandEvent &WXUNUSED(event)){
824 this->GetToolBar()->EnableTool(ID_TOOLBAR_PLANS , false);
825 this->GetToolBar()->EnableTool(ID_TOOLBAR_STL , false);
827 //----------------------------------------------------------------------------
828 void wxMaracasFrame02::OnRegenerateAll( wxCommandEvent& event ){
829 if (_wxmaracas3dbrowser!=NULL) { _wxmaracas3dbrowser->RegenerateAll(true); }
830 if (_wxmaracasquantification!=NULL) { _wxmaracasquantification->RegenerateAll(true); }
832 //----------------------------------------------------------------------------
833 void wxMaracasFrame02::OnRegenerateSplineAxe( wxCommandEvent& event ){
834 if (_wxmaracas3dbrowser!=NULL) { _wxmaracas3dbrowser->RegenerateAll(false); }
835 if (_wxmaracasquantification!=NULL) { _wxmaracasquantification->RegenerateAll(false); }
837 //----------------------------------------------------------------------------
838 void wxMaracasFrame02::OnCleanContours( wxCommandEvent& event ){
839 if (_wxmaracasquantification!=NULL) { _wxmaracasquantification->CleanContours(); }
841 //----------------------------------------------------------------------------
842 void wxMaracasFrame02::OnRegenerateSignal( wxCommandEvent& event ){
843 if (_wxmaracasquantification!=NULL) { _wxmaracasquantification->RegenerateSignal(); }
845 //----------------------------------------------------------------------------
846 void wxMaracasFrame02::DeletePanels ( ){
847 delete _actual_panel;
848 _wxmaracasquantification = NULL;
849 _wxmaracas3dbrowser = NULL;
854 //----------------------------------------------------------------------------
855 //----------------------------------------------------------------------------
856 //----------------------------------------------------------------------------
859 wxProcessingImagesControl::wxProcessingImagesControl(wxWindow *parent)
860 : wxPanel (parent,-1)
862 wxBitmapButton *btnIRMQuant;
863 wxBitmapButton *btnCTQuant;
864 wxBitmapButton *btnSTL;
865 wxBitmapButton *btnManualRegistration;
866 wxBitmapButton *btnVascularTree;
867 wxBitmapButton *btnTests;
869 wxBitmap bitmapMask =wxBITMAP( TOOLBAR_V2_bi_mask );
871 wxBitmap toolBarBitmapsA[ 5+1 ];
872 wxBitmap toolBarBitmapsB[ 5+1 ];
874 toolBarBitmapsA[ 0 ] = wxBITMAP( TOOLBAR_V2_bi_bl_IRMQuantification );
875 toolBarBitmapsA[ 1 ] = wxBITMAP( TOOLBAR_V2_bi_bl_CTQuantification );
876 toolBarBitmapsA[ 2 ] = wxBITMAP( TOOLBAR_V2_bi_bl_VascularTree );
877 toolBarBitmapsA[ 3 ] = wxBITMAP( TOOLBAR_V2_bi_bl_STLFormat );
878 toolBarBitmapsA[ 4 ] = wxBITMAP( TOOLBAR_V2_bi_bl_Tests );
879 toolBarBitmapsA[ 5 ] = wxBITMAP( TOOLBAR_V2_bi_bl_ManualRegistration);
881 toolBarBitmapsA[0].SetMask( new wxMask(bitmapMask) );
882 toolBarBitmapsA[1].SetMask( new wxMask(bitmapMask) );
883 toolBarBitmapsA[2].SetMask( new wxMask(bitmapMask) );
884 toolBarBitmapsA[3].SetMask( new wxMask(bitmapMask) );
885 toolBarBitmapsA[4].SetMask( new wxMask(bitmapMask) );
886 toolBarBitmapsA[5].SetMask( new wxMask(bitmapMask) );
889 toolBarBitmapsB[ 0 ] = wxBITMAP( TOOLBAR_V2_bi_re_IRMQuantification );
890 toolBarBitmapsB[ 1 ] = wxBITMAP( TOOLBAR_V2_bi_re_CTQuantification );
891 toolBarBitmapsB[ 2 ] = wxBITMAP( TOOLBAR_V2_bi_re_VascularTree );
892 toolBarBitmapsB[ 3 ] = wxBITMAP( TOOLBAR_V2_bi_re_STLFormat );
893 toolBarBitmapsB[ 4 ] = wxBITMAP( TOOLBAR_V2_bi_re_Tests );
894 toolBarBitmapsB[ 5 ] = wxBITMAP( TOOLBAR_V2_bi_re_ManualRegistration);
896 toolBarBitmapsB[0].SetMask( new wxMask(bitmapMask) );
897 toolBarBitmapsB[1].SetMask( new wxMask(bitmapMask) );
898 toolBarBitmapsB[2].SetMask( new wxMask(bitmapMask) );
899 toolBarBitmapsB[3].SetMask( new wxMask(bitmapMask) );
900 toolBarBitmapsB[4].SetMask( new wxMask(bitmapMask) );
901 toolBarBitmapsB[5].SetMask( new wxMask(bitmapMask) );
904 // IRM Quantification
905 btnIRMQuant = new wxBitmapButton( this, -1, toolBarBitmapsA[ 0 ],wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_BOTTOM );
906 btnIRMQuant->SetBitmapSelected(toolBarBitmapsB[ 0 ]);
909 btnCTQuant = new wxBitmapButton( this, -1, toolBarBitmapsA[ 1 ],wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_BOTTOM );
910 btnCTQuant->SetBitmapSelected(toolBarBitmapsB[ 1 ]);
913 btnVascularTree = new wxBitmapButton( this, -1, toolBarBitmapsA[ 2 ],wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_BOTTOM );
914 btnVascularTree->SetBitmapSelected(toolBarBitmapsB[ 2 ]);
917 btnSTL = new wxBitmapButton( this, -1, toolBarBitmapsA[ 3 ],wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_BOTTOM );
918 btnSTL->SetBitmapSelected(toolBarBitmapsB[ 3 ]);
921 btnTests = new wxBitmapButton( this, -1, toolBarBitmapsA[ 4 ],wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_BOTTOM );
922 btnTests->SetBitmapSelected(toolBarBitmapsB[ 4 ]);
925 btnManualRegistration = new wxBitmapButton( this, -1, toolBarBitmapsA[ 5 ],wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_BOTTOM );
926 btnManualRegistration->SetBitmapSelected(toolBarBitmapsB[ 5 ]);
928 wxBoxSizer *sizer= new wxBoxSizer(wxHORIZONTAL);
929 sizer->Add( btnIRMQuant , 1, wxALL, 0);
930 sizer->Add( btnCTQuant , 1, wxALL, 0);
931 sizer->Add( btnVascularTree , 1, wxALL, 0);
932 sizer->Add( btnSTL , 1, wxALL, 0);
933 sizer->Add( btnManualRegistration , 1, wxALL, 0);
934 sizer->Add( btnTests , 1, wxALL, 0);
936 this->SetAutoLayout(true);
937 this->SetSizer(sizer);
940 Connect(btnIRMQuant->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxProcessingImagesControl::OnActiveIRMQuantificationFrame );
941 Connect(btnCTQuant->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxProcessingImagesControl::OnActiveCTQuantificationFrame );
942 Connect(btnVascularTree->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxProcessingImagesControl::OnActiveVascularTreeExtractionFrame );
943 Connect(btnSTL->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxProcessingImagesControl::OnActiveSTLFormatFrame );
944 Connect(btnManualRegistration->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxProcessingImagesControl::OnActiveTests2Frame );
945 Connect(btnTests->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxProcessingImagesControl::OnActiveTestsFrame );
948 //----------------------------------------------------------------------------
950 wxProcessingImagesControl::~wxProcessingImagesControl()
954 //----------------------------------------------------------------------------
955 void wxProcessingImagesControl::OnActiveIRMQuantificationFrame(wxCommandEvent& event)
957 wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,11112);
958 this->GetParent()->ProcessEvent(newevent);
959 // _wxmaracasframe03->CreateWindowMDI(20);
961 //----------------------------------------------------------------------------
962 void wxProcessingImagesControl::OnActiveCTQuantificationFrame(wxCommandEvent& event)
964 wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,11113);
965 this->GetParent()->ProcessEvent(newevent);
966 // _wxmaracasframe03->CreateWindowMDI(30);
968 //----------------------------------------------------------------------------
969 void wxProcessingImagesControl::OnActiveVascularTreeExtractionFrame(wxCommandEvent& event)
971 wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,11114);
972 this->GetParent()->ProcessEvent(newevent);
973 // _wxmaracasframe03->CreateWindowMDI(40);
975 //----------------------------------------------------------------------------
976 void wxProcessingImagesControl::OnActiveSTLFormatFrame(wxCommandEvent& event)
978 wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,11115);
979 this->GetParent()->ProcessEvent(newevent);
980 // _wxmaracasframe03->CreateWindowMDI(50);
982 //----------------------------------------------------------------------------
983 void wxProcessingImagesControl::OnActiveTestsFrame(wxCommandEvent& event)
985 wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,11116);
986 this->GetParent()->ProcessEvent(newevent);
987 // _wxmaracasframe03->CreateWindowMDI(60);
989 //----------------------------------------------------------------------------
990 void wxProcessingImagesControl::OnActiveTests2Frame(wxCommandEvent& event)
992 wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,11117);
993 this->GetParent()->ProcessEvent(newevent);
994 // _wxmaracasframe03->CreateWindowMDI(60);
999 //----------------------------------------------------------------------------
1000 //----------------------------------------------------------------------------
1001 //----------------------------------------------------------------------------
1004 wxProcessingImagesTabControl::wxProcessingImagesTabControl(wxWindow *parent,marInterface *mar,wxMaracasNoteBookPatientLstVoi *patientlstvoi)
1005 : wxPanel (parent,-1)
1009 _patientlstvoi = patientlstvoi;
1010 _irmQuantification = NULL;
1011 _ctQuantification = NULL;
1012 _vascularTreeExtraction = NULL;
1015 _noteBook = new wxNotebook(this, -1);
1016 _noteBook->SetSize(750,300);
1018 wxBitmap bitmapMask = wxBITMAP( TOOLBAR_V2_bi_mask );
1020 wxBitmap bitmap0 = wxBITMAP( TOOLBAR_V2_bi_bl_Information);
1021 wxBitmap bitmap1 = wxBITMAP( TOOLBAR_V2_bi_bl_IRMQuantification);
1022 wxBitmap bitmap2 = wxBITMAP( TOOLBAR_V2_bi_bl_CTQuantification);
1023 wxBitmap bitmap3 = wxBITMAP( TOOLBAR_V2_bi_bl_VascularTree);
1024 wxBitmap bitmap4 = wxBITMAP( TOOLBAR_V2_bi_bl_STLFormat);
1026 bitmap0.SetMask( new wxMask(bitmapMask) );
1027 bitmap1.SetMask( new wxMask(bitmapMask) );
1028 bitmap2.SetMask( new wxMask(bitmapMask) );
1029 bitmap3.SetMask( new wxMask(bitmapMask) );
1030 bitmap4.SetMask( new wxMask(bitmapMask) );
1032 wxImageList *imageList = new wxImageList(100,100);
1033 imageList->Add( bitmap0 ); // 0
1034 imageList->Add( bitmap1 ); // 1
1035 imageList->Add( bitmap2 ); // 2
1036 imageList->Add( bitmap3 ); // 3
1037 imageList->Add( bitmap4 ); // 4
1038 _noteBook->SetImageList(imageList);
1040 _noteBook->AddPage(new wxPanel(this,-1),_T("Information ") , true, 0 );
1041 _noteBook->AddPage(new wxPanel(this,-1),_T("IRM Quantification") , true, 1 );
1042 _noteBook->AddPage(new wxPanel(this,-1),_T("CT Quantification") , true, 2 );
1043 _noteBook->AddPage(new wxPanel(this,-1),_T("Vascular Tree") , true, 3 );
1044 _noteBook->AddPage(new wxPanel(this,-1),_T("STL Format") , true, 4 );
1045 _noteBook->SetSelection(0);
1047 Connect(_noteBook->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , (wxObjectEventFunction) &wxProcessingImagesTabControl::OnChangingPage );
1048 Connect(_noteBook->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , (wxObjectEventFunction) &wxProcessingImagesTabControl::OnChangePage );
1050 wxBoxSizer *sizer= new wxBoxSizer(wxVERTICAL);
1051 sizer->Add( _noteBook , 1, wxALL|wxEXPAND, 0);
1053 this->SetAutoLayout(true);
1054 this->SetSizer(sizer);
1058 //----------------------------------------------------------------------------
1060 wxProcessingImagesTabControl::~wxProcessingImagesTabControl()
1064 //----------------------------------------------------------------------------
1065 void wxProcessingImagesTabControl::OnChangingPage(wxNotebookEvent& event)
1068 //----------------------------------------------------------------------------
1069 void wxProcessingImagesTabControl::OnChangePage(wxNotebookEvent& event)
1072 if (_noteBook->GetSelection()==1)
1074 if (_irmQuantification==NULL){
1077 wxMaracasImageBrowser02 *imageBrowser= _patientlstvoi->GetWxMaracasImageBrowser02();
1078 imageBrowser->ForceToFinisReadActiveImages( );
1079 imageBrowser->GetROI( voi );
1080 _mar->_experiment->setVOI( voi );
1081 _irmQuantification = new wxMaracasNoteBookIRMQuantification(_noteBook->GetPage(page),_mar);
1082 wxBoxSizer *sizer= new wxBoxSizer(wxHORIZONTAL);
1083 sizer->Add( _irmQuantification , 1, wxALL|wxEXPAND, 0);
1084 _noteBook->GetPage(page)->SetAutoLayout(true);
1085 _noteBook->GetPage(page)->SetSizer(sizer);
1086 _noteBook->GetPage(page)->Layout();
1089 if (_noteBook->GetSelection()==2)
1091 if (_ctQuantification==NULL){
1094 wxMaracasImageBrowser02 *imageBrowser= _patientlstvoi->GetWxMaracasImageBrowser02();
1095 imageBrowser->ForceToFinisReadActiveImages( );
1096 imageBrowser->GetROI( voi );
1097 _mar->_experiment->setVOI( voi );
1098 string namefileParent=_patientlstvoi->GetRWCM_namefileVOI();
1099 _ctQuantification = new wxMaracasNoteBookCTQuantification(_noteBook->GetPage(page),_mar,namefileParent);
1100 wxBoxSizer *sizer= new wxBoxSizer(wxHORIZONTAL);
1101 sizer->Add( _ctQuantification , 1, wxALL|wxGROW, 0);
1102 _noteBook->GetPage(page)->SetAutoLayout(true);
1103 _noteBook->GetPage(page)->SetSizer(sizer);
1104 _noteBook->GetPage(page)->Layout();
1108 if (_noteBook->GetSelection()==3)
1110 if (_vascularTreeExtraction==NULL){
1113 wxMaracasImageBrowser02 *imageBrowser= _patientlstvoi->GetWxMaracasImageBrowser02();
1114 imageBrowser->ForceToFinisReadActiveImages( );
1115 imageBrowser->GetROI( voi );
1116 _mar->_experiment->setVOI( voi );
1117 _vascularTreeExtraction = new wxMaracasNoteBookVascularTreeExtraction(_noteBook->GetPage(page),_mar);
1118 wxBoxSizer *sizer= new wxBoxSizer(wxHORIZONTAL);
1119 sizer->Add( _vascularTreeExtraction , 1, wxALL|wxGROW, 0);
1120 _noteBook->GetPage(page)->SetAutoLayout(true);
1121 _noteBook->GetPage(page)->SetSizer(sizer);
1122 _noteBook->GetPage(page)->Layout();
1126 if (_noteBook->GetSelection()==4)
1128 if (_stlFormat==NULL){
1131 wxMaracasImageBrowser02 *imageBrowser= _patientlstvoi->GetWxMaracasImageBrowser02();
1132 imageBrowser->ForceToFinisReadActiveImages( );
1133 imageBrowser->GetROI( voi );
1134 _mar->_experiment->setVOI( voi );
1135 _stlFormat = new wxMaracasNoteBookSTLFormat(_noteBook->GetPage(page),_mar);
1136 wxBoxSizer *sizer= new wxBoxSizer(wxHORIZONTAL);
1137 sizer->Add( _stlFormat , 1, wxALL|wxGROW, 0);
1138 _noteBook->GetPage(page)->SetAutoLayout(true);
1139 _noteBook->GetPage(page)->SetSizer(sizer);
1140 _noteBook->GetPage(page)->Layout();
1147 //----------------------------------------------------------------------------
1148 //----------------------------------------------------------------------------
1149 //----------------------------------------------------------------------------
1152 BEGIN_EVENT_TABLE(wxMaracasFrame03, wxMDIParentFrame)
1154 // EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit)
1155 // EVT_MENU(MDI_REFRESH, MyChild::OnRefresh)
1156 // EVT_MENU(MDI_CHANGE_TITLE, MyChild::OnChangeTitle)
1157 // EVT_MENU(MDI_CHANGE_POSITION, MyChild::OnChangePosition)
1158 // EVT_MENU(MDI_CHANGE_SIZE, MyChild::OnChangeSize)
1159 EVT_MENU(20002, wxMaracasFrame03::OnActiveProcessingModules)
1161 EVT_MENU(ID_WXILPD_BUTTON_DELETE_ALL_DB , wxMaracasFrame03::eventMenuDeleteAllPatientInDB)
1162 EVT_MENU(ID_WXILPD_BUTTON_DELETE_DB , wxMaracasFrame03::eventMenuDeletePatientInDB)
1164 EVT_MENU(ID_WXILPD_BUTTON_FILTER_DB , wxMaracasFrame03::OnFilterInDB)
1165 EVT_MENU(ID_WXILPD_BUTTON_ORDERING_DB , wxMaracasFrame03::OnOrderingInDB)
1166 EVT_MENU(ID_WXILPD_BUTTON_EDIT_COLUMN , wxMaracasFrame03::OnEditColumnsInDB)
1169 // EVT_SIZE(wxMaracasFrame03::OnSize)
1170 // EVT_MOVE(MyChild::OnMove)
1172 // EVT_CLOSE(wxMaracasPatientLstVoiChiFra::OnClose)
1175 EVT_MENU(11110 , wxMaracasFrame03::OnActivePatientListVoiFrame )
1176 EVT_MENU(11111 , wxMaracasFrame03::OnActiveProcessingFrame )
1177 EVT_MENU(11112 , wxMaracasFrame03::OnActiveIRMQuantificationFrame )
1178 EVT_MENU(11113 , wxMaracasFrame03::OnActiveCTQuantificationFrame )
1179 EVT_MENU(11114 , wxMaracasFrame03::OnActiveVascularTreeExtractionFrame )
1180 EVT_MENU(11115 , wxMaracasFrame03::OnActiveSTLFormatFrame )
1181 EVT_MENU(11116 , wxMaracasFrame03::OnActiveTestsFrame )
1182 EVT_MENU(11117 , wxMaracasFrame03::OnActiveTests2Frame )
1184 EVT_MENU(MDI_PARAMETERS , wxMaracasFrame03::OnActiveParams )
1185 EVT_MENU(MDI_ABOUT , wxMaracasFrame03::OnActiveAbout )
1186 EVT_MENU(MDI_QUIT , wxMaracasFrame03::OnActiveQuit )
1192 wxMaracasFrame03::wxMaracasFrame03( wxFrame *parent, wxWindowID id,
1193 marInterface *mar, char *dictionaryFileName,
1194 const wxString& title, const wxPoint& pos,
1195 const wxSize& size, long style)
1196 : wxMDIParentFrame(parent, id, title, pos, size,
1197 style | wxNO_FULL_REPAINT_ON_RESIZE)
1200 wxFont font=wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT );
1203 _option_menu = NULL;
1204 _manualRegistrationPanel = NULL;
1206 marDictionary marDict;
1207 // marDict.LoadDictionary_French();
1208 marDict.LoadDictionary_English();
1209 // marDict.LoadDictionary_Japanese();
1211 // CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL);
1212 // InitToolBar(GetToolBar());
1215 Configure_WindowMDI(0);
1217 //----------------------------------------------------------------------------
1218 wxMaracasFrame03::~wxMaracasFrame03()
1223 //----------------------------------------------------------------------------
1225 void wxMaracasFrame03::eventMenuDeleteAllPatientInDB(wxCommandEvent& event)
1227 if (_patientlstvoi->GetNoteBook()->GetSelection()==0)
1229 if (_patientlstvoi->GetWxILPD()->GetNotebook()->GetSelection()==0)
1231 _patientlstvoi->GetWxILPD()->eventBtnDeleteAllPatientInDB(event);
1236 //----------------------------------------------------------------------------
1238 void wxMaracasFrame03::eventMenuDeletePatientInDB(wxCommandEvent& event)
1240 if (_patientlstvoi->GetNoteBook()->GetSelection()==0)
1242 if (_patientlstvoi->GetWxILPD()->GetNotebook()->GetSelection()==0)
1244 _patientlstvoi->GetWxILPD()->eventBtnDeletePatientInDB(event);
1249 //----------------------------------------------------------------------------
1251 void wxMaracasFrame03::OnFilterInDB(wxCommandEvent& event)
1253 if (_patientlstvoi->GetNoteBook()->GetSelection()==0)
1255 if (_patientlstvoi->GetWxILPD()->GetNotebook()->GetSelection()==0)
1257 _patientlstvoi->GetWxILPD()->OnFilter(event);
1261 //----------------------------------------------------------------------------
1262 void wxMaracasFrame03::OnOrderingInDB(wxCommandEvent& event)
1264 if (_patientlstvoi->GetNoteBook()->GetSelection()==0)
1266 if (_patientlstvoi->GetWxILPD()->GetNotebook()->GetSelection()==0)
1268 _patientlstvoi->GetWxILPD()->OnOrdering(event);
1272 //----------------------------------------------------------------------------
1273 void wxMaracasFrame03::OnEditColumnsInDB(wxCommandEvent& event)
1275 if (_patientlstvoi->GetNoteBook()->GetSelection()==0)
1277 if (_patientlstvoi->GetWxILPD()->GetNotebook()->GetSelection()==0)
1279 _patientlstvoi->GetWxILPD()->OnEditColumns(event);
1286 //----------------------------------------------------------------------------
1287 void wxMaracasFrame03::OnActiveProcessingModules(wxCommandEvent& event)
1290 _btnProcessingData -> Enable();
1291 _btnCTQuant -> Enable();
1292 _btnIRMQuant -> Enable();
1293 _btnTreeExtrac -> Enable();
1294 _btnSTLFormat -> Enable();
1296 if (_option_menu!=NULL)
1298 _option_menu->Enable(11111, true );
1299 _option_menu->Enable(11112, true );
1300 _option_menu->Enable(11113, true );
1301 _option_menu->Enable(11114, true );
1302 _option_menu->Enable(11115, true );
1303 _option_menu->Enable(11116, true );
1307 //----------------------------------------------------------------------------
1308 void wxMaracasFrame03::InitToolBar(wxToolBar* toolBar)
1312 wxBitmap toolBarBitmapsA[ 8+1 ];
1313 wxBitmap toolBarBitmapsB[ 8+1 ];
1315 toolBarBitmapsA[ 0 ] = wxBITMAP( TOOLBAR_V2_bi_bl_ListPatient_Voi );
1316 toolBarBitmapsA[ 1 ] = wxBITMAP( TOOLBAR_V2_bi_bl_Processing );
1317 toolBarBitmapsA[ 2 ] = wxBITMAP( TOOLBAR_V2_bi_bl_Params );
1318 toolBarBitmapsA[ 3 ] = wxBITMAP( TOOLBAR_V2_bi_bl_Logo );
1319 toolBarBitmapsA[ 4 ] = wxBITMAP( TOOLBAR_V2_bi_bl_IRMQuantification );
1320 toolBarBitmapsA[ 5 ] = wxBITMAP( TOOLBAR_V2_bi_bl_CTQuantification );
1321 toolBarBitmapsA[ 6 ] = wxBITMAP( TOOLBAR_V2_bi_bl_VascularTree );
1322 toolBarBitmapsA[ 7 ] = wxBITMAP( TOOLBAR_V2_bi_bl_STLFormat );
1323 toolBarBitmapsA[ 8 ] = wxBITMAP( TOOLBAR_V2_bi_bl_ManualRegistration);
1325 toolBarBitmapsB[ 0 ] = wxBITMAP( TOOLBAR_V2_bi_re_ListPatient_Voi );
1326 toolBarBitmapsB[ 1 ] = wxBITMAP( TOOLBAR_V2_bi_re_Processing );
1327 toolBarBitmapsB[ 2 ] = wxBITMAP( TOOLBAR_V2_bi_re_Params );
1328 toolBarBitmapsB[ 3 ] = wxBITMAP( TOOLBAR_V2_bi_re_Logo );
1329 toolBarBitmapsB[ 4 ] = wxBITMAP( TOOLBAR_V2_bi_re_IRMQuantification );
1330 toolBarBitmapsB[ 5 ] = wxBITMAP( TOOLBAR_V2_bi_re_CTQuantification );
1331 toolBarBitmapsB[ 6 ] = wxBITMAP( TOOLBAR_V2_bi_re_VascularTree );
1332 toolBarBitmapsB[ 7 ] = wxBITMAP( TOOLBAR_V2_bi_re_STLFormat );
1333 toolBarBitmapsB[ 8 ] = wxBITMAP( TOOLBAR_V2_bi_re_ManualRegistration);
1335 // Set size & margins
1336 toolBar->SetMargins( 5, 5 );
1337 toolBar->SetToolBitmapSize( wxSize( toolBarBitmapsA[0].GetWidth()+20, toolBarBitmapsA[0].GetHeight()+20 ) );
1340 wxBitmapButton *btn0 = new wxBitmapButton( toolBar, -1, toolBarBitmapsA[ 0 ],wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_BOTTOM );
1341 btn0->SetBitmapSelected(toolBarBitmapsB[ 0 ]);
1344 _btnProcessingData = new wxBitmapButton( toolBar, -1, toolBarBitmapsA[ 1 ]);
1345 _btnProcessingData->SetBitmapSelected(toolBarBitmapsB[ 1 ]);
1346 _btnProcessingData->Disable();
1349 wxBitmapButton *btn2 = new wxBitmapButton( toolBar, -1, toolBarBitmapsA[ 2 ],wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_BOTTOM );
1350 btn2->SetBitmapSelected(toolBarBitmapsB[ 2 ]);
1353 wxBitmapButton *btn3 = new wxBitmapButton( toolBar, -1, toolBarBitmapsA[ 3 ],wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_BOTTOM );
1354 btn3->SetBitmapSelected(toolBarBitmapsB[ 3 ]);
1356 // IRM Quantification
1357 _btnIRMQuant = new wxBitmapButton( toolBar, -1, toolBarBitmapsA[ 4 ],wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_BOTTOM );
1358 _btnIRMQuant->SetBitmapSelected(toolBarBitmapsB[ 4 ]);
1359 _btnIRMQuant->Disable();
1361 // CT Quantification
1362 _btnCTQuant = new wxBitmapButton( toolBar, -1, toolBarBitmapsA[ 5 ],wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_BOTTOM );
1363 _btnCTQuant->SetBitmapSelected(toolBarBitmapsB[ 5 ]);
1364 _btnCTQuant->Disable();
1366 // Vascular Tree Extraction
1367 _btnTreeExtrac = new wxBitmapButton( toolBar, -1, toolBarBitmapsA[ 6 ],wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_BOTTOM );
1368 _btnTreeExtrac->SetBitmapSelected(toolBarBitmapsB[ 6 ]);
1369 _btnTreeExtrac->Disable();
1372 _btnSTLFormat = new wxBitmapButton( toolBar, -1, toolBarBitmapsA[ 7 ],wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_BOTTOM );
1373 _btnSTLFormat->SetBitmapSelected(toolBarBitmapsB[ 7 ]);
1374 _btnSTLFormat->Disable();
1376 toolBar->AddControl( btn0 );
1377 toolBar->AddControl( _btnProcessingData );
1378 toolBar->AddSeparator( );
1379 toolBar->AddControl( _btnIRMQuant );
1380 toolBar->AddControl( _btnCTQuant );
1381 toolBar->AddControl( _btnTreeExtrac );
1382 toolBar->AddControl( _btnSTLFormat );
1383 toolBar->AddSeparator( );
1384 toolBar->AddControl( btn2 );
1385 toolBar->AddControl( btn3 );
1388 // toolBar->SetBackgroundColour( wxColour(130,130,130) );
1390 Connect(btn0->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasFrame03::OnActivePatientListVoiFrame );
1391 Connect(_btnProcessingData->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasFrame03::OnActiveProcessingFrame );
1392 Connect(btn2->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasFrame03::OnActiveParams );
1393 Connect(btn3->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasFrame03::OnActiveAbout );
1394 Connect(_btnIRMQuant->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasFrame03::OnActiveIRMQuantificationFrame );
1395 Connect(_btnCTQuant->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasFrame03::OnActiveCTQuantificationFrame );
1396 Connect(_btnTreeExtrac->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasFrame03::OnActiveVascularTreeExtractionFrame );
1397 Connect(_btnSTLFormat->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasFrame03::OnActiveSTLFormatFrame );
1402 //----------------------------------------------------------------------------
1404 wxMenuBar *wxMaracasFrame03::CreateMenuBarBase(){
1406 wxMenu *file_menu = new wxMenu;
1408 file_menu->Append(MDI_QUIT, _T("&Exit"));
1410 wxMenu *help_menu = new wxMenu;
1411 help_menu->Append(MDI_PARAMETERS , _T("Pa&rameters"));
1412 help_menu->Append(MDI_ABOUT , _T("&About"));
1414 wxMenuBar *menu_bar = new wxMenuBar;
1415 menu_bar->Append(file_menu , _T("&File"));
1416 menu_bar->Append(help_menu , _T("&Help"));
1420 //----------------------------------------------------------------------------
1421 void wxMaracasFrame03::OnActivePatientListVoiFrame(wxCommandEvent& event)
1423 _frame_ListPatieint_Voi->Maximize();
1425 //----------------------------------------------------------------------------
1426 void wxMaracasFrame03::OnActiveProcessingFrame(wxCommandEvent& event)
1428 CreateWindowMDI(10);
1429 CreateWindowMDI(11);
1431 //----------------------------------------------------------------------------
1432 void wxMaracasFrame03::OnActiveParams(wxCommandEvent& event)
1434 wxMaracasParametersDialog *d = new wxMaracasParametersDialog( this, _mar );
1438 //----------------------------------------------------------------------------
1439 void wxMaracasFrame03::OnActiveAbout(wxCommandEvent& event)
1441 wxMaracasHelpDialog* help = new wxMaracasHelpDialog(this, -1);
1444 //----------------------------------------------------------------------------
1445 void wxMaracasFrame03::OnActiveQuit(wxCommandEvent& event)
1450 //----------------------------------------------------------------------------
1451 void wxMaracasFrame03::OnActiveIRMQuantificationFrame(wxCommandEvent& event)
1453 CreateWindowMDI(20);
1455 //----------------------------------------------------------------------------
1456 void wxMaracasFrame03::OnActiveCTQuantificationFrame(wxCommandEvent& event)
1458 CreateWindowMDI(30);
1460 //----------------------------------------------------------------------------
1461 void wxMaracasFrame03::OnActiveVascularTreeExtractionFrame(wxCommandEvent& event)
1463 CreateWindowMDI(40);
1465 //----------------------------------------------------------------------------
1466 void wxMaracasFrame03::OnActiveSTLFormatFrame(wxCommandEvent& event)
1468 CreateWindowMDI(50);
1470 //----------------------------------------------------------------------------
1471 void wxMaracasFrame03::OnActiveTestsFrame(wxCommandEvent& event)
1473 CreateWindowMDI(60);
1475 //----------------------------------------------------------------------------
1476 void wxMaracasFrame03::OnActiveTests2Frame(wxCommandEvent& event)
1478 CreateWindowMDI(70);
1482 //----------------------------------------------------------------------------
1483 void wxMaracasFrame03::CreateWindowMDI( int type)
1485 // wxMaracasGenericChiFra *subframe=NULL;
1486 wxFrame *subframe=NULL;
1491 wxMaracasGenericChiFra *subframeTMP=NULL;
1492 subframeTMP = new wxMaracasGenericChiFra(this, _T("..."),
1493 wxPoint(50, 50), wxSize(300, 300),wxDEFAULT_FRAME_STYLE );
1494 subframeTMP->SetBlockCloseEvent(true);
1495 subframe=subframeTMP;
1496 subframe->Maximize();
1497 _patientlstvoi = new wxMaracasNoteBookPatientLstVoi(subframe);
1498 _patientlstvoi->SetMarInterface(_mar);
1499 _frame_ListPatieint_Voi=subframe;
1500 title_sf=_T("Patient List");
1502 wxMenu *database_menu = new wxMenu();
1503 database_menu->Append( ID_WXILPD_BUTTON_DELETE_ALL_DB , _T("Delete all patients"));
1504 database_menu->Append( ID_WXILPD_BUTTON_DELETE_DB , _T("Delete Patient"));
1505 database_menu->AppendSeparator();
1506 database_menu->Append( ID_WXILPD_BUTTON_FILTER_DB , _T("Filter"));
1507 database_menu->Append( ID_WXILPD_BUTTON_ORDERING_DB , _T("Ordering"));
1508 database_menu->Append( ID_WXILPD_BUTTON_EDIT_COLUMN , _T("Edit Column"));
1511 _option_menu = new wxMenu;
1512 _option_menu->Append(11110, _T("Patient &List - Voi"));
1513 _option_menu->Append(11111, _T("&Processing"));
1514 _option_menu->AppendSeparator();
1515 _option_menu->Append(11112, _T("&IRM Quantification"));
1516 _option_menu->Append(11113, _T("&CT Quantification"));
1517 _option_menu->AppendSeparator();
1518 _option_menu->Append(11114, _T("&Vascular Tree Extraction"));
1519 _option_menu->AppendSeparator();
1520 _option_menu->Append(11115, _T("&STL"));
1521 _option_menu->AppendSeparator();
1522 _option_menu->Append(11116, _T("&Tests"));
1524 _option_menu->Enable(11111, false );
1525 _option_menu->Enable(11112, false );
1526 _option_menu->Enable(11113, false );
1527 _option_menu->Enable(11114, false );
1528 _option_menu->Enable(11115, false );
1529 _option_menu->Enable(11116, false );
1531 wxMenuBar *menu_bar = CreateMenuBarBase();
1533 subframe->SetMenuBar(menu_bar);
1534 menu_bar->Insert(2,database_menu,_T("Data Base") );
1535 menu_bar->Insert(2,_option_menu,_T("Options") );
1541 subframe = new wxMaracasGenericChiFra(this, _T("..."),wxPoint(-1, -1),wxSize(225, 260),wxDEFAULT_FRAME_STYLE);
1542 wxMenuBar *menu_bar = CreateMenuBarBase();
1543 subframe->SetMenuBar(menu_bar);
1545 subframe = new wxFrame(this, -1, _T("..."));
1547 new wxProcessingImagesControl(subframe);
1548 title_sf=_T("Processing Images");
1554 subframe = new wxMaracasGenericChiFra(this, _T("..."),wxPoint(-1, -1),wxSize(750, 600),wxDEFAULT_FRAME_STYLE);
1555 wxMenuBar *menu_bar = CreateMenuBarBase();
1556 subframe->SetMenuBar(menu_bar);
1558 subframe = new wxFrame(this, -1, _T("..."));
1560 subframe->Maximize();
1561 new wxProcessingImagesTabControl(subframe,_mar,_patientlstvoi);
1562 title_sf=_T("Processing Images");
1565 // IRM Quantification
1569 wxMaracasImageBrowser02 *imageBrowser= _patientlstvoi->GetWxMaracasImageBrowser02();
1570 imageBrowser->ForceToFinisReadActiveImages( );
1571 imageBrowser->GetROI( voi );
1572 _mar->_experiment->setVOI( voi );
1575 subframe = new wxMaracasGenericChiFra(this, _T("..."),wxPoint(-1, -1),wxSize(750, 600),wxDEFAULT_FRAME_STYLE);
1576 wxMenuBar *menu_bar = CreateMenuBarBase();
1577 subframe->SetMenuBar(menu_bar);
1579 subframe = new wxFrame(this, -1, _T("..."));
1582 subframe->Maximize();
1583 wxMaracasNoteBookIRMQuantification *irmQuantification = new wxMaracasNoteBookIRMQuantification(subframe,_mar);
1584 title_sf=_T("IRM Quantification");
1587 // CT Quantification
1593 wxMaracasImageBrowser02 *imageBrowser= _patientlstvoi->GetWxMaracasImageBrowser02();
1594 imageBrowser->ForceToFinisReadActiveImages( );
1595 imageBrowser->GetROI( voi );
1596 _mar->_experiment->setVOI( voi );
1599 subframe = new wxMaracasGenericChiFra(this, _T("..."),wxPoint(-1, -1),wxSize(750, 600),wxDEFAULT_FRAME_STYLE);
1600 wxMenuBar *menu_bar = CreateMenuBarBase();
1601 subframe->SetMenuBar(menu_bar);
1603 subframe = new wxFrame(this, -1, _T("..."));
1606 subframe->Maximize();
1609 string namefileParent=_patientlstvoi->GetRWCM_namefileVOI();
1610 wxMaracasNoteBookCTQuantification *ctQuantification = new wxMaracasNoteBookCTQuantification(subframe,_mar,namefileParent);
1611 title_sf=_T("CT Quantification");
1614 // Vascular Tree Extraction
1619 wxMaracasImageBrowser02 *imageBrowser= _patientlstvoi->GetWxMaracasImageBrowser02();
1620 imageBrowser->ForceToFinisReadActiveImages( );
1621 imageBrowser->GetROI( voi );
1622 _mar->_experiment->setVOI( voi );
1626 subframe = new wxMaracasGenericChiFra(this, _T("..."),wxPoint(-1, -1),wxSize(750, 600),wxDEFAULT_FRAME_STYLE);
1627 wxMenuBar *menu_bar = CreateMenuBarBase();
1628 subframe->SetMenuBar(menu_bar);
1630 subframe = new wxFrame(this, -1, _T("..."));
1632 subframe->Maximize();
1634 wxMaracasNoteBookVascularTreeExtraction *vascularTreeExtraction = new wxMaracasNoteBookVascularTreeExtraction(subframe,_mar);
1635 title_sf=_T("Vascular Tree Extraction");
1645 wxMaracasImageBrowser02 *imageBrowser= _patientlstvoi->GetWxMaracasImageBrowser02();
1646 imageBrowser->ForceToFinisReadActiveImages( );
1647 imageBrowser->GetROI( voi );
1648 _mar->_experiment->setVOI( voi );
1653 subframe = new wxMaracasGenericChiFra(this, _T("..."),wxPoint(-1, -1),wxSize(750, 600),wxDEFAULT_FRAME_STYLE);
1654 wxMenuBar *menu_bar = CreateMenuBarBase();
1655 subframe->SetMenuBar(menu_bar);
1657 subframe = new wxFrame(this, -1, _T("..."));
1660 subframe->Maximize();
1662 wxMaracasNoteBookSTLFormat *stlFormat = new wxMaracasNoteBookSTLFormat(subframe,_mar);
1664 title_sf=_T("STL Format");
1672 wxMaracasImageBrowser02 *imageBrowser= _patientlstvoi->GetWxMaracasImageBrowser02();
1673 imageBrowser->ForceToFinisReadActiveImages( );
1674 imageBrowser->GetROI( voi );
1675 _mar->_experiment->setVOI( voi );
1678 subframe = new wxMaracasGenericChiFra(this, _T("..."),wxPoint(-1, -1),wxSize(750, 600),wxDEFAULT_FRAME_STYLE);
1679 wxMenuBar *menu_bar = CreateMenuBarBase();
1680 subframe->SetMenuBar(menu_bar);
1682 subframe = new wxFrame(this, -1, _T("..."));
1685 subframe->Maximize();
1686 wxMaracasNoteBookTests *testsPanel = new wxMaracasNoteBookTests(subframe,_mar);
1687 title_sf=_T("Tests");
1695 if (_manualRegistrationPanel==NULL)
1699 if ( _manualRegistrationPanel->GetIfSecondVolumeExist()==true )
1703 _manualRegistrationPanel->GenerateSecondVolume(_mar);
1704 _manualRegistrationPanel=NULL;
1711 wxMaracasImageBrowser02 *imageBrowser= _patientlstvoi->GetWxMaracasImageBrowser02();
1712 imageBrowser->ForceToFinisReadActiveImages( );
1713 imageBrowser->GetROI( voi );
1714 _mar->_experiment->setVOI( voi );
1717 subframe = new wxMaracasGenericChiFra(this, _T("..."),wxPoint(-1, -1),wxSize(750, 600),wxDEFAULT_FRAME_STYLE);
1718 wxMenuBar *menu_bar = CreateMenuBarBase();
1719 subframe->SetMenuBar(menu_bar);
1721 subframe = new wxFrame(this, -1, _T("..."));
1724 subframe->Maximize();
1725 _manualRegistrationPanel = new wxMaracasNoteBookManualRegistration(subframe,_mar);
1726 title_sf=_T("Manual registration");
1734 subframe->SetTitle(title_sf);
1735 subframe->CreateStatusBar();
1736 subframe->SetStatusText(title_sf);
1737 subframe->Show(TRUE);
1743 //----------------------------------------------------------------------------
1745 void wxMaracasFrame03::Configure_WindowMDI( int type)
1749 // _patientlstvoi->Configure();
1754 //----------------------------------------------------------------------------
1755 //----------------------------------------------------------------------------
1756 //----------------------------------------------------------------------------
1759 BEGIN_EVENT_TABLE(wxMaracasGenericChiFra, wxMDIChildFrame)
1761 // EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit)
1762 // EVT_MENU(MDI_REFRESH, MyChild::OnRefresh)
1763 // EVT_MENU(MDI_CHANGE_TITLE, MyChild::OnChangeTitle)
1764 // EVT_MENU(MDI_CHANGE_POSITION, MyChild::OnChangePosition)
1765 // EVT_MENU(MDI_CHANGE_SIZE, MyChild::OnChangeSize)
1767 // EVT_SIZE(MyChild::OnSize)
1768 // EVT_MOVE(MyChild::OnMove)
1770 EVT_CLOSE(wxMaracasGenericChiFra::OnClose)
1774 wxMaracasGenericChiFra::wxMaracasGenericChiFra(wxMDIParentFrame *parent, const wxString& title,
1775 const wxPoint& pos, const wxSize& size,
1777 : wxMDIChildFrame(parent, -1, title, pos, size,
1778 style | wxNO_FULL_REPAINT_ON_RESIZE)
1782 //----------------------------------------------------------------------------
1783 wxMaracasGenericChiFra::~wxMaracasGenericChiFra()
1785 wxMDIParentFrame *parent = (wxMDIParentFrame*)GetParent();
1786 parent->ActivateNext();
1790 //----------------------------------------------------------------------------
1791 void wxMaracasGenericChiFra::OnClose(wxCloseEvent& event)
1793 if (_blockClose==true){
1794 wxMessageDialog msg(this, _T("You can't close this window.."), _T("Message box"), wxOK );
1802 //----------------------------------------------------------------------------
1803 void wxMaracasGenericChiFra::SetBlockCloseEvent(bool blockClose)
1805 _blockClose=blockClose;
1808 //----------------------------------------------------------------------------
1809 //----------------------------------------------------------------------------
1810 //----------------------------------------------------------------------------
1815 FileInfoNode::FileInfoNode(string filename, string dirfile)
1817 _filename = filename;
1818 _filenameParent = "";
1821 //----------------------------------------------------------------------------
1822 FileInfoNode::~FileInfoNode()
1825 //----------------------------------------------------------------------------
1826 string FileInfoNode::GetFileName()
1830 //----------------------------------------------------------------------------
1831 string FileInfoNode::GetFileNameParent()
1833 return _filenameParent;
1835 //----------------------------------------------------------------------------
1836 void FileInfoNode::SetFileNameParent(string parent)
1838 _filenameParent=parent;
1840 //----------------------------------------------------------------------------
1841 string FileInfoNode::GetDirFile()
1846 //----------------------------------------------------------------------------
1847 //----------------------------------------------------------------------------
1848 //----------------------------------------------------------------------------
1850 FileInformationModel::FileInformationModel()
1853 //----------------------------------------------------------------------------
1854 FileInformationModel::~FileInformationModel()
1857 //----------------------------------------------------------------------------
1858 int FileInformationModel::GetSizeLstFile_filter()
1861 int i,size = _lstFileInfoNodes.size();
1862 for ( i=0 ; i<size ; i++ )
1864 if (_lstFileInfoNodes[i]->GetFileNameParent()==_filtre_1)
1871 //----------------------------------------------------------------------------
1872 string FileInformationModel::GetFileName_filter(int i)
1876 int ii,size = _lstFileInfoNodes.size();
1877 for ( ii=0 ; ii<size ; ii++ )
1879 if ( (_lstFileInfoNodes[ii]->GetFileNameParent()==_filtre_1) && (count==i) )
1881 result=_lstFileInfoNodes[ii]->GetFileName();
1885 if (_lstFileInfoNodes[ii]->GetFileNameParent()==_filtre_1)
1892 //----------------------------------------------------------------------------
1893 int FileInformationModel::GetSizeLstFile()
1895 return _lstFileInfoNodes.size();
1897 //----------------------------------------------------------------------------
1898 string FileInformationModel::GetFileName(int i)
1900 return _lstFileInfoNodes[i]->GetFileName();
1902 //----------------------------------------------------------------------------
1903 void FileInformationModel::ResetModel()
1905 int i,size=_lstFileInfoNodes.size();
1908 delete _lstFileInfoNodes[i];
1910 _lstFileInfoNodes.clear();
1912 //----------------------------------------------------------------------------
1913 void FileInformationModel::ReadModel(string dirFile)
1917 wxString wxdirfile( wxString(dirFile.c_str() , wxConvUTF8) );
1918 wxDir dir(wxdirfile);
1919 if ( !dir.IsOpened() )
1921 // deal with the error here - wxDir would already log an error message
1922 // explaining the exact reason of the failure
1925 wxString filename=_T("");
1926 bool cont = dir.GetFirst(&filename, _T("*.MaracasInfo"));
1929 _lstFileInfoNodes.push_back( new FileInfoNode( (const char*)(filename.mb_str()) , dirFile) );
1931 cont = dir.GetNext( &filename );
1935 //----------------------------------------------------------------------------
1936 void FileInformationModel::Filtre_1(string filtre)
1941 //----------------------------------------------------------------------------
1942 void FileInformationModel::LinkRelations()
1949 int i,size=_lstFileInfoNodes.size();
1952 filename = _lstFileInfoNodes[i]->GetFileName();
1953 dirfile = _lstFileInfoNodes[i]->GetDirFile();
1956 ff=fopen(name.c_str(),"r+");
1957 fscanf(ff,"%s",tmp);
1958 fscanf(ff,"%s",tmp);
1959 fscanf(ff,"%s",tmp);
1960 _lstFileInfoNodes[i]->SetFileNameParent(tmp);
1967 //----------------------------------------------------------------------------
1968 //----------------------------------------------------------------------------
1969 //----------------------------------------------------------------------------
1971 string wxReadWriteConf::_workDirectory = "c:/Maracas_configuration/";
1974 wxReadWriteConf::wxReadWriteConf(wxWindow *parent,string parentFile)
1975 : wxDialog(parent, -1, wxString(_T("Read-Write Configuration")) ,wxDefaultPosition,wxSize(800,400), wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE )
1977 _parentFile = parentFile;
1978 wxButton *btnDirectory = new wxButton(this,-1,_T("Directory"));
1979 _directoryTXT = new wxStaticText(this , -1 , wxString(_workDirectory.c_str(), wxConvUTF8) );
1981 wxString tempTXT(_T("Parent File: "));
1982 tempTXT=tempTXT + wxString(_parentFile.c_str(), wxConvUTF8);
1983 wxStaticText *parentFileTXT = new wxStaticText(this , -1 , tempTXT );
1984 Connect(btnDirectory->GetId(),wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction) &wxReadWriteConf::eventBtnWorkDirectory);
1985 wxWindow *wxwindow = CreateReadModule(this);
1986 wxBoxSizer *sizerA = new wxBoxSizer(wxHORIZONTAL);
1987 sizerA->Add(parentFileTXT,1,wxALL,5);
1988 wxBoxSizer *sizerB = new wxBoxSizer(wxHORIZONTAL);
1989 sizerB->Add(btnDirectory,1,wxALL,5);
1990 sizerB->Add(_directoryTXT,1,wxALL,10);
1992 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
1993 sizer->Add(sizerA,0,wxALL,0);
1994 sizer->Add(sizerB,0,wxALL,5);
1995 sizer->Add(wxwindow,1,wxGROW|wxEXPAND,0);
1996 this->SetSizer(sizer);
2000 _fim = new FileInformationModel();
2003 //----------------------------------------------------------------------------
2004 wxReadWriteConf::~wxReadWriteConf()
2007 //----------------------------------------------------------------------------
2008 void wxReadWriteConf::ResetView()
2010 _fim->Filtre_1(_parentFile);
2011 _fim->ReadModel(_workDirectory);
2012 RefreshReadFilesList();
2013 RefreshAllFilesList();
2015 //----------------------------------------------------------------------------
2016 wxWindow *wxReadWriteConf::CreateReadModule(wxWindow *parent)
2018 wxPanel *panel = new wxPanel(parent,-1);
2020 _wxviewinfo= new wxTextCtrl(panel,-1,_T(""),wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE|wxHSCROLL );
2022 wxBoxSizer * sizer = new wxBoxSizer(wxHORIZONTAL);
2023 sizer->Add( CreateListFilesModule(panel), 1,wxGROW|wxEXPAND,0 );
2024 sizer->Add( _wxviewinfo , 1,wxEXPAND,0 );
2026 panel->SetSizer(sizer);
2032 //----------------------------------------------------------------------------
2033 wxWindow *wxReadWriteConf::CreateListFilesModule(wxWindow *parent)
2035 wxPanel *panel = new wxPanel(parent,-1);
2036 wxNotebook *notebook = new wxNotebook(panel,-1);
2037 notebook->AddPage( CreateReadFileModule(notebook) ,wxString(_T("Read File")));
2038 notebook->AddPage( CreateListAllFilesModule(notebook) ,wxString(_T("All files")));
2039 notebook->AddPage( new wxPanel(notebook,-1) ,wxString(_T("Files Relation")));
2040 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
2041 sizer->Add(notebook,1,wxEXPAND|wxGROW,0);
2042 panel->SetSizer(sizer);
2046 //----------------------------------------------------------------------------
2047 wxWindow *wxReadWriteConf::CreateReadFileModule(wxWindow *parent)
2049 wxPanel *panel = new wxPanel(parent,-1);
2050 _wxlstFiles = new wxListBox( panel , -1 , wxDefaultPosition , wxSize(900,900) );
2051 wxButton *btnReadFile = new wxButton(panel, -1, _T(" Read \n information file") );
2052 wxButton *btnWriteFile = new wxButton(panel, -1, _T(" Create \n new file information"));
2053 wxButton *btnReWriteFile = new wxButton(panel, -1, _T(" ReWrite \n file information"));
2056 Connect(_wxlstFiles->GetId(),wxEVT_COMMAND_LISTBOX_SELECTED ,(wxObjectEventFunction) &wxReadWriteConf::OnShowFile01);
2057 Connect(_wxlstFiles->GetId(),wxEVT_COMMAND_LISTBOX_DOUBLECLICKED ,(wxObjectEventFunction) &wxReadWriteConf::eventBtnReadFile);
2059 Connect(btnReadFile->GetId(),wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction) &wxReadWriteConf::eventBtnReadFile);
2060 Connect(btnWriteFile->GetId(),wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction) &wxReadWriteConf::eventBtnWriteFile);
2061 Connect(btnReWriteFile->GetId(),wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction) &wxReadWriteConf::eventBtnReWriteFile);
2063 wxBoxSizer *sizerB = new wxBoxSizer(wxHORIZONTAL);
2064 sizerB->Add( btnReadFile , 1 , wxALL|wxALIGN_CENTER|wxEXPAND , 5 );
2065 sizerB->Add( btnWriteFile , 1 , wxALL|wxALIGN_CENTER|wxEXPAND , 5 );
2066 sizerB->Add( btnReWriteFile , 1 , wxALL|wxALIGN_CENTER|wxEXPAND , 5 );
2067 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
2068 sizer->Add( _wxlstFiles , 1 , wxGROW | wxEXPAND , 0 );
2069 sizer->Add( sizerB , 0 , wxALIGN_CENTER , 5 );
2070 panel->SetSizer(sizer);
2075 //----------------------------------------------------------------------------
2076 wxWindow *wxReadWriteConf::CreateListAllFilesModule(wxWindow *parent)
2078 wxPanel *panel = new wxPanel(parent,-1);
2079 _wxlstAllFiles = new wxListBox( panel , -1 , wxDefaultPosition , wxSize(900,900) );
2081 Connect(_wxlstAllFiles->GetId(),wxEVT_COMMAND_LISTBOX_SELECTED ,(wxObjectEventFunction) &wxReadWriteConf::OnShowFile02);
2083 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
2084 sizer->Add( _wxlstAllFiles , 1 , wxGROW | wxEXPAND , 0 );
2085 panel->SetSizer(sizer);
2090 //----------------------------------------------------------------------------
2091 void wxReadWriteConf::eventBtnReadFile(wxCommandEvent &event)
2093 if (_nameReadFile!="")
2095 wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,30002);
2096 this->GetParent()->ProcessEvent(newevent);
2100 //----------------------------------------------------------------------------
2101 void wxReadWriteConf::eventBtnReWriteFile(wxCommandEvent &event)
2103 _nameWriteFile=_nameReadFile;
2104 int sizeStr=_nameWriteFile.length() - string(".MaracasInfo").length();
2105 _nameWriteFile = _nameWriteFile.substr(0,sizeStr);
2107 if (_nameWriteFile!="")
2109 wxString msg(_nameReadFile.c_str(), wxConvUTF8);
2110 msg = msg+_T("\n\n\nYou really want to modify this file ?");
2111 int result = wxMessageDialog(this,msg,_T("Warning.."),wxOK | wxCANCEL).ShowModal();
2112 if (result==wxID_OK){
2113 wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,30001);
2114 this->GetParent()->ProcessEvent(newevent);
2119 wxMessageDialog(this,_T("First, you have to select a file."),_T("Warning.."), wxOK).ShowModal();
2122 //----------------------------------------------------------------------------
2123 void wxReadWriteConf::eventBtnWriteFile(wxCommandEvent &event)
2125 wxTextEntryDialog *filedlg = new wxTextEntryDialog(this, _T("Write MaracaInfo"));
2126 if(filedlg->ShowModal() == wxID_OK)
2129 string nameFile( (const char*)(filedlg->GetValue().mb_str()) );
2132 string name = _workDirectory+"/"+nameFile+".MaracasInfo";
2133 FILE *ff=fopen( name.c_str() , "r+" );
2137 wxMessageDialog(this,_T("...Error... \n\nThis file already exists."),_T("Error.."), wxOK).ShowModal();
2139 _nameWriteFile=nameFile;
2140 wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,30001);
2141 this->GetParent()->ProcessEvent(newevent);
2149 //----------------------------------------------------------------------------
2150 void wxReadWriteConf::OnShowFile01(wxCommandEvent &event)
2152 int id=_wxlstFiles->GetSelection();
2154 _nameReadFile = (const char*)(_wxlstFiles->GetString(id).mb_str());
2155 ShowInformation(_wxlstFiles,_wxviewinfo);
2158 //----------------------------------------------------------------------------
2159 void wxReadWriteConf::OnShowFile02(wxCommandEvent &event)
2161 ShowInformation(_wxlstAllFiles,_wxviewinfo);
2163 //----------------------------------------------------------------------------
2164 void wxReadWriteConf::ShowInformation(wxListBox *wxlistbox , wxTextCtrl* wxtextctrl )
2166 int id=wxlistbox->GetSelection();
2168 string namefile = (const char*)(wxlistbox->GetString(id).mb_str());
2173 string nf(this->_workDirectory);
2175 nf=nf+namefile.c_str();
2177 text = wxString(nf.c_str(), wxConvUTF8);
2178 text = text + _T("\n--------------------------------------------\n");
2180 ff=fopen(nf.c_str(),"r+");
2184 text = text + wxString(tmp, wxConvUTF8);
2188 wxtextctrl->SetValue(text);
2192 //----------------------------------------------------------------------------
2193 void wxReadWriteConf::eventBtnWorkDirectory(wxCommandEvent &event)
2197 wxDirDialog *filedlg = new wxDirDialog(this, _T("Work Directory"), wxString(_workDirectory.c_str(), wxConvUTF8) );
2198 if(filedlg->ShowModal() == wxID_OK)
2201 _workDirectory = (const char*)(filedlg->GetPath().mb_str());
2202 _directoryTXT->SetLabel( wxString(_workDirectory.c_str(), wxConvUTF8) );
2206 //----------------------------------------------------------------------------
2207 void wxReadWriteConf::RefreshReadFilesList()
2209 _wxlstFiles->Clear();
2210 wxString wxfilename;
2211 int i,size = _fim->GetSizeLstFile_filter();
2212 for (i=0; i<size; i++)
2214 _wxlstFiles->Append( wxString(_fim->GetFileName_filter(i).c_str(), wxConvUTF8) );
2217 //----------------------------------------------------------------------------
2218 void wxReadWriteConf::RefreshAllFilesList()
2220 _wxlstAllFiles->Clear();
2221 wxString wxfilename;
2222 int i,size = _fim->GetSizeLstFile();
2223 for (i=0; i<size; i++)
2225 _wxlstAllFiles->Append( wxString(_fim->GetFileName(i).c_str(), wxConvUTF8) );
2228 //----------------------------------------------------------------------------
2229 string wxReadWriteConf::GetNameWriteFile()
2231 return _nameWriteFile;
2233 //----------------------------------------------------------------------------
2234 string wxReadWriteConf::GetNameReadFile()
2236 return _nameReadFile;
2239 //----------------------------------------------------------------------------
2240 string wxReadWriteConf::GetWorkDirectory()
2242 return _workDirectory;
2245 string wxReadWriteConf::GetParentFile()
2250 //----------------------------------------------------------------------------
2251 //----------------------------------------------------------------------------
2252 //----------------------------------------------------------------------------
2255 BEGIN_EVENT_TABLE(wxMaracasNoteBookPatientLstVoi , wxPanel)
2257 // EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit)
2258 // EVT_MENU(MDI_REFRESH, MyChild::OnRefresh)
2259 // EVT_MENU(MDI_CHANGE_TITLE, MyChild::OnChangeTitle)
2260 // EVT_MENU(MDI_CHANGE_POSITION, MyChild::OnChangePosition)
2261 // EVT_MENU(MDI_CHANGE_SIZE, MyChild::OnChangeSize)
2262 // EVT_MENU(20001, wxMaracasNoteBookPatientLstVoi::OnSelectPatientStudySerieImage)
2264 // EVT_SIZE(MyChild::OnSize)
2265 // EVT_MOVE(MyChild::OnMove)
2267 // EVT_CLOSE(wxMaracasPatientLstVoiChiFra::OnClose)
2269 EVT_MENU(30001, wxMaracasNoteBookPatientLstVoi::OnPersistence_Write)
2270 EVT_MENU(30002, wxMaracasNoteBookPatientLstVoi::OnPersistence_Read)
2276 wxMaracasNoteBookPatientLstVoi::wxMaracasNoteBookPatientLstVoi(wxWindow *parent)
2277 : wxPanel(parent, -1)
2280 this->SetAutoLayout(true);
2284 _marRAWFiles = NULL;
2285 _marRAW2Files = NULL;
2286 _marRAW2AsciiFiles = NULL;
2287 _marGdcmDicomILPD = NULL;
2291 _wxreadwriteconf=NULL;
2294 _wxMaracasMPR = NULL;
2295 _wxMaracasImageBrowser02 = NULL;
2298 _widgetMesure = NULL;
2299 //EED 15Avril2008 _wxvtk2Dbaseview = NULL;
2300 //EED 15Avril2008 _vtkbasedata = NULL;
2302 _backStringFirstFile = "";
2303 _backStringFirstFile2 = "";
2305 _voiBack[0]=_voiBack[1]=_voiBack[2]=_voiBack[3]=_voiBack[4]=_voiBack[5]=-1;
2307 _noteBook = new wxNotebook(this, -1);
2309 _noteBook->SetSize(750,300);
2310 wxImageList *imageList = new wxImageList(50,50);
2312 wxBitmap mask= wxBITMAP( TOOLBAR_V2_sm_mask );
2314 wxBitmap bitmap0 = wxBITMAP( TOOLBAR_V2_sm_bl_ListPatient );
2315 wxBitmap bitmap1 = wxBITMAP( TOOLBAR_V2_sm_re_ListPatient );
2316 wxBitmap bitmap2 = wxBITMAP( TOOLBAR_V2_sm_re_ListPatient );
2317 wxBitmap bitmap3 = wxBITMAP( TOOLBAR_V2_sm_bl_voi );
2318 wxBitmap bitmap4 = wxBITMAP( TOOLBAR_V2_sm_re_voi );
2319 wxBitmap bitmap5 = wxBITMAP( TOOLBAR_V2_sm_tr_VOI );
2320 wxBitmap bitmap6 = wxBITMAP( TOOLBAR_V2_sm_bl_Processing );
2321 wxBitmap bitmap7 = wxBITMAP( TOOLBAR_V2_sm_bl_Processing );
2322 wxBitmap bitmap8 = wxBITMAP( TOOLBAR_V2_sm_tr_Processing );
2323 wxBitmap bitmap9 = wxBITMAP( TOOLBAR_V2_sm_bl_MPR );
2324 wxBitmap bitmap10 = wxBITMAP( TOOLBAR_V2_sm_bl_MPR );
2325 wxBitmap bitmap11 = wxBITMAP( TOOLBAR_V2_sm_tr_MPR );
2327 bitmap0.SetMask(new wxMask( mask ));
2328 bitmap1.SetMask(new wxMask( mask ));
2329 bitmap2.SetMask(new wxMask( mask ));
2330 bitmap3.SetMask(new wxMask( mask ));
2331 bitmap4.SetMask(new wxMask( mask ));
2332 bitmap5.SetMask(new wxMask( mask ));
2333 bitmap6.SetMask(new wxMask( mask ));
2334 bitmap7.SetMask(new wxMask( mask ));
2335 bitmap8.SetMask(new wxMask( mask ));
2336 bitmap9.SetMask(new wxMask( mask ));
2337 bitmap10.SetMask(new wxMask( mask ));
2338 bitmap11.SetMask(new wxMask( mask ));
2340 imageList->Add( bitmap0 ); // 0
2341 imageList->Add( bitmap1 ); // 1
2342 imageList->Add( bitmap2 ); // 2
2343 imageList->Add( bitmap3 ); // 3
2344 imageList->Add( bitmap4 ); // 4
2345 imageList->Add( bitmap4 ); // 5
2346 imageList->Add( bitmap6 ); // 6
2347 imageList->Add( bitmap7 ); // 7
2348 imageList->Add( bitmap8 ); // 8
2349 imageList->Add( bitmap9 ); // 9
2350 imageList->Add( bitmap10 ); // 10
2351 imageList->Add( bitmap11 ); // 11
2352 _noteBook->SetImageList(imageList);
2355 //EED 15Avril2008 wxPanel *panel_with_wxILPD = CreatePanel_WxILPD( _noteBook );
2356 //EED 15Avril2008 ILPDViewListPatient* _ilpdViewListPatient = new ILPDViewListPatient( new ILPDViewWxWindow(_wxILPD) );
2358 wxILPDwithImage *panel_with_wxILPD = new wxILPDwithImage( _noteBook );
2359 panel_with_wxILPD->Configure();
2360 _wxILPD = panel_with_wxILPD->GetWxILPD();
2362 wxProcessingImagesControl *processingCtrl = new wxProcessingImagesControl(_noteBook);
2364 _noteBook->AddPage( panel_with_wxILPD , _T("Patient List >> ") , true, 0 );
2365 _noteBook->AddPage(new wxPanel(_noteBook,-1) , _T(" View Image >> ") , true, 5 );
2366 _noteBook->AddPage(new wxPanel(_noteBook,-1) , _T(" MPR ") , true, 11 );
2367 _noteBook->AddPage(processingCtrl , _T(" Processing ") , true, 8 );
2368 _noteBook->SetSelection(0);
2371 Connect(_noteBook->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , (wxObjectEventFunction) &wxMaracasNoteBookPatientLstVoi::OnChangePageToVOI );
2372 Connect(_noteBook->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , (wxObjectEventFunction) &wxMaracasNoteBookPatientLstVoi::OnChangePage );
2374 wxStaticText *title=new wxStaticText(this,-1,_T("Load Patient Image "));
2376 // It doesn't works in linux
2377 // wxFont font(18,wxDEFAULT , wxITALIC, wxBOLD);
2378 // title->SetFont(font);
2381 // wxNotebookSizer *nbs = new wxNotebookSizer( _noteBook );
2384 wxButton *btnReadWriteConfig = new wxButton(this,-1,_T("Read-Write Config"));
2385 Connect(btnReadWriteConfig->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasNoteBookPatientLstVoi::OnReadWriteConf_Maracas );
2386 wxButton *btnHelp = new wxButton(this,-1,_T("Help"));
2387 wxButton *btnClose = new wxButton(this,-1,_T("Close"))
2389 wxBoxSizer *sizerB = new wxBoxSizer(wxHORIZONTAL);
2390 sizerB->Add( btnReadWriteConfig , 0, wxALIGN_RIGHT, 10);
2391 sizerB->Add( btnHelp , 0, wxALIGN_RIGHT, 10);
2392 sizerB->Add( btnClose , 0, wxALIGN_RIGHT, 10);
2395 wxBoxSizer *sizer= new wxBoxSizer(wxVERTICAL);
2396 sizer->Add( sizerB , 0, wxALIGN_RIGHT, 10);
2397 sizer->Add( title , 0, wxEXPAND | wxALIGN_RIGHT, 10);
2399 sizer->Add( _noteBook , 3, wxGROW|wxALL, 10 );
2401 this->SetSizer(sizer);
2410 //----------------------------------------------------------------------------
2411 wxMaracasNoteBookPatientLstVoi::~wxMaracasNoteBookPatientLstVoi()
2414 //EED 15Avril2008 if (_vtkbasedata!=NULL) { delete _vtkbasedata; }
2415 //EED 15Avril2008 if (_wxvtk2Dbaseview!=NULL) { delete _wxvtk2Dbaseview; }
2427 //----------------------------------------------------------------------------
2428 void wxMaracasNoteBookPatientLstVoi::SetMarInterface(marInterface *mar)
2435 //----------------------------------------------------------------------------
2437 void wxMaracasNoteBookPatientLstVoi::CreateMPRPanel()
2441 if (_wxMaracasMPR!=NULL)
2443 delete _wxMaracasMPR;
2448 _wxMaracasImageBrowser02->ForceToFinisReadActiveImages( );
2449 _wxMaracasImageBrowser02->GetROI( voi );
2450 _mar->_experiment->setVOI( voi );
2451 _mar2=new marInterface();
2453 _mar2->_parameters->setRescaleSlope( _mar->_parameters->getRescaleSlope() );
2454 _mar2->_parameters->setRescaleIntercept( _mar->_parameters->getRescaleIntercept() );
2457 double spcOriginalImage[3];
2458 spcOriginalImage[0]=_mar->_parameters->getDoubleParam(marParameters::e_voxel_x_dimension);
2459 spcOriginalImage[1]=_mar->_parameters->getDoubleParam(marParameters::e_voxel_y_dimension);
2460 spcOriginalImage[2]=_mar->_parameters->getDoubleParam(marParameters::e_voxel_z_dimension);
2463 // _mar2->_parameters->setDoubleParam( marParameters::e_voxel_x_dimension, _mar->_parameters->getDoubleParam(marParameters::e_voxel_x_dimension) );
2464 _mar2->_parameters->setIntParam( marParameters::e_voxel_type, marParameters::VOX_TYPE_MINIMUM );
2465 _mar2->_parameters->setDoubleParam( marParameters::e_voxel_x_dimension, spcOriginalImage[0] );
2466 _mar2->_parameters->setDoubleParam( marParameters::e_voxel_y_dimension, spcOriginalImage[1] );
2467 _mar2->_parameters->setDoubleParam( marParameters::e_voxel_z_dimension, spcOriginalImage[2] );
2469 _mar->_experiment->getVOI( voi );
2470 _mar2->_experiment->setVOI( voi );
2471 _mar2->SetDicom(_mar->_dicom);
2472 _mar2->initExperiment( );
2474 vtkImageData *imagedata;
2475 imagedata = _mar2->_experiment->getDynData( )->getVolume( )->castVtk();
2476 imagedata->Update();
2478 marImageData *marimagedata = new marImageData(imagedata);
2479 marimagedata->SetSpcOriginal(spcOriginalImage);
2480 marimagedata->SetVoiOriginal(voi);
2482 _wxMaracasMPR = new wxMaracasMPR( _noteBook->GetPage(2), marimagedata , _mar2->_parameters->getVoxelSize( ) );
2483 _wxMaracasMPR->ConfigureVTK();
2485 wxBoxSizer *sizer= new wxBoxSizer(wxHORIZONTAL);
2486 sizer->Add( _wxMaracasMPR , 1, wxALL|wxGROW, 0);
2487 _noteBook->GetPage(2)->SetAutoLayout(true);
2488 _noteBook->GetPage(2)->SetSizer(sizer);
2489 _noteBook->GetPage(2)->Layout();
2495 //----------------------------------------------------------------------------
2496 void wxMaracasNoteBookPatientLstVoi::OnChangePage(wxNotebookEvent& event)
2498 vector <string*> lstStringFileName;
2499 if ( (_noteBook->GetSelection()==2) && event.GetOldSelection()==1 )
2501 _wxILPD->GetLstImageFiles(&lstStringFileName);
2502 if (lstStringFileName.size()!=0)
2505 _wxMaracasImageBrowser02->GetROI( voi );
2506 if ( (_backStringFirstFile2!=*(lstStringFileName[0])) ||
2507 ( _voiBack[0]!=voi[0]) || ( _voiBack[1]!=voi[1]) || ( _voiBack[2]!=voi[2]) ||
2508 ( _voiBack[3]!=voi[3]) || ( _voiBack[4]!=voi[4]) || ( _voiBack[5]!=voi[5]) )
2510 _backStringFirstFile2=*(lstStringFileName[0]);
2511 _wxMaracasImageBrowser02->GetROI( _voiBack );
2517 if ( (_noteBook->GetSelection()==2) && event.GetOldSelection()!=1 )
2519 wxMessageDialog msg(this, _T("Before this, you have to select the VOI in View image module.."), _T("Message box"), wxOK );
2521 _noteBook->SetSelection(1);
2529 //----------------------------------------------------------------------------
2530 void wxMaracasNoteBookPatientLstVoi::OnChangePageToVOI(wxNotebookEvent& event)
2534 if (_noteBook->GetSelection()==0){
2538 // bool okAllFileExists = true;
2540 string msgLstFile="";
2545 if (_wxILPD->GetTypeOfReadFiles()==0)
2547 if (_marGdcmDicomILPD==NULL)
2549 _marGdcmDicomILPD = new marGdcmDicomILPD( _mar->_parameters );
2551 _mar->SetDicom(_marGdcmDicomILPD);
2556 if (_wxILPD->GetTypeOfReadFiles()==2)
2559 if ((_wxILPD->GetSubTypeOfReadFiles()==0) &&(_marRAWFiles==NULL))
2561 _marRAWFiles = new marRAWFiles( _mar->_parameters );
2562 _mar->SetDicom(_marRAWFiles);
2565 if ((_wxILPD->GetSubTypeOfReadFiles()==100) &&(_marGdcmDicomILPD==NULL))
2567 _marGdcmDicomILPD = new marGdcmDicomILPD( _mar->_parameters );
2568 _mar->SetDicom(_marGdcmDicomILPD);
2571 if ((_wxILPD->GetSubTypeOfReadFiles()==200) &&(_marRAW2Files==NULL))
2573 _marRAW2Files = new marRAW2Files( _mar->_parameters );
2574 _mar->SetDicom(_marRAW2Files);
2576 if ((_wxILPD->GetSubTypeOfReadFiles()==300) &&(_marRAW2AsciiFiles==NULL))
2578 _marRAW2AsciiFiles = new marRAW2AsciiFiles( _mar->_parameters );
2579 _mar->SetDicom(_marRAW2AsciiFiles);
2586 if (_wxILPD->GetTypeOfSelection() == 3)
2589 vector <string*> *lstStringFileName;
2590 _mar->_dicom->CleanListImages();
2591 lstStringFileName = _mar->_dicom->GetListImages( );
2592 _wxILPD->GetLstImageFiles(lstStringFileName);
2593 if (lstStringFileName->size()!=0)
2597 // marGdcmDicomILPD *margdcmdicomILPD = (marGdcmDicomILPD*)_mar->_dicom;
2598 // margdcmdicomILPD->SetListImages( &lstStringFileName );
2601 std::string *tmpStr=(*lstStringFileName)[0];
2602 if ( _backStringFirstFile!=*tmpStr )
2604 if (_wxILPD->GetTypeOfReadFiles()==0)
2606 _backStringFirstFile=*tmpStr;
2608 _backStringFirstFile="-1";
2610 _noteBook->SetPageImage(1, 4); // VOI Button Blue
2611 _noteBook->SetPageImage(2, 9); // MPR Button Blue
2612 _noteBook->SetPageImage(3, 6); // Processing Button Blue
2615 // Verifying that the list of files exist
2616 for( i=0 ; i<lstStringFileName.size() ; i++ )
2618 ff = fopen(lstStringFileName[i]->c_str(),"r");
2628 okAllFileExists = false;
2629 msgLstFile = msgLstFile + lstStringFileName[i]->c_str()+ "\n";
2632 if ((okAllFileExists == false) && (okFirst==true))
2634 wxDialog *dialog = new wxDialog( this , -1, wxString("The following files doesn't exist:"), wxDefaultPosition, wxSize(550,300), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
2636 wxTextCtrl *textCtrl = new wxTextCtrl(dialog, -1, msgLstFile.c_str() ,wxDefaultPosition , wxSize(100,100) , wxTE_MULTILINE | wxTE_READONLY );
2637 textCtrl->SetSelection(0,0);
2639 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL );
2640 sizer->Add( textCtrl , 1, wxALL|wxEXPAND, 0);
2641 dialog->SetAutoLayout(true);
2642 dialog->SetSizer( sizer ); // use the sizer for layout
2644 dialog->FitInside();
2645 dialog->ShowModal();
2649 ff = fopen((*lstStringFileName)[0]->c_str(),"r");
2655 msgLstFile = msgLstFile + (*lstStringFileName)[0]->c_str()+ "\n";
2658 if (okFirst == false)
2660 msgLstFile = "The series is incomplete or does not exists.";
2661 wxMessageDialog msgBox(this, wxString(msgLstFile.c_str(), wxConvUTF8), _T("Read file ERROR"), wxOK);
2663 _backStringFirstFile="";
2668 if (_wxMaracasImageBrowser02!=NULL)
2670 delete _wxMaracasImageBrowser02;
2672 _wxMaracasImageBrowser02 = new wxMaracasImageBrowser02( _noteBook->GetPage(1), _mar->_dicom, _mar->_parameters );
2673 // _wxMaracasImageBrowser02->SetSize(600,600);
2676 _mar->_dicom->loadActualSerie( NULL/*this->_progressGauge*/ );
2677 vtkImageData *dummy = _mar->_dicom->getVolume( )->castVtk();
2678 _wxMaracasImageBrowser02->LoadData( new marImageData(dummy) );
2679 _wxMaracasImageBrowser02->Start();
2681 wxBoxSizer *sizer= new wxBoxSizer(wxHORIZONTAL);
2682 sizer->Add( _wxMaracasImageBrowser02 , 1, wxALL|wxGROW, 0);
2683 // _noteBook->GetPage(1)->SetAutoLayout(true);
2684 _noteBook->GetPage(1)->SetSizer(sizer);
2685 _noteBook->GetPage(1)->Layout();
2686 // _wxMaracasImageBrowser02->Refresh();
2687 // _wxMaracasImageBrowser02->Update();
2689 // _noteBook->GetPage(1)->FitInside();
2692 wxCommandEvent ev(wxEVT_COMMAND_MENU_SELECTED,20002);
2693 this->ProcessEvent( ev );
2697 } // _backStringFirstFile
2699 } // if lstStringFileName.size
2701 if (_wxMaracasImageBrowser02==NULL)
2703 wxMessageDialog msg(this, _T("You have to select a serie befor run this option.."), _T("Message box"), wxOK );
2708 } //_noteBook->GetSelection()==0
2711 //----------------------------------------------------------------------------
2712 wxMaracasImageBrowser02* wxMaracasNoteBookPatientLstVoi::GetWxMaracasImageBrowser02()
2714 return _wxMaracasImageBrowser02;
2717 //----------------------------------------------------------------------------
2719 wxILPD *wxMaracasNoteBookPatientLstVoi::GetWxILPD()
2724 //----------------------------------------------------------------------------
2725 wxNotebook *wxMaracasNoteBookPatientLstVoi::GetNoteBook()
2727 return this->_noteBook;
2730 //----------------------------------------------------------------------------
2732 void wxMaracasNoteBookPatientLstVoi::OnReadWriteConf_Maracas(wxCommandEvent& event)
2735 if (this->_noteBook->GetSelection()==0) // Read DICOM images
2739 if (this->_noteBook->GetSelection()==1) // VOI
2741 parentFile=_RWCM_namefileReadImages;
2745 _wxreadwriteconf = new wxReadWriteConf(this,parentFile);
2746 _wxreadwriteconf->ShowModal();
2747 _wxreadwriteconf=NULL;
2749 wxMessageDialog(this,_T("No parent file defined..."),_T("Warning.."), wxOK).ShowModal();
2755 //----------------------------------------------------------------------------
2756 void wxMaracasNoteBookPatientLstVoi::Persistence_Read_Images()
2760 _RWCM_namefileReadImages = _wxreadwriteconf->GetNameReadFile();
2761 string directory = _wxreadwriteconf->GetWorkDirectory();
2762 string file=directory + "/" + _RWCM_namefileReadImages;
2763 if (_RWCM_namefileReadImages!=""){
2765 ff=fopen(file.c_str(),"r");
2766 fscanf(ff,"%s ",tmp); // MaracasInfo
2767 fscanf(ff,"%s ",tmp); // NameFileParent
2768 fscanf(ff,"%s ",tmp); // xxxxxxxx
2769 fscanf(ff,"%s ",tmp); // TypeOfReadFile
2770 fscanf(ff,"%s ",tmp); // xxxx
2771 int typeOfReadFile = atoi(tmp);
2772 fscanf(ff,"%s ",tmp); // SubTypeOfReadFile
2773 fscanf(ff,"%s ",tmp); // xxxx
2774 int subTypeOfReadFile = atoi(tmp);
2775 fscanf(ff,"%s ",tmp); // DirectoryManualFiles
2776 fscanf(ff,"%s ",tmp); // xxxx
2777 string directory= tmp;
2778 fscanf(ff,"%s ",tmp); // NameManualFileList
2779 fscanf(ff,"%s ",tmp); // xxxx
2780 string namefilelist= tmp;
2782 _wxILPD->SetTypeOfReadFiles(typeOfReadFile);
2783 _wxILPD->SetSubTypeOfReadFiles(subTypeOfReadFile);
2784 _wxILPD->SetNameManualFileList(namefilelist);
2785 _wxILPD->SetDirectoryManualFileList(directory);
2787 _wxILPD->RefreshManualListFile(true);
2788 _noteBook->SetSelection(0);
2792 //----------------------------------------------------------------------------
2794 string wxMaracasNoteBookPatientLstVoi::GetRWCM_namefileVOI()
2796 return _RWCM_namefileVOI;
2799 //----------------------------------------------------------------------------
2800 void wxMaracasNoteBookPatientLstVoi::Persistence_Read_VOI()
2805 _RWCM_namefileVOI = _wxreadwriteconf->GetNameReadFile();
2806 string directory = _wxreadwriteconf->GetWorkDirectory();
2807 string file=directory + "/" + _RWCM_namefileVOI;
2808 if (_RWCM_namefileVOI!=""){
2810 ff=fopen(file.c_str(),"r");
2811 fscanf(ff,"%s ",tmp); // MaracasInfo
2812 fscanf(ff,"%s ",tmp); // NameFileParent
2813 fscanf(ff,"%s ",tmp); // xxxxxxxx
2815 fscanf(ff,"%s ",tmp); // voi_x
2816 fscanf(ff,"%s ",tmp); // xMin
2818 fscanf(ff,"%s ",tmp); // xMax
2821 fscanf(ff,"%s ",tmp); // voi_y
2822 fscanf(ff,"%s ",tmp); // yMin
2824 fscanf(ff,"%s ",tmp); // yMax
2827 fscanf(ff,"%s ",tmp); // voi_z
2828 fscanf(ff,"%s ",tmp); // zMin
2830 fscanf(ff,"%s ",tmp); // zMax
2834 _wxMaracasImageBrowser02->SetROI(voi);
2835 _wxMaracasImageBrowser02->Refresh();
2841 //----------------------------------------------------------------------------
2842 void wxMaracasNoteBookPatientLstVoi::OnPersistence_Read(wxCommandEvent& event)
2844 if (_wxreadwriteconf!=NULL)
2846 if (this->_noteBook->GetSelection()==0) // Read Configuration Images
2848 Persistence_Read_Images();
2850 if (this->_noteBook->GetSelection()==1) // Read Configuration Images
2852 Persistence_Read_VOI();
2856 //----------------------------------------------------------------------------
2857 void wxMaracasNoteBookPatientLstVoi::Persistence_Write_Images_ManualReadFileList()
2859 if (_wxreadwriteconf!=NULL)
2861 _RWCM_namefileReadImages = _wxreadwriteconf->GetNameWriteFile();
2862 if (_RWCM_namefileReadImages!=""){
2863 string name,namedir;
2864 _RWCM_namefileReadImages = _RWCM_namefileReadImages + ".MaracasInfo";
2865 namedir = _wxreadwriteconf->GetWorkDirectory();
2866 name = namedir + "/" + _RWCM_namefileReadImages ;
2867 FILE *ff=fopen(name.c_str(),"w");
2868 fprintf(ff,"MaracasInfo \n");
2869 fprintf(ff,"NameFileParent %s \n",_wxreadwriteconf->GetParentFile().c_str() );
2874 string namefilelist;
2876 typefile = _wxILPD->GetTypeOfReadFiles();
2877 subtypefile = _wxILPD->GetSubTypeOfReadFiles();
2878 namefilelist = _wxILPD->GetNameManualFileList();
2879 directory = _wxILPD->GetDirectoryManualFileList();
2881 if (namefilelist=="")
2883 namefilelist="<void>";
2890 fprintf(ff,"TypeOfReadFiles %d\n", typefile );
2891 fprintf(ff,"SubTypeOfReadFiles %d\n", subtypefile );
2892 fprintf(ff,"DirectoryManualFileList %s\n", directory.c_str() );
2893 fprintf(ff,"NameManualFileList %s\n", namefilelist.c_str() );
2901 void wxMaracasNoteBookPatientLstVoi::Persistence_Write_Images_Database()
2903 std::string nameDirectory = _wxreadwriteconf->GetWorkDirectory();
2904 std::string nameFile = _wxreadwriteconf->GetNameWriteFile();
2905 if (_wxreadwriteconf!=NULL)
2907 // Create .maracas file (list of DICOM files)
2908 std::string nameFileMaracas = nameDirectory+"/"+nameFile+".maracas";
2909 FILE *ff =fopen(nameFileMaracas.c_str(),"w+");
2910 fprintf(ff,"MaracasType 100\n");
2911 fprintf(ff,"Directory --\n");
2912 std::vector <string *> lst;
2913 this->_wxILPD->GetLstImageFiles( &lst );
2914 int i,size=lst.size();
2915 for (i=0;i<size;i++)
2917 fprintf(ff,"%s\n",lst[i]->c_str());
2921 // Creating .MaracasInfo
2922 std::string nameFileMaracasInfo = nameDirectory+"/"+nameFile+".MaracasInfo";
2923 FILE *fileInfo =fopen(nameFileMaracasInfo.c_str(),"w+");
2924 fprintf(fileInfo,"MaracasInfo\n");
2925 fprintf(fileInfo,"NameFileParent NULL\n");
2926 fprintf(fileInfo,"TypeOfReadFiles 2\n");
2927 fprintf(fileInfo,"SubTypeOfReadFiles 100\n");
2928 fprintf(fileInfo,"DirectoryManualFileList %s\n",nameDirectory.c_str());
2929 fprintf(fileInfo,"NameManualFileList %s\n",nameFileMaracas.c_str());
2936 //----------------------------------------------------------------------------
2937 void wxMaracasNoteBookPatientLstVoi::Persistence_Write_VOI()
2939 if (_wxreadwriteconf!=NULL)
2941 string name,namedir;
2942 _RWCM_namefileVOI = _wxreadwriteconf->GetNameWriteFile();
2943 if (_RWCM_namefileVOI!=""){
2944 _RWCM_namefileVOI = _RWCM_namefileVOI + ".MaracasInfo" ;
2945 namedir = _wxreadwriteconf->GetWorkDirectory();
2946 name = namedir + "/" + _RWCM_namefileVOI ;
2947 FILE *ff=fopen(name.c_str(),"w");
2948 fprintf(ff,"MaracasInfo \n");
2949 fprintf(ff,"NameFileParent %s \n",_wxreadwriteconf->GetParentFile().c_str() );
2952 _wxMaracasImageBrowser02->GetROI(voi);
2954 fprintf(ff,"VOI_X %d %d\n", voi[0],voi[1] );
2955 fprintf(ff,"VOI_Y %d %d\n", voi[2],voi[3] );
2956 fprintf(ff,"VOI_Z %d %d\n", voi[4],voi[5] );
2961 //----------------------------------------------------------------------------
2962 void wxMaracasNoteBookPatientLstVoi::OnPersistence_Write(wxCommandEvent& event)
2964 if (_wxreadwriteconf!=NULL)
2966 if (this->_noteBook->GetSelection()==0) // Write Configuration Images
2969 if (this->_wxILPD->GetNotebook()->GetSelection()==0)
2971 Persistence_Write_Images_Database();
2973 if (this->_wxILPD->GetNotebook()->GetSelection()==1)
2975 Persistence_Write_Images_Database();
2977 if (this->_wxILPD->GetNotebook()->GetSelection()==2)
2979 Persistence_Write_Images_ManualReadFileList();
2982 if (this->_noteBook->GetSelection()==1) // Write ConfigurationImages
2984 Persistence_Write_VOI();
2990 //----------------------------------------------------------------------------
2991 //----------------------------------------------------------------------------
2992 //----------------------------------------------------------------------------
2995 BEGIN_EVENT_TABLE(wxMaracasNoteBookIRMQuantification , wxPanel)
2997 // EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit)
2998 // EVT_MENU(MDI_REFRESH, MyChild::OnRefresh)
2999 // EVT_MENU(MDI_CHANGE_TITLE, MyChild::OnChangeTitle)
3000 // EVT_MENU(MDI_CHANGE_POSITION, MyChild::OnChangePosition)
3001 // EVT_MENU(MDI_CHANGE_SIZE, MyChild::OnChangeSize)
3002 // EVT_MENU(20001, wxMaracasNoteBookIRMQuantification::OnSelectPatientStudySerieImage)
3004 // EVT_SIZE(MyChild::OnSize)
3005 // EVT_MOVE(MyChild::OnMove)
3007 // EVT_CLOSE(wxMaracasPatientLstVoiChiFra::OnClose)
3008 EVT_TOOL(wxSurfaceWidget::ID_BUTTON_NEW_AXIS , wxMaracasNoteBookIRMQuantification::OnNewAxis )
3009 EVT_TOOL(wxSurfaceWidget::ID_BUTTON_DELETE_AXIS , wxMaracasNoteBookIRMQuantification::OnDeleteAxis )
3010 EVT_TOOL(ID_TOOLBAR_PLANS , wxMaracasNoteBookIRMQuantification::OnQuantification )
3013 wxMaracasNoteBookIRMQuantification::wxMaracasNoteBookIRMQuantification(wxWindow *parent,marInterface *mar)
3014 : wxPanel(parent, -1)
3016 printf("EED wxMaracasNoteBookIRMQuantification::wxMaracasNoteBookIRMQuantification 1 \n");
3018 _wxmaracasquantification = NULL;
3020 _noteBook = new wxNotebook(this, -1);
3021 _noteBook->SetSize(750,300);
3023 wxBitmap mask= wxBITMAP( TOOLBAR_V2_sm_mask );
3025 wxBitmap bitmap0 = wxBITMAP( TOOLBAR_V2_sm_bl_AxisExtraction );
3026 wxBitmap bitmap1 = wxBITMAP( TOOLBAR_V2_sm_bl_Quantification );
3027 wxBitmap bitmap2 = wxBITMAP( TOOLBAR_V2_sm_tr_Quantification );
3029 bitmap0.SetMask(new wxMask( mask ));
3030 bitmap1.SetMask(new wxMask( mask ));
3031 bitmap2.SetMask(new wxMask( mask ));
3034 wxImageList *imageList = new wxImageList(50,50);
3035 imageList->Add( bitmap0 ); // 0
3036 imageList->Add( bitmap1 ); // 1
3037 imageList->Add( bitmap2 ); // 2
3038 _noteBook->SetImageList(imageList);
3040 printf("EED wxMaracasNoteBookIRMQuantification::wxMaracasNoteBookIRMQuantification 2 \n");
3043 // _mar->initExperiment( );
3045 _mar=new marInterface();
3046 _mar->_parameters->setRescaleSlope( mar->_parameters->getRescaleSlope() );
3047 _mar->_parameters->setRescaleIntercept( mar->_parameters->getRescaleIntercept() );
3048 _mar->_parameters->setIntParam( marParameters::e_voxel_type, marParameters::VOX_TYPE_MINIMUM );
3049 _mar->_parameters->setDoubleParam( marParameters::e_voxel_x_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_x_dimension) );
3050 _mar->_parameters->setDoubleParam( marParameters::e_voxel_y_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_y_dimension) );
3051 _mar->_parameters->setDoubleParam( marParameters::e_voxel_z_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_z_dimension) );
3053 mar->_experiment->getVOI( voi );
3054 _mar->_experiment->setVOI( voi );
3055 _mar->SetDicom(mar->_dicom);
3056 _mar->initExperiment( );
3058 printf("EED wxMaracasNoteBookIRMQuantification::wxMaracasNoteBookIRMQuantification 2.1 \n");
3059 _wxmaracas3dbrowser = new wxMaracas3DBrowser( _noteBook, _mar, -1,ID_TOOLBAR_PLANS );
3060 printf("EED wxMaracasNoteBookIRMQuantification::wxMaracasNoteBookIRMQuantification 2.2 \n");
3061 _wxmaracas3dbrowser->LoadData( );
3063 // _wxmaracasquantification = new wxMaracasQuantification( _noteBook , _mar , -1 );
3065 wxPanel *ttt = new wxPanel(_noteBook,-1);
3066 // _wxmaracasquantification = new wxMaracasQuantification( ttt , _mar , -1 );
3069 printf("EED wxMaracasNoteBookIRMQuantification::wxMaracasNoteBookIRMQuantification 3 \n");
3071 _noteBook->AddPage(_wxmaracas3dbrowser,_T("Axis Extraction IRM >> ") , true , 0 );
3072 _noteBook->AddPage(ttt,_T("Quantification IRM ") , true , 2 );
3075 _noteBook->SetSelection(0);
3077 Connect(_noteBook->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , (wxObjectEventFunction) &wxMaracasNoteBookIRMQuantification::OnChangePageQuantification );
3078 Connect(_noteBook->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , (wxObjectEventFunction) &wxMaracasNoteBookIRMQuantification::OnChangePage );
3081 wxStaticText *title=new wxStaticText(this,-1,_T("IRM Quantification"));
3083 // It doesn't works in linux
3084 // wxFont font(18,wxDEFAULT , wxITALIC, wxBOLD);
3085 // title->SetFont(font);
3087 wxBoxSizer *sizer= new wxBoxSizer(wxVERTICAL);
3088 sizer->Add( title , 0, wxEXPAND | wxALIGN_RIGHT, 10);
3089 sizer->Add( _noteBook , 1, wxGROW, 10 );
3091 sizer->SetSizeHints( this ); // set size hints to honour minimum size
3092 this->SetAutoLayout(true);
3093 this->SetSizer(sizer);
3098 printf("EED wxMaracasNoteBookIRMQuantification::wxMaracasNoteBookIRMQuantification 4 \n");
3101 //----------------------------------------------------------------------------
3102 wxMaracasNoteBookIRMQuantification::~wxMaracasNoteBookIRMQuantification()
3105 // delete _wxmaracas3dbrowser;
3106 // delete _wxmaracasquantification;
3109 //----------------------------------------------------------------------------
3110 void wxMaracasNoteBookIRMQuantification::OnQuantification(wxCommandEvent & event)
3112 _noteBook->SetSelection(1);
3115 //----------------------------------------------------------------------------
3116 void wxMaracasNoteBookIRMQuantification::OnChangePage(wxNotebookEvent& event)
3118 if (_noteBook->GetSelection()==1){
3119 if (_wxmaracasquantification!=NULL)
3122 delete _wxmaracasquantification;
3123 // _wxmaracasquantification->Close();
3125 _wxmaracasquantification = new wxMaracasQuantification( _noteBook->GetPage(1) , _mar , -1 );
3126 _wxmaracasquantification->LoadData( );
3127 wxBoxSizer *sizer= new wxBoxSizer(wxHORIZONTAL);
3128 sizer->Add( _wxmaracasquantification , 1, wxALL|wxEXPAND, 0);
3129 _noteBook->GetPage(1)->SetAutoLayout(true);
3130 _noteBook->GetPage(1)->SetSizer(sizer);
3131 _noteBook->GetPage(1)->Layout();
3134 //----------------------------------------------------------------------------
3135 void wxMaracasNoteBookIRMQuantification::OnChangePageQuantification(wxNotebookEvent& event)
3137 if (_noteBook->GetSelection()==0){
3138 if (_existAxis == false )
3140 wxMessageDialog msg(this, _T("You have to extract the axis befor run this option.."), _T("Message box"), wxOK );
3148 //----------------------------------------------------------------------------
3149 void wxMaracasNoteBookIRMQuantification::OnNewAxis(wxCommandEvent &WXUNUSED(event))
3152 _noteBook->SetPageImage(1, 1);
3155 //----------------------------------------------------------------------------
3156 void wxMaracasNoteBookIRMQuantification::OnDeleteAxis(wxCommandEvent &WXUNUSED(event))
3159 _noteBook->SetPageImage(1, 2);
3164 //----------------------------------------------------------------------------
3165 //----------------------------------------------------------------------------
3166 //----------------------------------------------------------------------------
3169 BEGIN_EVENT_TABLE(wxMaracasNoteBookCTQuantification , wxPanel)
3171 // EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit)
3172 // EVT_MENU(MDI_REFRESH, MyChild::OnRefresh)
3173 // EVT_MENU(MDI_CHANGE_TITLE, MyChild::OnChangeTitle)
3174 // EVT_MENU(MDI_CHANGE_POSITION, MyChild::OnChangePosition)
3175 // EVT_MENU(MDI_CHANGE_SIZE, MyChild::OnChangeSize)
3176 // EVT_MENU(20001, wxMaracasNoteBookIRMQuantification::OnSelectPatientStudySerieImage)
3178 // EVT_SIZE(MyChild::OnSize)
3179 // EVT_MOVE(MyChild::OnMove)
3181 // EVT_CLOSE(wxMaracasPatientLstVoiChiFra::OnClose)
3182 // EVT_TOOL(wxSurfaceWidget::ID_BUTTON_NEW_AXIS, wxMaracasNoteBookIRMQuantification::OnNewAxis )
3183 // EVT_TOOL(wxSurfaceWidget::ID_BUTTON_DELETE_AXIS,wxMaracasNoteBookIRMQuantification::OnDeleteAxis )
3184 EVT_TOOL(20005,wxMaracasNoteBookCTQuantification::OnQuantification)
3186 EVT_MENU(30001, wxMaracasNoteBookCTQuantification::OnPersistence_Write)
3187 EVT_MENU(30002, wxMaracasNoteBookCTQuantification::OnPersistence_Read)
3193 wxMaracasNoteBookCTQuantification::wxMaracasNoteBookCTQuantification(wxWindow *parent,
3195 string namefileParentRWCM)
3196 : wxPanel(parent, -1)
3198 printf(" EED wxMaracasNoteBookCTQuantification::wxMaracasNoteBookCTQuantification 01\n ");
3199 _namefileParentRWCM = namefileParentRWCM;
3200 _readyQuantification=false;
3201 _wxMaracasProcessingCT=NULL;
3202 _wxmaracasquantification_ct=NULL;
3204 _noteBook = new wxNotebook(this, -1);
3205 // _noteBook->SetSize(550,300);
3207 wxBitmap mask= wxBITMAP( TOOLBAR_V2_sm_mask );
3209 wxBitmap bitmap0 = wxBITMAP( TOOLBAR_V2_sm_bl_MPR );
3210 wxBitmap bitmap1 = wxBITMAP( TOOLBAR_V2_sm_bl_ProcessingCT );
3211 wxBitmap bitmap2 = wxBITMAP( TOOLBAR_V2_sm_bl_Quantification );
3212 wxBitmap bitmap3 = wxBITMAP( TOOLBAR_V2_sm_tr_Quantification );
3214 bitmap0.SetMask(new wxMask( mask ));
3215 bitmap1.SetMask(new wxMask( mask ));
3216 bitmap2.SetMask(new wxMask( mask ));
3217 bitmap3.SetMask(new wxMask( mask ));
3219 wxImageList *imageList = new wxImageList(50,50);
3220 imageList->Add( bitmap0 ); // 0
3221 imageList->Add( bitmap1 ); // 1
3222 imageList->Add( bitmap2 ); // 2
3223 imageList->Add( bitmap3 ); // 3
3224 _noteBook->SetImageList(imageList);
3227 double spcOriginalImage[3];
3228 spcOriginalImage[0]=mar->_parameters->getDoubleParam(marParameters::e_voxel_x_dimension);
3229 spcOriginalImage[1]=mar->_parameters->getDoubleParam(marParameters::e_voxel_y_dimension);
3230 spcOriginalImage[2]=mar->_parameters->getDoubleParam(marParameters::e_voxel_z_dimension);
3234 _mar=new marInterfaceCT();
3236 _mar->_parameters->setRescaleSlope( mar->_parameters->getRescaleSlope() );
3237 _mar->_parameters->setRescaleIntercept( mar->_parameters->getRescaleIntercept() );
3238 _mar->_parameters->setIntParam( marParameters::e_voxel_type, marParameters::VOX_TYPE_MINIMUM );
3241 _mar->_parameters->setDoubleParam( marParameters::e_voxel_x_dimension, spcOriginalImage[0] );
3242 _mar->_parameters->setDoubleParam( marParameters::e_voxel_y_dimension, spcOriginalImage[1] );
3243 _mar->_parameters->setDoubleParam( marParameters::e_voxel_z_dimension, spcOriginalImage[2] );
3247 mar->_experiment->getVOI( voi );
3248 _mar->setVOI( voi );
3249 _mar->SetDicom(mar->_dicom);
3251 _mar->initExperiment( );
3253 vtkImageData *imagedata;
3254 imagedata = _mar->GetExperiment()->getDynData( )->getVolume( )->castVtk();
3255 imagedata->Update();
3256 marImageData *marimagedata = new marImageData(imagedata);
3257 marimagedata->SetSpcOriginal(spcOriginalImage);
3258 marimagedata->SetVoiOriginal(voi);
3260 _wxMaracasMPR = new wxMaracasMPR( _noteBook, marimagedata ,_mar->_parameters->getVoxelSize() );
3261 _wxMaracasMPR->ConfigureVTK();
3263 _noteBook->AddPage(_wxMaracasMPR,_T("Choose a position >> "), true, 0 );
3265 _noteBook->AddPage(new wxPanel(_noteBook,-1),_T("Processing CT >> "), true, 1 );
3266 _noteBook->AddPage(new wxPanel(_noteBook,-1),_T("Quantification CT "), true, 3 );
3267 _noteBook->SetSelection(0);
3270 Connect(_noteBook->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , (wxObjectEventFunction) &wxMaracasNoteBookCTQuantification::OnChangePageQuantification );
3271 Connect(_noteBook->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , (wxObjectEventFunction) &wxMaracasNoteBookCTQuantification::OnChangePage );
3273 wxButton *btnReadWriteConfig = new wxButton(this,-1,_T("Read-Write Config"));
3274 Connect(btnReadWriteConfig->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxMaracasNoteBookCTQuantification::OnReadWriteConf_Maracas );
3275 wxButton *btnHelp = new wxButton(this,-1,_T("Help"));
3276 wxButton *btnClose = new wxButton(this,-1,_T("Close"));
3278 wxBoxSizer *sizerB = new wxBoxSizer(wxHORIZONTAL);
3279 sizerB->Add( btnReadWriteConfig , 0, wxALIGN_RIGHT, 10);
3280 sizerB->Add( btnHelp , 0, wxALIGN_RIGHT, 10);
3281 sizerB->Add( btnClose , 0, wxALIGN_RIGHT, 10);
3287 wxStaticText *title=new wxStaticText(this,-1,_T("CT Quantification"));
3289 // It doesn't works in linux
3290 // wxFont font(18,wxDEFAULT , wxITALIC, wxBOLD);
3291 // title->SetFont(font);
3293 wxBoxSizer *sizer= new wxBoxSizer(wxVERTICAL);
3294 sizer->Add( sizerB , 0, wxALIGN_RIGHT, 10);
3295 sizer->Add( title , 0, wxGROW | wxALIGN_RIGHT, 10);
3296 sizer->Add( _noteBook , 1, wxALL | wxGROW, 10 );
3301 // sizer->SetSizeHints( this ); // set size hints to honour minimum size
3302 this->SetSizer(sizer);
3303 this->SetAutoLayout(true);
3308 printf(" EED wxMaracasNoteBookCTQuantification::wxMaracasNoteBookCTQuantification 02\n ");
3311 //----------------------------------------------------------------------------
3313 wxMaracasNoteBookCTQuantification::~wxMaracasNoteBookCTQuantification()
3318 //----------------------------------------------------------------------------
3319 void wxMaracasNoteBookCTQuantification::OnChangePage(wxNotebookEvent& event)
3321 if (_noteBook->GetSelection()==1){
3323 if (_wxMaracasProcessingCT!=NULL)
3325 delete _wxMaracasProcessingCT;
3327 vtkMPRBaseData *vtkmprbaseData = _wxMaracasMPR->GetVtkMPRBaseData();
3328 marImageData *marimagedata = vtkmprbaseData->GetMarImageData();
3329 // _mar->initExperiment( );
3330 int x = (int)vtkmprbaseData->GetX();
3331 int y = (int)vtkmprbaseData->GetY();
3332 int z = (int)vtkmprbaseData->GetZ();
3333 printf("EED wxMaracasNoteBookCTQuantification::OnChangePage \n ");
3334 _wxMaracasProcessingCT = new wxMaracasProcessingCT(_noteBook->GetPage(1), _mar);
3335 _wxMaracasProcessingCT->ConfigureVTK(marimagedata, x , y , z );
3336 wxBoxSizer *sizer= new wxBoxSizer(wxHORIZONTAL);
3337 sizer->Add( _wxMaracasProcessingCT , 1, wxALL|wxGROW, 0);
3338 _noteBook->GetPage(1)->SetAutoLayout(true);
3339 _noteBook->GetPage(1)->SetSizer(sizer);
3340 _noteBook->GetPage(1)->Layout();
3342 if (_noteBook->GetSelection()==2) {
3343 if (_readyQuantification==true)
3345 if (_wxmaracasquantification_ct!=NULL)
3347 delete _wxmaracasquantification_ct;
3349 _wxmaracasquantification_ct = new wxMaracasQuantificationCT(_noteBook->GetPage(2), _mar, -1 );
3350 _wxmaracasquantification_ct->LoadData( );
3351 wxBoxSizer *sizer= new wxBoxSizer(wxHORIZONTAL);
3352 sizer->Add( _wxmaracasquantification_ct , 1, wxALL|wxGROW, 0);
3353 _noteBook->GetPage(2)->SetAutoLayout(true);
3354 _noteBook->GetPage(2)->SetSizer(sizer);
3355 _noteBook->GetPage(2)->Layout();
3357 wxMessageDialog msg(this, _T("You have to extract the axis befor run this option.."), _T("Message box"), wxOK );
3362 if ((_noteBook->GetSelection()==0) || (_noteBook->GetSelection()==1) ) {
3363 _readyQuantification=false;
3364 _noteBook->SetPageImage(2, 3);
3369 //----------------------------------------------------------------------------
3370 void wxMaracasNoteBookCTQuantification::OnChangePageQuantification(wxNotebookEvent& event)
3373 if (event.GetSelection()==1) {
3374 if (_readyQuantification==false)
3376 wxMessageDialog msg(this, "You have to extract the axis befor run this option..", "Message box", wxOK );
3383 //----------------------------------------------------------------------------
3384 void wxMaracasNoteBookCTQuantification::OnQuantification(wxCommandEvent& event)
3386 _readyQuantification=true;
3387 _noteBook->SetPageImage(2, 2);
3390 //----------------------------------------------------------------------------
3392 void wxMaracasNoteBookCTQuantification::OnReadWriteConf_Maracas(wxCommandEvent& event)
3395 if (this->_noteBook->GetSelection()==0) // Read 3D Point MPR
3397 parentFile=_namefileParentRWCM;
3399 if (this->_noteBook->GetSelection()==1) // Read Preprocessing
3401 parentFile=_RWCM_namefileMPR;
3403 if (this->_noteBook->GetSelection()==2) // Read Contour Quantification
3405 parentFile=_RWCM_namefileProcessingCT;
3411 _wxreadwriteconf = new wxReadWriteConf(this,parentFile);
3412 _wxreadwriteconf->ShowModal();
3413 _wxreadwriteconf=NULL;
3415 wxMessageDialog(this,_T("No parent file defined..."),_T("Warning.."), wxOK).ShowModal();
3420 //----------------------------------------------------------------------------
3421 void wxMaracasNoteBookCTQuantification::Persistence_Read_MPR()
3423 _RWCM_namefileMPR = _wxreadwriteconf->GetNameReadFile();
3424 if (_RWCM_namefileMPR!=""){
3428 string directory = _wxreadwriteconf->GetWorkDirectory();
3429 string file=directory + "/" + _RWCM_namefileMPR;
3431 ff=fopen(file.c_str(),"r");
3432 fscanf(ff,"%s ",tmp); // MaracasInfo
3433 fscanf(ff,"%s ",tmp); // NameFileParent
3434 fscanf(ff,"%s ",tmp); // xxxxxxxx
3436 fscanf(ff,"%s ",tmp); // positionX
3437 fscanf(ff,"%s ",tmp); // x
3440 fscanf(ff,"%s ",tmp); // positionY
3441 fscanf(ff,"%s ",tmp); // y
3444 fscanf(ff,"%s ",tmp); // positionZ
3445 fscanf(ff,"%s ",tmp); // z
3450 _wxMaracasMPR->GetVtkMPRBaseData()->SetX(x);
3451 _wxMaracasMPR->GetVtkMPRBaseData()->SetY(y);
3452 _wxMaracasMPR->GetVtkMPRBaseData()->SetZ(z);
3453 _wxMaracasMPR->RefreshView();
3457 //----------------------------------------------------------------------------
3458 void wxMaracasNoteBookCTQuantification::Persistence_Read_ProcessingCT()
3460 _RWCM_namefileProcessingCT = _wxreadwriteconf->GetNameReadFile();
3461 if (_RWCM_namefileProcessingCT!=""){
3465 string directory = _wxreadwriteconf->GetWorkDirectory();
3466 string file=directory + "/" + _RWCM_namefileProcessingCT;
3468 ff=fopen(file.c_str(),"r");
3469 fscanf(ff,"%s ",tmp); // MaracasInfo
3470 fscanf(ff,"%s ",tmp); // NameFileParent
3471 fscanf(ff,"%s ",tmp); // xxxxxxxx
3473 fscanf(ff,"%s ",tmp); // Threshold_min
3474 fscanf(ff,"%s ",tmp); // min
3477 fscanf(ff,"%s ",tmp); // Threshold_max
3478 fscanf(ff,"%s ",tmp); // max
3481 _wxMaracasProcessingCT->SetThreshold(min,max);
3482 _wxMaracasProcessingCT->Refresh();
3490 //----------------------------------------------------------------------------
3491 void wxMaracasNoteBookCTQuantification::Persistence_Read_ContourQauntificationCT()
3493 _RWCM_namefileContourQuantificationCT = _wxreadwriteconf->GetNameReadFile();
3494 if (_RWCM_namefileContourQuantificationCT!=""){
3497 string directory = _wxreadwriteconf->GetWorkDirectory();
3498 string file=directory + "/" + _RWCM_namefileContourQuantificationCT;
3500 ff=fopen(file.c_str(),"r");
3501 fscanf(ff,"%s ",tmp); // MaracasInfo
3502 fscanf(ff,"%s ",tmp); // NameFileParent
3503 fscanf(ff,"%s ",tmp); // xxxxxxxx
3508 fscanf(ff,"%s ",tmp); // Slice
3509 fscanf(ff,"%s ",tmp); // xxxxxxxx
3510 int slice = atoi(tmp);
3511 this->_wxmaracasquantification_ct->SetActualSlice(slice);
3519 //----------------------------------------------------------------------------
3520 void wxMaracasNoteBookCTQuantification::OnPersistence_Read(wxCommandEvent& event)
3522 if (this->_noteBook->GetSelection()==0) // Read 3D Point MPR
3524 Persistence_Read_MPR();
3526 if (this->_noteBook->GetSelection()==1) // Read Preprocessing
3528 Persistence_Read_ProcessingCT();
3530 if (this->_noteBook->GetSelection()==2) // Read Contour quantification
3532 Persistence_Read_ContourQauntificationCT();
3535 //----------------------------------------------------------------------------
3536 void wxMaracasNoteBookCTQuantification::Persistence_Write_MPR()
3539 if (_wxreadwriteconf!=NULL)
3541 _RWCM_namefileMPR = _wxreadwriteconf->GetNameWriteFile();
3542 if (_RWCM_namefileMPR!=""){
3543 string name,namedir;
3544 _RWCM_namefileMPR =_RWCM_namefileMPR + ".MaracasInfo";
3545 namedir = _wxreadwriteconf->GetWorkDirectory();
3546 name = namedir + "/" + _RWCM_namefileMPR ;
3547 FILE *ff=fopen(name.c_str(),"w");
3548 fprintf(ff,"MaracasInfo \n");
3549 fprintf(ff,"NameFileParent %s \n",_wxreadwriteconf->GetParentFile().c_str() );
3552 double x = _wxMaracasMPR->GetVtkMPRBaseData()->GetX();
3553 double y = _wxMaracasMPR->GetVtkMPRBaseData()->GetY();
3554 double z = _wxMaracasMPR->GetVtkMPRBaseData()->GetZ();
3556 fprintf(ff,"positionX %f\n", x);
3557 fprintf(ff,"positionY %f\n", y);
3558 fprintf(ff,"positionZ %f\n", z);
3566 //----------------------------------------------------------------------------
3567 void wxMaracasNoteBookCTQuantification::Persistence_Write_ProcessingCT()
3569 if (_wxreadwriteconf!=NULL)
3571 _RWCM_namefileProcessingCT = _wxreadwriteconf->GetNameWriteFile();
3572 if (_RWCM_namefileProcessingCT!=""){
3573 string name,namedir;
3574 _RWCM_namefileProcessingCT = _RWCM_namefileProcessingCT + ".MaracasInfo";
3575 namedir = _wxreadwriteconf->GetWorkDirectory();
3576 name = namedir + "/" + _RWCM_namefileProcessingCT ;
3577 FILE *ff=fopen(name.c_str(),"w");
3578 fprintf(ff,"MaracasInfo \n");
3579 fprintf(ff,"NameFileParent %s \n",_wxreadwriteconf->GetParentFile().c_str() );
3582 _wxMaracasProcessingCT->GetThreshold(&min,&max);
3584 fprintf(ff,"Threshold_Min %d\n", min);
3585 fprintf(ff,"Threshold_Max %d\n", max);
3592 //----------------------------------------------------------------------------
3593 void wxMaracasNoteBookCTQuantification::Persistence_Write_ContourQuantificationCT()
3595 if (_wxreadwriteconf!=NULL)
3597 _RWCM_namefileContourQuantificationCT = _wxreadwriteconf->GetNameWriteFile();
3598 if (_RWCM_namefileContourQuantificationCT!=""){
3599 string name,namedir;
3600 _RWCM_namefileContourQuantificationCT = _RWCM_namefileContourQuantificationCT + ".MaracasInfo";
3601 namedir = _wxreadwriteconf->GetWorkDirectory();
3602 name = namedir + "/" + _RWCM_namefileContourQuantificationCT ;
3603 FILE *ff=fopen(name.c_str(),"w");
3604 fprintf(ff,"MaracasInfo \n");
3605 fprintf(ff,"NameFileParent %s \n",_wxreadwriteconf->GetParentFile().c_str() );
3607 // Get Data information
3609 fprintf(ff,"Slice %d\n", this->_wxmaracasquantification_ct->GetActualSlice() );
3616 //----------------------------------------------------------------------------
3617 void wxMaracasNoteBookCTQuantification::OnPersistence_Write(wxCommandEvent& event)
3619 if (this->_noteBook->GetSelection()==0) // Write 3D Point MPR
3621 Persistence_Write_MPR();
3623 if (this->_noteBook->GetSelection()==1) // Write Preprocessing
3625 Persistence_Write_ProcessingCT();
3627 if (this->_noteBook->GetSelection()==2) // Write Contour Quantification
3629 Persistence_Write_ContourQuantificationCT();
3634 //----------------------------------------------------------------------------
3635 //----------------------------------------------------------------------------
3636 //----------------------------------------------------------------------------
3639 BEGIN_EVENT_TABLE(wxMaracasNoteBookVascularTreeExtraction , wxPanel)
3641 // EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit)
3642 // EVT_MENU(MDI_REFRESH, MyChild::OnRefresh)
3643 // EVT_MENU(MDI_CHANGE_TITLE, MyChild::OnChangeTitle)
3644 // EVT_MENU(MDI_CHANGE_POSITION, MyChild::OnChangePosition)
3645 // EVT_MENU(MDI_CHANGE_SIZE, MyChild::OnChangeSize)
3646 // EVT_MENU(20001, wxMaracasNoteBookIRMQuantification::OnSelectPatientStudySerieImage)
3648 // EVT_SIZE(MyChild::OnSize)
3649 // EVT_MOVE(MyChild::OnMove)
3651 // EVT_CLOSE(wxMaracasPatientLstVoiChiFra::OnClose)
3652 // EVT_TOOL(wxSurfaceWidget::ID_BUTTON_NEW_AXIS, wxMaracasNoteBookIRMQuantification::OnNewAxis )
3653 // EVT_TOOL(wxSurfaceWidget::ID_BUTTON_DELETE_AXIS,wxMaracasNoteBookIRMQuantification::OnDeleteAxis )
3654 // EVT_TOOL(20005,wxMaracasNoteBookVascularTreeExtraction::OnQuantification)
3659 wxMaracasNoteBookVascularTreeExtraction::wxMaracasNoteBookVascularTreeExtraction(wxWindow *parent,marInterface *mar)
3660 : wxPanel(parent, -1)
3663 _noteBook = new wxNotebook(this, -1);
3664 _noteBook->SetSize(550,300);
3666 wxBitmap mask= wxBITMAP( TOOLBAR_V2_sm_mask );
3667 wxBitmap bitmap0 = wxBITMAP( TOOLBAR_V2_sm_bl_TreeExtraction_JF_MH );
3668 bitmap0.SetMask(new wxMask( mask ));
3671 wxImageList *imageList = new wxImageList(50,50);
3672 imageList->Add( bitmap0 ); // 0
3673 _noteBook->SetImageList(imageList);
3677 _mar=new marInterface();
3678 _mar->_parameters->setRescaleSlope( mar->_parameters->getRescaleSlope() );
3679 _mar->_parameters->setRescaleIntercept( mar->_parameters->getRescaleIntercept() );
3680 _mar->_parameters->setIntParam( marParameters::e_voxel_type, marParameters::VOX_TYPE_MINIMUM );
3681 _mar->_parameters->setDoubleParam( marParameters::e_voxel_x_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_x_dimension) );
3682 _mar->_parameters->setDoubleParam( marParameters::e_voxel_y_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_y_dimension) );
3683 _mar->_parameters->setDoubleParam( marParameters::e_voxel_z_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_z_dimension) );
3686 mar->_experiment->getVOI( voi );
3687 _mar->_experiment->setVOI( voi );
3688 _mar->SetDicom(mar->_dicom);
3690 _mar->initExperiment( );
3692 vtkImageData *marImageData;
3693 marImageData = _mar->_experiment->getDynData( )->getVolume( )->castVtk();
3694 marImageData->Update();
3696 _wxMaracasEmptyPanel_2 = new wxMaracasEmptyPanel_2(_noteBook,_mar);
3697 _wxMaracasEmptyPanel_2->ConfigureVTK();
3700 _wxMaracasPathology_01 = new wxMaracasPathology_01(_noteBook,_mar);
3701 _wxMaracasPathology_01->ConfigureVTK();
3704 _noteBook->AddPage(_wxMaracasEmptyPanel_2,_T("Tree Extraction "), true, 0 );
3705 _noteBook->AddPage(_wxMaracasPathology_01,_T("Pathology "), true, 0 );
3706 _noteBook->SetSelection(0);
3708 Connect(_noteBook->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , (wxObjectEventFunction) &wxMaracasNoteBookVascularTreeExtraction::OnChangePageQuantification );
3709 Connect(_noteBook->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , (wxObjectEventFunction) &wxMaracasNoteBookVascularTreeExtraction::OnChangePage );
3711 wxStaticText *title=new wxStaticText(this,-1,_T("Vascular Tree Extraction"));
3713 // It doesn't works in linux
3714 // wxFont font(18,wxDEFAULT , wxITALIC, wxBOLD);
3715 // title->SetFont(font);
3717 wxBoxSizer *sizer= new wxBoxSizer(wxVERTICAL);
3718 sizer->Add( title , 0, wxEXPAND | wxALIGN_RIGHT, 10);
3719 sizer->Add( _noteBook , 1, wxGROW, 10 );
3724 sizer->SetSizeHints( this ); // set size hints to honour minimum size
3725 this->SetSizer(sizer);
3726 this->SetAutoLayout(true);
3730 //----------------------------------------------------------------------------
3731 wxMaracasNoteBookVascularTreeExtraction::~wxMaracasNoteBookVascularTreeExtraction()
3736 //----------------------------------------------------------------------------
3737 void wxMaracasNoteBookVascularTreeExtraction::OnChangePage(wxNotebookEvent& event)
3741 //----------------------------------------------------------------------------
3742 void wxMaracasNoteBookVascularTreeExtraction::OnChangePageQuantification(wxNotebookEvent& event)
3748 //----------------------------------------------------------------------------
3749 //----------------------------------------------------------------------------
3750 //----------------------------------------------------------------------------
3753 BEGIN_EVENT_TABLE(wxMaracasNoteBookSTLFormat , wxPanel)
3755 // EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit)
3756 // EVT_MENU(MDI_REFRESH, MyChild::OnRefresh)
3757 // EVT_MENU(MDI_CHANGE_TITLE, MyChild::OnChangeTitle)
3758 // EVT_MENU(MDI_CHANGE_POSITION, MyChild::OnChangePosition)
3759 // EVT_MENU(MDI_CHANGE_SIZE, MyChild::OnChangeSize)
3760 // EVT_MENU(20001, wxMaracasNoteBookIRMQuantification::OnSelectPatientStudySerieImage)
3762 // EVT_SIZE(MyChild::OnSize)
3763 // EVT_MOVE(MyChild::OnMove)
3765 // EVT_CLOSE(wxMaracasPatientLstVoiChiFra::OnClose)
3766 EVT_TOOL(wxSurfaceWidget::ID_BUTTON_NEW_AXIS, wxMaracasNoteBookSTLFormat::OnNewAxis )
3767 EVT_TOOL(wxSurfaceWidget::ID_BUTTON_DELETE_AXIS,wxMaracasNoteBookSTLFormat::OnDeleteAxis )
3768 // EVT_TOOL(20005,wxMaracasNoteBookVascularTreeExtraction::OnQuantification)
3775 wxMaracasNoteBookSTLFormat::wxMaracasNoteBookSTLFormat(wxWindow *parent,marInterface *mar)
3776 : wxPanel(parent, -1)
3778 printf("EED wxMaracasNoteBookSTLFormat::wxMaracasNoteBookSTLFormat 01 \n");
3779 _noteBook_general = new wxNotebook(this, -1);
3780 _noteBook_general->SetSize(550,300);
3781 wxImageList *imageList = new wxImageList(50,50);
3783 wxBitmap mask= wxBITMAP( TOOLBAR_V2_sm_mask );
3785 wxBitmap bitmap0 = wxBITMAP( TOOLBAR_V2_sm_bl_STLFormat );
3786 bitmap0.SetMask(new wxMask( mask ));
3789 imageList->Add( bitmap0 ); // 0
3790 _noteBook_general->SetImageList(imageList);
3792 // wxPanel *panel01 = CreateSTLFormat_01( _noteBook_general , mar );
3793 // wxPanel *panel02 = CreateSTLFormat_02( _noteBook_general , mar );
3794 wxPanel *panel03 = CreateSTLFormat_03( _noteBook_general , mar );
3796 // _noteBook_general->AddPage( panel01 , _T("STL Format 01 "), true, 0 );
3797 // _noteBook_general->AddPage( panel02 , _T("STL Format 02 " ), true, 0 );
3798 _noteBook_general->AddPage( panel03 , _T("STL Format 03 ") , true, 0 );
3799 _noteBook_general->SetSelection(0);
3802 wxStaticText *title=new wxStaticText(this,-1,_T("STL Format"));
3804 // It doesn't works in linux
3805 // wxFont font(18,wxDEFAULT , wxITALIC, wxBOLD);
3806 // title->SetFont(font);
3808 wxBoxSizer *sizer= new wxBoxSizer(wxVERTICAL);
3809 sizer->Add( title , 0, wxEXPAND | wxALIGN_RIGHT, 10);
3810 sizer->Add( _noteBook_general , 1, wxGROW, 10 );
3815 sizer->SetSizeHints( this ); // set size hints to honour minimum size
3816 this->SetSizer(sizer);
3817 this->SetAutoLayout(true);
3819 printf("EED wxMaracasNoteBookSTLFormat::wxMaracasNoteBookSTLFormat 02 \n");
3823 //----------------------------------------------------------------------------
3825 wxMaracasNoteBookSTLFormat::~wxMaracasNoteBookSTLFormat()
3830 //----------------------------------------------------------------------------
3832 wxPanel *wxMaracasNoteBookSTLFormat::CreateSTLFormat_01(wxWindow *parent,marInterface *mar)
3835 wxSTLWidget_02 *stlWidget = new wxSTLWidget_02(parent,mar);
3836 stlWidget->ConfigureVTK();
3842 //----------------------------------------------------------------------------
3844 wxPanel *wxMaracasNoteBookSTLFormat::CreateSTLFormat_02(wxWindow *parent,marInterface *mar)
3846 wxPanel *panel = new wxPanel(parent,-1);
3849 _wxmaracassurfaceSTLwidget=NULL;
3851 _noteBook_01 = new wxNotebook(panel, -1);
3852 _noteBook_01->SetSize(550,300);
3854 wxImageList *imageList = new wxImageList(50,50);
3855 imageList->Add( wxBITMAP( TOOLBAR_V2_sm_bl_AxisExtraction ) ); // 0
3856 imageList->Add( wxBITMAP( TOOLBAR_V2_sm_bl_STLFormat ) ); // 1
3857 imageList->Add( wxBITMAP( TOOLBAR_V2_sm_tr_STLFormat ) ); // 2
3858 _noteBook_01->SetImageList(imageList);
3862 _mar=new marInterface();
3863 _mar->_parameters->setRescaleSlope( mar->_parameters->getRescaleSlope() );
3864 _mar->_parameters->setRescaleIntercept( mar->_parameters->getRescaleIntercept() );
3865 _mar->_parameters->setIntParam( marParameters::e_voxel_type, marParameters::VOX_TYPE_MINIMUM );
3866 _mar->_parameters->setDoubleParam( marParameters::e_voxel_x_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_x_dimension) );
3867 _mar->_parameters->setDoubleParam( marParameters::e_voxel_y_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_y_dimension) );
3868 _mar->_parameters->setDoubleParam( marParameters::e_voxel_z_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_z_dimension) );
3870 mar->_experiment->getVOI( voi );
3871 _mar->_experiment->setVOI( voi );
3872 _mar->SetDicom(mar->_dicom);
3874 _mar->initExperiment( );
3876 vtkImageData *marImageData;
3877 marImageData = _mar->_experiment->getDynData( )->getVolume( )->castVtk();
3878 marImageData->Update();
3880 _wxmaracas3dbrowser = new wxMaracas3DBrowser( _noteBook_01, _mar, -1,ID_TOOLBAR_PLANS );
3881 _wxmaracas3dbrowser->LoadData( );
3883 _noteBook_01->AddPage(_wxmaracas3dbrowser,_T("Axis Extraction >> "), true, 0 );
3884 _noteBook_01->AddPage(new wxPanel(_noteBook_01,-1),_T("STL"), true, 2 );
3885 _noteBook_01->SetSelection(0);
3887 Connect(_noteBook_01->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , (wxObjectEventFunction) &wxMaracasNoteBookSTLFormat::OnChangePageSTLFormat );
3888 Connect(_noteBook_01->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , (wxObjectEventFunction) &wxMaracasNoteBookSTLFormat::OnChangePage );
3890 wxStaticText *title=new wxStaticText(panel,-1,_T(" STL - 01 (MATHIEU) "));
3892 // It doesn't works in linux
3893 // wxFont font(18,wxDEFAULT , wxITALIC, wxBOLD);
3894 // title->SetFont(font);
3896 wxBoxSizer *sizer= new wxBoxSizer(wxVERTICAL);
3897 sizer->Add( title , 0, wxEXPAND | wxALIGN_RIGHT, 10);
3898 sizer->Add( _noteBook_01 , 1, wxGROW , 10 );
3903 sizer->SetSizeHints( panel ); // set size hints to honour minimum size
3904 panel->SetSizer(sizer);
3905 panel->SetAutoLayout(true);
3911 //----------------------------------------------------------------------------
3913 wxPanel *wxMaracasNoteBookSTLFormat::CreateSTLFormat_03(wxWindow *parent,marInterface *mar)
3916 wxSTLWidget_03 *stlWidget = new wxSTLWidget_03(parent,mar);
3917 stlWidget->ConfigureVTK();
3923 //----------------------------------------------------------------------------
3925 void wxMaracasNoteBookSTLFormat::OnChangePage(wxNotebookEvent& event)
3927 if (_noteBook_01->GetSelection()==1){
3928 if (_wxmaracassurfaceSTLwidget!=NULL)
3930 delete _wxmaracassurfaceSTLwidget;
3932 _wxmaracassurfaceSTLwidget = new wxSurfaceSTLWidget( _noteBook_01->GetPage(1) );
3933 _wxmaracassurfaceSTLwidget->ShowMARACASData( _mar );
3934 wxBoxSizer *sizer= new wxBoxSizer(wxHORIZONTAL);
3935 sizer->Add( _wxmaracassurfaceSTLwidget , 1, wxALL|wxEXPAND, 0);
3936 _noteBook_01->GetPage(1)->SetAutoLayout(true);
3937 _noteBook_01->GetPage(1)->SetSizer(sizer);
3938 _noteBook_01->GetPage(1)->Layout();
3943 //----------------------------------------------------------------------------
3945 void wxMaracasNoteBookSTLFormat::OnChangePageSTLFormat(wxNotebookEvent& event)
3947 if (_noteBook_01->GetSelection()==0){
3948 if (_existAxis == false )
3950 wxMessageDialog msg(this, _T("You have to extract the axis befor run this option.."), _T("Message box"), wxOK );
3958 //----------------------------------------------------------------------------
3960 void wxMaracasNoteBookSTLFormat::OnNewAxis(wxCommandEvent &WXUNUSED(event))
3963 _noteBook_01->SetPageImage(1, 1);
3966 //----------------------------------------------------------------------------
3967 void wxMaracasNoteBookSTLFormat::OnDeleteAxis(wxCommandEvent &WXUNUSED(event))
3970 _noteBook_01->SetPageImage(1, 2);
3974 //----------------------------------------------------------------------------
3975 //----------------------------------------------------------------------------
3976 //----------------------------------------------------------------------------
3979 BEGIN_EVENT_TABLE(wxMaracasNoteBookTests , wxPanel)
3981 // EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit)
3982 // EVT_MENU(MDI_REFRESH, MyChild::OnRefresh)
3983 // EVT_MENU(MDI_CHANGE_TITLE, MyChild::OnChangeTitle)
3984 // EVT_MENU(MDI_CHANGE_POSITION, MyChild::OnChangePosition)
3985 // EVT_MENU(MDI_CHANGE_SIZE, MyChild::OnChangeSize)
3986 // EVT_MENU(20001, wxMaracasNoteBookIRMQuantification::OnSelectPatientStudySerieImage)
3988 // EVT_SIZE(MyChild::OnSize)
3989 // EVT_MOVE(MyChild::OnMove)
3991 // EVT_CLOSE(wxMaracasPatientLstVoiChiFra::OnClose)
3992 // EVT_TOOL(wxSurfaceWidget::ID_BUTTON_NEW_AXIS, wxMaracasNoteBookTests::OnNewAxis )
3993 // EVT_TOOL(wxSurfaceWidget::ID_BUTTON_DELETE_AXIS,wxMaracasNoteBookTests::OnDeleteAxis )
3994 // EVT_TOOL(20005,wxMaracasNoteBookVascularTreeExtraction::OnQuantification)
4001 wxMaracasNoteBookTests::wxMaracasNoteBookTests(wxWindow *parent,marInterface *mar)
4002 : wxPanel(parent, -1)
4006 _noteBook = new wxNotebook(this, -1);
4007 _noteBook->SetSize(550,300);
4010 wxBitmap mask= wxBITMAP( TOOLBAR_V2_sm_mask );
4012 wxBitmap bitmap0 = wxBITMAP( TOOLBAR_V2_sm_bl_Processing );
4013 wxBitmap bitmap1 = wxBITMAP( TOOLBAR_V2_sm_bl_Processing );
4015 bitmap0.SetMask(new wxMask( mask ));
4016 bitmap1.SetMask(new wxMask( mask ));
4018 wxImageList *imageList = new wxImageList(50,50);
4019 imageList->Add( bitmap0 ); // 0
4020 imageList->Add( bitmap1 ); // 1
4021 _noteBook->SetImageList(imageList);
4024 _mar=new marInterface();
4025 _mar->_parameters->setRescaleSlope( mar->_parameters->getRescaleSlope() );
4026 _mar->_parameters->setRescaleIntercept( mar->_parameters->getRescaleIntercept() );
4027 _mar->_parameters->setIntParam( marParameters::e_voxel_type, marParameters::VOX_TYPE_MINIMUM );
4028 _mar->_parameters->setDoubleParam( marParameters::e_voxel_x_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_x_dimension) );
4029 _mar->_parameters->setDoubleParam( marParameters::e_voxel_y_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_y_dimension) );
4030 _mar->_parameters->setDoubleParam( marParameters::e_voxel_z_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_z_dimension) );
4032 mar->_experiment->getVOI( voi );
4033 _mar->_experiment->setVOI( voi );
4034 _mar->SetDicom(mar->_dicom);
4036 _mar->initExperiment( );
4038 vtkImageData *vtkimagedata;
4039 vtkimagedata = _mar->_experiment->getDynData( )->getVolume( )->castVtk();
4040 vtkimagedata->Update();
4041 marImageData *marimagedata = new marImageData(vtkimagedata);
4044 // _wxmanualcontourpanel = new wxMaracas_ManualContour_Panel( _noteBook );
4045 // _wxmanualcontourpanel->ConfigureVTK( marimagedata );
4046 // _noteBook->AddPage(_wxmanualcontourpanel,_T(" Manual Contour "), true, 0 );
4050 _wxMaracasEmptyPanel_3 = new wxMaracasEmptyPanel_3( _noteBook );
4051 _wxMaracasEmptyPanel_3->ConfigureVTK( marimagedata );
4052 _noteBook->AddPage(_wxMaracasEmptyPanel_3,_T(" 2 contornos Maria Alejandra "), true, 0 );
4055 _noteBook->AddPage(new wxPanel(_noteBook,-1),_T("?? "), true, 1 );
4058 _wxMaracas_ManualTree_MPR = new wxMaracas_ManualTree_MPR( _noteBook, marimagedata , _mar->_parameters->getVoxelSize());
4059 _wxMaracas_ManualTree_MPR->ConfigureVTK();
4060 _noteBook->AddPage(_wxMaracas_ManualTree_MPR,_T("Manual Tree E.Davila "), true, 1 );
4064 _wxMaracas_ManualSegmentation_MPR = new wxMaracas_ManualSegmentation_MPR( _noteBook, marimagedata , _mar->_parameters->getVoxelSize());
4065 _wxMaracas_ManualSegmentation_MPR->ConfigureVTK();
4066 _noteBook->AddPage(_wxMaracas_ManualSegmentation_MPR,_T("Manual Segmentation Diego "), true, 1 );
4069 _wxMaracas_SegmentationFM3D = new wxMaracas_SegmentationFM3D( _noteBook, marimagedata , _mar->_parameters->getVoxelSize());
4070 _wxMaracas_SegmentationFM3D->ConfigureVTK();
4071 _noteBook->AddPage(_wxMaracas_SegmentationFM3D,_T("Segmentation FM3D Diego "), true, 1 );
4076 //EED 4 oct 2006 information pour Loic
4077 // _wxMaracasEmptyPanel_4 = new wxMaracasEmptyPanel_4( _noteBook );
4078 // _wxMaracasEmptyPanel_4->ConfigureVTK( );
4079 // _noteBook->AddPage(_wxMaracasEmptyPanel_4,"Loic", true, 1 );
4081 _noteBook->SetSelection(0);
4082 Connect(_noteBook->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , (wxObjectEventFunction) &wxMaracasNoteBookTests::OnChangePageTests );
4083 Connect(_noteBook->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , (wxObjectEventFunction) &wxMaracasNoteBookTests::OnChangePage );
4085 wxStaticText *title=new wxStaticText(this,-1,_T("Tests..."));
4087 // It doesn't works in linux
4088 // wxFont font(18,wxDEFAULT , wxITALIC, wxBOLD);
4089 // title->SetFont(font);
4091 wxBoxSizer *sizer= new wxBoxSizer(wxVERTICAL);
4092 sizer->Add( title , 0, wxEXPAND | wxALIGN_RIGHT, 10);
4093 sizer->Add( _noteBook , 1, wxGROW, 10 );
4098 sizer->SetSizeHints( this ); // set size hints to honour minimum size
4099 this->SetSizer(sizer);
4100 this->SetAutoLayout(true);
4104 //----------------------------------------------------------------------------
4105 wxMaracasNoteBookTests::~wxMaracasNoteBookTests()
4109 //----------------------------------------------------------------------------
4110 void wxMaracasNoteBookTests::OnChangePage(wxNotebookEvent& event)
4115 //----------------------------------------------------------------------------
4116 void wxMaracasNoteBookTests::OnChangePageTests(wxNotebookEvent& event)
4122 //----------------------------------------------------------------------------
4123 //----------------------------------------------------------------------------
4124 //----------------------------------------------------------------------------
4127 BEGIN_EVENT_TABLE(wxMaracasNoteBookManualRegistration , wxPanel)
4132 wxMaracasNoteBookManualRegistration::wxMaracasNoteBookManualRegistration(wxWindow *parent,marInterface *mar)
4133 : wxPanel(parent, -1)
4137 _noteBook = new wxNotebook(this, -1);
4138 _noteBook->SetSize(550,300);
4141 wxBitmap mask= wxBITMAP( TOOLBAR_V2_sm_mask );
4143 wxBitmap bitmap0 = wxBITMAP( TOOLBAR_V2_sm_bl_Processing );
4144 wxBitmap bitmap1 = wxBITMAP( TOOLBAR_V2_sm_bl_Processing );
4146 bitmap0.SetMask(new wxMask( mask ));
4147 bitmap1.SetMask(new wxMask( mask ));
4149 wxImageList *imageList = new wxImageList(50,50);
4150 imageList->Add( bitmap0 ); // 0
4151 imageList->Add( bitmap1 ); // 1
4152 _noteBook->SetImageList(imageList);
4155 _mar=new marInterface();
4156 _mar->_parameters->setRescaleSlope( mar->_parameters->getRescaleSlope() );
4157 _mar->_parameters->setRescaleIntercept( mar->_parameters->getRescaleIntercept() );
4158 _mar->_parameters->setIntParam( marParameters::e_voxel_type, marParameters::VOX_TYPE_MINIMUM );
4159 _mar->_parameters->setDoubleParam( marParameters::e_voxel_x_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_x_dimension) );
4160 _mar->_parameters->setDoubleParam( marParameters::e_voxel_y_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_y_dimension) );
4161 _mar->_parameters->setDoubleParam( marParameters::e_voxel_z_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_z_dimension) );
4163 mar->_experiment->getVOI( voi );
4164 _mar->_experiment->setVOI( voi );
4165 _mar->SetDicom(mar->_dicom);
4167 _mar->initExperiment( );
4169 vtkImageData *imagedata;
4170 imagedata = _mar->_experiment->getDynData( )->getVolume( )->castVtk();
4171 imagedata->Update();
4172 marImageData *marimagedata=new marImageData(imagedata);
4174 _wxmanualregistration3D = new wxManualRegistration3D(_noteBook,marimagedata);
4175 _wxmanualregistration3D->ConfigureVTK();
4176 _noteBook->AddPage( _wxmanualregistration3D , _T("Manual registration 3D") , true, 0 );
4178 _noteBook->SetSelection(0);
4179 Connect(_noteBook->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , (wxObjectEventFunction) &wxMaracasNoteBookTests::OnChangePageTests );
4180 Connect(_noteBook->GetId() , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , (wxObjectEventFunction) &wxMaracasNoteBookTests::OnChangePage );
4182 wxStaticText *title=new wxStaticText(this,-1,_T("Manual registration"));
4184 // It doesn't works in linux
4185 // wxFont font(18,wxDEFAULT , wxITALIC, wxBOLD);
4186 // title->SetFont(font);
4188 wxBoxSizer *sizer= new wxBoxSizer(wxVERTICAL);
4189 sizer->Add( title , 0, wxEXPAND | wxALIGN_RIGHT, 10);
4190 sizer->Add( _noteBook , 1, wxGROW, 10 );
4192 sizer->SetSizeHints( this ); // set size hints to honour minimum size
4193 this->SetSizer(sizer);
4194 this->SetAutoLayout(true);
4198 //----------------------------------------------------------------------------
4199 wxMaracasNoteBookManualRegistration::~wxMaracasNoteBookManualRegistration()
4203 //----------------------------------------------------------------------------
4204 void wxMaracasNoteBookManualRegistration::OnChangePage(wxNotebookEvent& event)
4209 //----------------------------------------------------------------------------
4210 void wxMaracasNoteBookManualRegistration::OnChangePageTests(wxNotebookEvent& event)
4215 //----------------------------------------------------------------------------
4216 bool wxMaracasNoteBookManualRegistration::GetIfSecondVolumeExist()
4218 return _wxmanualregistration3D->GetIfSecondVolumeExist();
4220 //----------------------------------------------------------------------------
4221 void wxMaracasNoteBookManualRegistration::GenerateSecondVolume(marInterface *mar)
4223 _marB=new marInterface();
4224 _marB->_parameters->setRescaleSlope( mar->_parameters->getRescaleSlope() );
4225 _marB->_parameters->setRescaleIntercept( mar->_parameters->getRescaleIntercept() );
4226 _marB->_parameters->setIntParam( marParameters::e_voxel_type, marParameters::VOX_TYPE_MINIMUM );
4227 _marB->_parameters->setDoubleParam( marParameters::e_voxel_x_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_x_dimension) );
4228 _marB->_parameters->setDoubleParam( marParameters::e_voxel_y_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_y_dimension) );
4229 _marB->_parameters->setDoubleParam( marParameters::e_voxel_z_dimension, mar->_parameters->getDoubleParam(marParameters::e_voxel_z_dimension) );
4231 mar->_experiment->getVOI( voi );
4232 _marB->_experiment->setVOI( voi );
4233 _marB->SetDicom(mar->_dicom);
4235 _marB->initExperiment( );
4237 vtkImageData *vtkimagedata;
4238 vtkimagedata = _marB->_experiment->getDynData( )->getVolume( )->castVtk();
4239 vtkimagedata->Update();
4240 _wxmanualregistration3D->AddSecondVolume(new marImageData(vtkimagedata));