]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/tcl/wrap_maracas.i
creaMaracasVisu Library
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / tcl / wrap_maracas.i
1 %module maracas
2
3 %{
4 #include <wx/list.h>
5 #include <wx/string.h>
6 #include <vtkCellLocator.h>
7 #include <vtkImageData.h>
8 #include <vtkPolyData.h>
9 #include <vtkTclUtil.h>
10 #include "marTclInterface.h"
11 %}
12
13 %include typemaps.i
14
15 %typemap(tcl8,in) std::string& {
16
17     int l;
18     $target = new std::string( Tcl_GetStringFromObj( $source, &l ) );
19
20 }
21
22 %typemap(tcl8,freearg) std::string& {
23
24     delete $source;
25
26 }
27
28 %typemap(tcl8,out) std::string {
29
30
31     Tcl_AppendElement( interp, $source->c_str( ) );
32
33 }
34
35 %typemap(tcl8,in) wxStringList& {
36
37     int l, i, s;
38     Tcl_Obj *tmp;
39
40     $target = new wxStringList;
41     Tcl_ListObjLength( interp, $source, &l );
42     for( i = 0; i < l; i++ ) {
43
44         Tcl_ListObjIndex( interp, $source, i, &tmp );
45         $target->Add( Tcl_GetStringFromObj( tmp, &s ) );
46
47     } // rof
48
49 }
50
51 %typemap(tcl8,freearg) wxStringList& {
52
53     delete $source;
54
55 }
56
57 %typemap(tcl8,out) wxStringList& {
58
59     unsigned int i = 0;
60
61     for( i = 0; i < $source->GetCount( ); i++ ) {
62
63         Tcl_AppendElement( interp, ( *$source )[ i ] );
64
65     } // rof
66
67 }
68
69 %typemap(tcl8,in) int * {
70
71     int* c = NULL;
72     int l, i;
73     Tcl_Obj *tmp;
74
75     Tcl_ListObjLength( interp, $source, &l );
76     c = new int [ l ];
77     for( i = 0; i < l; i++ ) {
78
79         Tcl_ListObjIndex( interp, $source, i, &tmp );
80         Tcl_GetIntFromObj( interp, tmp, &c[ i ] );
81
82     } // rof
83
84     $target = c;
85
86 }
87
88 %typemap(tcl8,out) ushort * {
89
90     int i;
91     int tam;
92     char cad[ 100 ];
93
94     if( $source != NULL ) {
95
96         tam = ( int )$source[ 0 ];
97         for( i = 1; i <= tam; i++ ) {
98
99             sprintf( cad, "%d", $source[ i ] );
100             Tcl_AppendElement( interp, cad );
101
102         } // rof
103
104     } // fi
105
106 }
107
108 %typemap(tcl8,out) double * {
109
110     int i;
111     int tam;
112     char cad[ 100 ];
113
114     if( $source != NULL ) {
115
116         tam = ( int )$source[ 0 ];
117         for( i = 1; i <= tam; i++ ) {
118
119             sprintf( cad, "%f", $source[ i ] );
120             Tcl_AppendElement( interp, cad );
121
122         } // rof
123
124     } // fi
125
126 }
127
128 %typemap(tcl8,in) vtkCellLocator * {
129
130     int err, s;
131     Tcl_Obj* tmp;
132
133     Tcl_ListObjIndex( interp, $source, 0, &tmp );
134     $target = ( vtkCellLocator* ) vtkTclGetPointerFromObject( Tcl_GetStringFromObj( tmp, &s ), "vtkCellLocator", interp, err );
135
136 }
137
138 %typemap(tcl8,out) vtkImageData * {
139
140     int ( *command )( ClientData, Tcl_Interp*, int, char* [] ) = NULL;
141
142     // this function already sets the return    
143     vtkTclGetObjectFromPointer( interp, $source, command );
144
145 }
146
147 %typemap(tcl8,out) vtkPolyData * {
148
149     int ( *command )( ClientData, Tcl_Interp*, int, char* [] ) = NULL;
150
151     // this function already sets the return    
152     vtkTclGetObjectFromPointer( interp, $source, command );
153
154 }
155
156 // INTERFACE
157
158 void freeAllMaracasInterfaces_dll( );
159
160 // Parameters functions
161 wxStringList params_dll          ( );
162 void         setParams_dll          ( wxStringList& raParams );
163 bool         saveParams_dll         ( std::string& fName );
164 bool         loadParams_dll         ( std::string& fName );
165 void         SetROIStep_dll         ( double vWidth );
166 double       GetActualVoxelSize_dll ( );
167
168 // DB functions
169 wxStringList studies_dll   ( );
170 wxStringList studyData_dll ( std::string& study );
171 wxStringList series_dll    ( std::string& study );
172 wxStringList serieData_dll ( std::string& study, std::string& serie );
173 void SubtractSeries_dll( std::string& sl, std::string& sr, std::string& ss, std::string& description );
174
175 // Image functions
176 bool         LoadImages_dll        ( );
177 void         LoadTkImages_dll      ( wxStringList& tkNames, Tcl_Interp* interp );
178 int          GetNumberOfImages_dll ( );
179 wxStringList GetImagesNumbers_dll  ( );
180
181 double GetImageIntensity_dll ( int x, int y, int z );
182
183 ushort* GetProfilFromTotalVolume_dll( int xO, int yO, int zO, int xF, int yF, int zF );
184
185 %apply int *OUTPUT { int* min, int* max, int* avg, int* sd, int* size };
186 void GetAreaValuesFromTotalVolume_dll( int xO, int yO, int zO, int xF, int yF, int zF, int* min, int* max, int* avg, int* sd, int* size );
187
188 // Experiment functions
189 bool SaveExperiment_dll ( std::string& fName );
190 bool LoadExperiment_dll ( std::string& fName );
191 void InitExperiment_dll ( int* voi );
192 void SetStartPoint_dll  ( int x, int y, int z );
193 void ExtractAxes_dll    ( );
194
195 int          GetNumberOfAxes_dll     ( );
196 vtkPolyData* GetAllAxes_dll          ( );
197 vtkPolyData* GetActualAxis_dll       ( );
198 int GetActualAxisNumberOfPoints_dll  ( );
199 double* GetActualAxisPoint_dll       ( int i );
200 vtkImageData* GetActualAxisSlice_dll ( int i );
201
202 void PrepareQuantification_dll( int i );
203 double GetAxisLength_dll( );
204
205 // VTK data retrieving functions
206 %apply int *OUTPUT { int* min, int* max };
207 void          GetImageRange_dll ( int* min, int* max );
208 vtkImageData* GetVTKVolume_dll  ( );
209
210 // Functions to replace
211 %apply double *OUTPUT { double* xI, double* yI, double* zI };
212 extern int IntersectWithLine_dll ( vtkCellLocator* iCellLocator, double x1, double y1, double z1, double x2, double y2, double z2, double tol, double *xI, double *yI, double *zI );
213 %apply double *OUTPUT { double* xP1, double* yP1, double* zP1, double* xP2, double* yP2, double* zP2 };
214 extern void TclPerpendiculars_dll( double xN, double yN, double zN, double angle, double *xP1, double *yP1, double *zP1, double *xP2, double *yP2, double *zP2 );
215
216 // EOF - local_typemaps.i