]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/wxMaracas_ManualTree_MPRDlg.cxx
BUG text contour
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / wxMaracas_ManualTree_MPRDlg.cxx
1 /*=========================================================================
2
3   Program:   wxMaracas
4   Module:    $RCSfile: wxMaracas_ManualTree_MPRDlg.cxx,v $
5   Language:  C++
6   Date:      $Date: 2008/10/31 16:32:11 $
7   Version:   $Revision: 1.1 $
8
9   Copyright: (c) 2002, 2003
10   License:
11
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.
15
16 =========================================================================*/
17
18 #include "wxMaracas_ManualTree_MPRDlg.h"
19 #include <wx/splitter.h>
20
21
22 //----------------------------------------------------------------------------
23 //----------------------------------------------------------------------------
24 //----------------------------------------------------------------------------
25
26 wxMaracas_ManualTree_MPRDlg::wxMaracas_ManualTree_MPRDlg( wxWindow* parent, marImageData* marimagedata,double voxelSize)
27  : wxDialog( parent, -1,_T("Manual Axis"),wxDefaultPosition,wxDefaultSize,wxCAPTION|wxRESIZE_BORDER  | wxMAXIMIZE_BOX )
28 {       
29 //      SetSize(700,700);
30         Maximize(true);
31         _parent=parent;
32         wxSplitterWindow *splitPanel = new wxSplitterWindow(this ,-1);
33         _manualTreeMPR = new wxMaracas_ManualTree_MPR(splitPanel,marimagedata,voxelSize);
34         wxPanel *panel = new wxPanel (splitPanel, -1);
35
36         wxButton *btnAccept = new wxButton (panel, wxID_OK, _T("Accept"));
37         wxButton *btnCancel = new wxButton (panel, wxID_CANCEL, _T("Cancel"));
38
39         wxBoxSizer* sizerH1 = new wxBoxSizer( wxHORIZONTAL );
40         sizerH1->Add(btnAccept , 1, wxALL|wxEXPAND, 0);
41         sizerH1->Add(btnCancel , 1, wxALL|wxEXPAND, 0);
42         panel->SetAutoLayout(true);
43         panel->SetSizer(sizerH1);
44         Layout();
45 //EEDxx2.4
46 //      FitInside();
47
48
49         splitPanel->SplitHorizontally(_manualTreeMPR,panel );
50         splitPanel->SetMinimumPaneSize(50);
51
52         wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
53         sizer->Add(splitPanel , 1, wxALL|wxEXPAND, 0);
54         SetAutoLayout(true);
55         SetSizer(sizer);
56         Layout();
57 //EEDxx2.4
58 //      FitInside();
59 }
60
61 //----------------------------------------------------------------------------
62
63 wxMaracas_ManualTree_MPRDlg::~wxMaracas_ManualTree_MPRDlg()
64 {
65 }
66
67 //----------------------------------------------------------------------------
68
69 void wxMaracas_ManualTree_MPRDlg::ConfigureVTK()
70 {
71         wxBusyCursor wait;
72         _manualTreeMPR->ConfigureVTK();
73 }
74
75 //----------------------------------------------------------------------------
76
77 void wxMaracas_ManualTree_MPRDlg::SetMarAxis( marAxis *maraxis  )
78 {
79         _maraxis=maraxis;
80 }
81
82 //----------------------------------------------------------------------------
83 bool wxMaracas_ManualTree_MPRDlg::ExportPoints()
84 {
85         bool ok=false;
86         double t,x,y,z;
87         manualContourModel *manualcontourmodel = _manualTreeMPR->GetManualContourModel();
88
89         double spc[3];
90         _manualTreeMPR->GetVtkMPRBaseData()->GetImageData()->GetSpacing(spc);
91
92         int sizeLstPoints = manualcontourmodel->GetSizeLstPoints(); 
93
94         if ( sizeLstPoints>=2 ){ 
95                 manualcontourmodel->UpdateSpline();
96                 int i,max=200;
97 //JSTG 25-02-08 ---------------------------------------------------
98                 //double delta = ((double)sizeLstPoints-1) / (double)max;
99                 for (i=0;i<max;i++)
100                 {       
101                         //t=delta*(double)i;
102                         //manualcontourmodel->GetSplinePoint(t,x,y,z);
103                         manualcontourmodel->GetSpline_i_Point(i,&x,&y,&z);
104 //-----------------------------------------------------------------
105                         x=x*spc[0];
106                         y=y*spc[1];
107                         z=z*spc[2];
108                         _maraxis->AddPointToList(x, y, z,100);          
109                 }
110                 ok=true;
111         }
112         return ok;
113 }
114
115
116
117 // EOF - wxMaracas_ManualTree_MPRDlg.cxx
118
119
120
121