]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx
#3109 creaMaracasVisu Bug New Normal - branch vtk7itk4 compilation with vtk7
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxVtkMPR2DView.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 #include "wxVtkMPR2DView.h"
27
28 #include "vtkInteractorStyleBaseView.h"
29
30 #include "vtkCellArray.h"
31 #include "vtkImageActor.h"
32
33 #ifdef WIN32
34 #include <mathdefs.h>
35 using namespace gtm;
36 #endif
37
38 wxVtkMPR2DView::wxVtkMPR2DView( wxWindow *parent, int direction)
39  :wxVtk2DBaseView(parent)
40 {
41         _backX                  = -99999;
42         _backY                  = -99999;
43         _backZ                  = -99999;
44         _direction              = direction;
45         _ptsA                   = NULL;
46         _lineAActor             = NULL;
47         _lineAMapper    = NULL;
48         _pdA                    = NULL;
49         _ptsB                   = NULL;
50         _lineBActor             = NULL;
51         _lineBMapper    = NULL;
52         _pdB                    = NULL;
53         _interactorstylemprview = NULL;
54 }
55
56 //-------------------------------------------------------------------
57 wxVtkMPR2DView::~wxVtkMPR2DView()
58 {
59         if (_ptsA!=NULL)            { _ptsA                 -> Delete(); }
60         if (_lineAActor!=NULL)  { _lineAActor   -> Delete(); }
61         if (_lineAMapper!=NULL) { _lineAMapper  -> Delete(); }
62         if (_pdA!=NULL)             { _pdA                  -> Delete(); }
63         if (_ptsB!=NULL)            { _ptsB                 -> Delete(); }
64         if (_lineBActor!=NULL)  { _lineBActor   -> Delete(); }
65         if (_lineBMapper!=NULL) { _lineBMapper  -> Delete(); }
66         if (_pdB!=NULL)             { _pdB                  -> Delete(); }
67 }
68 //-------------------------------------------------------------------
69 vtkMPRBaseData *wxVtkMPR2DView::GetVtkmprbasedata()
70 {
71         return (vtkMPRBaseData*)GetVtkBaseData();
72 }
73 //-------------------------------------------------------------------
74 void wxVtkMPR2DView::Configure()
75 {
76         wxVtk2DBaseView::Configure();
77         int x1,x2,y1,y2,z1,z2;
78         GetVtkmprbasedata()     -> GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
79         double spc[3];
80         vtkImageData* img =  GetVtkmprbasedata()->GetImageData();
81         if(_interactorstylemprview==NULL)
82         {
83                 _interactorstylemprview = new vtkInteractorStyleMPRView();
84                 ((vtkInteractorStyleBaseView*)GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _interactorstylemprview );
85         }
86
87         if(img!=NULL){
88                 double* origin = img->GetOrigin();
89                 img->GetExtent(x1,x2,y1,y2,z1,z2);
90                 img->GetSpacing(spc);
91                 x1 += origin[0];
92                 x2 += origin[0];
93                 y1 += origin[1];
94                 y2 += origin[1];
95                 z1 += origin[2];
96                 z2 += origin[2];
97                 x1 = (int)(x1*spc[0]);
98                 y1 = (int)(y1*spc[1]);
99                 z1 = (int)(z1*spc[2]);
100                 x2 = (int)(x2*spc[0]);
101                 y2 = (int)(y2*spc[1]);
102                 z2 = (int)(z2*spc[2]);
103                 _visibleAxis = true;
104         }
105
106         // Axe A
107         if(_lineAActor==NULL){
108                 _lineAActor = vtkActor::New();
109                 _lineAActor->GetProperty()->SetDiffuseColor(1,0,0);
110                 _lineAActor->GetProperty()->SetLineWidth(0.5);
111
112                 _ptsA = vtkPoints::New();
113                 _ptsA->SetNumberOfPoints(2);
114                 _ptsA->SetPoint(0, -1000        , -1000 , -1000 );
115                 _ptsA->SetPoint(1,  1000        ,  1000 ,  1000 );
116                 _pdA = vtkPolyData::New();
117                 _lineAMapper = vtkPolyDataMapper::New();
118
119 //EED 2017-01-01 Migration VTK7
120 #if VTK_MAJOR_VERSION <= 5
121                 _lineAMapper->SetInput(_pdA);
122 #else
123                 _lineAMapper->SetInputData(_pdA);
124 #endif
125
126                 _lineAMapper->ImmediateModeRenderingOn();
127                 _lineAActor->SetMapper(_lineAMapper);
128         }
129
130         vtkCellArray *linesA = vtkCellArray::New();
131         linesA->InsertNextCell(2);
132         linesA->InsertCellPoint(0);
133         linesA->InsertCellPoint(1);
134         _pdA->SetPoints( _ptsA );
135         _pdA->SetLines( linesA );
136         linesA->Delete();  //do not delete lines ??
137 //              _lineAActor->GetProperty()->BackfaceCullingOn();
138
139
140 // Axe B
141         if(_lineBActor==NULL){
142                 _lineBActor                                             =       vtkActor::New();
143                 _lineBActor->GetProperty()->SetDiffuseColor(1,0,0);
144                 _lineBActor->GetProperty()->SetLineWidth(0.5);
145                 _lineBMapper                                    =       vtkPolyDataMapper::New();
146                 _lineBActor->SetMapper(_lineBMapper);
147                 _ptsB = vtkPoints::New();
148                 _ptsB->SetNumberOfPoints(2);
149                 _ptsB->SetPoint(0, -1000        , -1000 , -1000 );
150                 _ptsB->SetPoint(1,  1000        ,  1000 ,  1000 );
151 //              _lineBActor->GetProperty()->BackfaceCullingOn();
152         }
153
154         vtkCellArray *linesB;
155         linesB = vtkCellArray::New();
156         linesB->InsertNextCell(2);
157         linesB->InsertCellPoint(0);
158         linesB->InsertCellPoint(1);
159         _pdB = vtkPolyData::New();
160         _pdB->SetPoints( _ptsB );
161         _pdB->SetLines( linesB );
162         linesB->Delete();  //do not delete lines ??
163
164 //EED 2017-01-01 Migration VTK7
165 #if VTK_MAJOR_VERSION <= 5
166         _lineBMapper->SetInput(_pdB);
167 #else
168         _lineBMapper->SetInputData(_pdB);
169 #endif
170
171         _lineBMapper->ImmediateModeRenderingOn();
172         if(_imageViewer2XYZ){
173                 _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor );
174                 _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor );
175                 vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
176
177         //EED 17Avril2009
178     //EED 21 mars 2012  FLIP problem  ..PLOP..
179
180                 if (_direction==0) {  // YZ
181                         camera->SetViewUp               (   0   ,    0          ,     1         );
182                         camera->SetPosition             ( 10000,(y1+y2)/2       , (z1+z2)/2     );
183                         camera->SetFocalPoint   (   0   , (y1+y2)/2     , (z1+z2)/2     );
184                         camera->SetParallelScale( (z2-z1)/3.0 );
185                 }
186
187                 if (_direction==1) { // XZ
188                         camera->SetViewUp               (       0               ,       0       ,       1               );
189                         camera->SetPosition             ((x1+x2)/2      , -10000        , (z1+z2)/2     );
190                         camera->SetFocalPoint   ((x1+x2)/2      ,   0   , (z1+z2)/2     );
191                         camera->SetParallelScale( (x2-x1)/3.0 );
192                 }
193
194                 if (_direction==2) {  // XY
195                         camera->SetViewUp               (       0               ,       -1              ,       0       );
196                         camera->SetPosition             ((x1+x2)/2      , (y1+y2)/2     , -10000);
197                         camera->SetFocalPoint   ((x1+x2)/2      , (y1+y2)/2     ,       0       );
198                         camera->SetParallelScale( (x2-x1)/3.0 );
199                 }
200
201 /*
202                 if (_direction==0) {    // YZ
203                         camera->SetViewUp               (   0   ,     1         ,     0         );
204                         camera->SetPosition             (  10000,(y1+y2)/2      , (z1+z2)/2     );
205                         camera->SetFocalPoint   (   0   , (y1+y2)/2     , (z1+z2)/2     );
206                         camera->SetParallelScale( (z2-z1)/3.0 );
207                 }
208
209                 if (_direction==1) {    // XZ
210                         camera->SetViewUp               (       0               ,       0       ,       -1              );
211                         camera->SetPosition             ((x1+x2)/2      , 10000 , (z1+z2)/2     );
212                         camera->SetFocalPoint   ((x1+x2)/2      ,   0   , (z1+z2)/2     );
213                         camera->SetParallelScale( (x2-x1)/3.0 );
214                 }
215
216                 if (_direction==2) {    // XY
217                         camera->SetViewUp               (       0               ,       1               ,       0       );
218                         camera->SetPosition             ((x1+x2)/2      , (y1+y2)/2     ,  10000);
219                         camera->SetFocalPoint   ((x1+x2)/2      , (y1+y2)/2     ,       0       );
220                         camera->SetParallelScale( (x2-x1)/3.0 );
221                 }
222 */
223
224         //      _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow (160);
225         //      _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel (800);
226         }
227 }
228
229 void wxVtkMPR2DView::SetVisibleAxis(bool ok)
230 {
231         if (ok!=_visibleAxis)
232         {
233                 _visibleAxis=ok;
234                 if (_visibleAxis==true)
235                 {
236                         _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor );
237                         _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor );
238                 }
239                 if (_visibleAxis==false)
240                 {
241                         _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->RemoveActor( _lineAActor );
242                         _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->RemoveActor( _lineBActor );
243                 }
244
245         }
246 }
247
248 //-------------------------------------------------------------------
249 void wxVtkMPR2DView::Refresh()
250 {
251         //wxVtk2DBaseView::Refresh();
252         int x1 = 0,x2 = 0,y1 = 0,y2 = 0,z1 = 0,z2 = 0;
253
254 //EED 02/08/2013
255 //      int x = 0, y = 0, z = 0;
256         double x = 0, y = 0, z = 0;
257
258         int xx = 0, yy = 0, zz = 0;
259         double *spc     = 0;
260         double *origin  = 0;
261         
262         double xx1,yy1,zz1,xx2,yy2,zz2;
263         
264         vtkImageData* img = GetVtkmprbasedata()->GetImageData();
265         if(img!=NULL)
266         {
267                 origin = img->GetOrigin();
268                 img->GetExtent(x1,x2,y1,y2,z1,z2);
269                 spc = img->GetSpacing();
270                 x1 += origin[0];
271                 x2 += origin[0];
272                 y1 += origin[1];
273                 y2 += origin[1];
274                 z1 += origin[2];
275                 z2 += origin[2];
276                 
277                 xx1 =           x1*spc[0];
278                 yy1 =           y1*spc[1];
279                 zz1 =           z1*spc[2];
280                 
281                 xx2 =           x2*spc[0];
282                 yy2 =           y2*spc[1];
283                 zz2 =           z2*spc[2];
284                 
285                 x1 = (int)(x1*spc[0]);
286                 y1 = (int)(y1*spc[1]);
287                 z1 = (int)(z1*spc[2]);
288                 
289                 x2      = (int)(x2*spc[0]);
290                 y2      = (int)(y2*spc[1]);
291                 z2      = (int)(z2*spc[2]);
292
293                 xx = (int)(GetVtkmprbasedata()->GetX());
294                 yy = (int)(GetVtkmprbasedata()->GetY());
295                 zz = (int)(GetVtkmprbasedata()->GetZ());
296
297 //EED 02/08/2013
298 //              x =  round(xx*spc[0]);
299 //              y =  round(yy*spc[1]);
300 //              z =  round(zz*spc[2]);
301
302                 x =  xx*spc[0];
303                 y =  yy*spc[1];
304                 z =  zz*spc[2];
305
306                 if ((xx!=_backX) || (yy!=_backY) || (zz!=_backZ)) 
307                 {
308
309                         if (_direction==0) {    // YZ
310                                 if(_imageViewer2XYZ)
311                                 {
312                                         _imageViewer2XYZ->SetXSlice( (int)(GetVtkmprbasedata()->GetX()) );
313                                 }
314 //EED 21 mars 2012  FLIP probleme  ..PLOP..
315                                 //_ptsA->SetPoint(0, x2, y1  , z );
316                                 //_ptsA->SetPoint(1, x2, y2  , z );
317                                 //_ptsB->SetPoint(0, x2, y   , z1);
318                                 //_ptsB->SetPoint(1, x2, y   , z2);
319                                 _ptsA->SetPoint(0, xx2, yy1  , z  );
320                                 _ptsA->SetPoint(1, xx2, yy2  , z  );
321                                 _ptsB->SetPoint(0, xx2, y    , zz1);
322                                 _ptsB->SetPoint(1, xx2, y    , zz2);
323                         }
324                         if (_direction==1) {    // XZ
325                                 if(_imageViewer2XYZ)
326                                 {
327                                         _imageViewer2XYZ->SetYSlice( (int)(GetVtkmprbasedata()->GetY()) );
328                                 }
329 //EED 21 mars 2012  FLIP probleme  ..PLOP..
330                             //_ptsA->SetPoint(0, x1 , y2 , z );
331                                 //_ptsA->SetPoint(1, x2 , y2 , z );
332                                 //_ptsB->SetPoint(0, x  , y2 , z1);
333                                 //_ptsB->SetPoint(1, x  , y2 , z2);
334                             _ptsA->SetPoint(0, xx1 , y1 , z  );
335                                 _ptsA->SetPoint(1, xx2 , y1 , z  );
336                                 _ptsB->SetPoint(0, x   , y1 , zz1);
337                                 _ptsB->SetPoint(1, x   , y1 , zz2);
338                         }
339                         if (_direction==2) {    // XY
340                                 if(_imageViewer2XYZ)
341                                 {
342                                         _imageViewer2XYZ->SetZSlice( (int)(GetVtkmprbasedata()->GetZ()) );
343                                 }
344                         //      _ptsA->SetPoint(0, x1 , y , -z2 );
345                         //      _ptsA->SetPoint(1, x2 , y , -z2 );
346                         //      _ptsB->SetPoint(0, x  , y1, -z2 );
347                         //      _ptsB->SetPoint(1, x  , y2, -z2 );
348
349                                 
350 //EED 21 mars 2012  FLIP probleme  ..PLOP..
351                                 //_ptsA->SetPoint(0, x1 , y , z2 );
352                                 //_ptsA->SetPoint(1, x2 , y , z2 );
353                                 //_ptsB->SetPoint(0, x  , y1, z2 );
354                                 //_ptsB->SetPoint(1, x  , y2, z2 );
355                                 
356                                 _ptsA->SetPoint(0, xx1 , y  , z1 );
357                                 _ptsA->SetPoint(1, xx2 , y  , z1 );
358                                 _ptsB->SetPoint(0, x   , yy1, z1 );
359                                 _ptsB->SetPoint(1, x   , yy2, z1 );
360                                 
361                                 
362                         } // if back
363                         _backX=xx;
364                         _backY=yy;
365                         _backZ=zz;
366                 } // if image
367
368 //EED 2016/02/19
369         vtkImageActor *imageactor = _imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor();
370         imageactor->SetInterpolate( GetVtkBaseData()->GetInterpolate() );
371 //EED 01nov2012
372                 UpdateColorWindowLevel();
373                 wxVtkBaseView::Refresh();
374         }
375 }
376
377 //-------------------------------------------------------------------
378 int wxVtkMPR2DView::GetActualSlice()   // virtual
379 {
380         int result;
381         if (_direction==0)
382         {
383                 result = (int)(GetVtkmprbasedata()->GetX());
384         }
385         if (_direction==1)
386         {
387                 result = (int)(GetVtkmprbasedata()->GetY());
388         }
389         if (_direction==2)
390         {
391                 result = (int)(GetVtkmprbasedata()->GetZ());
392         }
393         return result;
394 }
395 //-------------------------------------------------------------------
396 void wxVtkMPR2DView::SetActualSlice(int slice)   // virtual
397 {
398         if (_direction==0)
399         {
400                 GetVtkmprbasedata()->SetX(slice);
401         }
402         if (_direction==1)
403         {
404                 GetVtkmprbasedata()->SetY(slice);
405         }
406         if (_direction==2)
407         {
408                 GetVtkmprbasedata()->SetZ(slice);
409         }
410 }
411 //-------------------------------------------------------------------
412 bool wxVtkMPR2DView::IfMouseTouchX(double x, double y, double z)
413 {
414         double delta=5;
415         bool result=false;
416         if (_direction==0)
417         {
418         }
419         if (_direction==1)
420         {
421                 if (( x<GetVtkmprbasedata()->GetX()+delta ) && ( x>GetVtkmprbasedata()->GetX()-delta ))
422                 {
423                         result = true;
424                 }
425         }
426         if (_direction==2)
427         {
428                 if (( x<GetVtkmprbasedata()->GetX()+delta ) && ( x>GetVtkmprbasedata()->GetX()-delta ))
429                 {
430                         result = true;
431                 }
432         }
433         return result;
434 }
435 //-------------------------------------------------------------------
436 bool wxVtkMPR2DView::IfMouseTouchY(double x, double y, double z)
437 {
438         double delta=5;
439         bool result=false;
440         if (_direction==0)
441         {
442                 if (( y<GetVtkmprbasedata()->GetY()+delta ) && ( y>GetVtkmprbasedata()->GetY()-delta ))
443                 {
444                         result = true;
445                 }
446         }
447         if (_direction==1)
448         {
449         }
450         if (_direction==2)
451         {
452                 if (( y<GetVtkmprbasedata()->GetY()+delta ) && ( y>GetVtkmprbasedata()->GetY()-delta ))
453                 {
454                         result = true;
455                 }
456         }
457         return result;
458 }
459 //-------------------------------------------------------------------
460 bool wxVtkMPR2DView::IfMouseTouchZ(double x, double y, double z)
461 {
462         double delta=5;
463         bool result=false;
464         if (_direction==0)
465         {
466                 if (( z<GetVtkmprbasedata()->GetZ()+delta ) && ( z>GetVtkmprbasedata()->GetZ()-delta ))
467                 {
468                         result = true;
469                 }
470         }
471         if (_direction==1)
472         {
473                 if (( z<GetVtkmprbasedata()->GetZ()+delta ) && ( z>GetVtkmprbasedata()->GetZ()-delta ))
474                 {
475                         result = true;
476                 }
477         }
478         if (_direction==2)
479         {
480         }
481         return result;
482 }
483 //-------------------------------------------------------------------
484 void wxVtkMPR2DView::MoveX(double x, double y, double z)
485 {
486         if (_direction==0)
487         {
488         }
489         if (_direction==1)
490         {
491                 GetVtkmprbasedata()->SetX(x);
492         }
493         if (_direction==2)
494         {
495                 GetVtkmprbasedata()->SetX(x);
496         }
497 }
498 //-------------------------------------------------------------------
499 void wxVtkMPR2DView::MoveY(double x, double y, double z)
500 {
501         if (_direction==0)
502         {
503                 GetVtkmprbasedata()->SetY(y);
504         }
505         if (_direction==1)
506         {
507         }
508         if (_direction==2)
509         {
510                 GetVtkmprbasedata()->SetY(y);
511         }
512 }
513 //-------------------------------------------------------------------
514 void wxVtkMPR2DView::MoveZ(double x, double y, double z)
515 {
516         if (_direction==0)
517         {
518                 GetVtkmprbasedata()->SetZ(z);
519         }
520         if (_direction==1)
521         {
522                 GetVtkmprbasedata()->SetZ(z);
523         }
524         if (_direction==2)
525         {
526         }
527 }
528 //-------------------------------------------------------------------
529 void wxVtkMPR2DView::ChangeAxisColor(double x, double y, double z)
530 {
531         double c1r=1,c1g=1,c1b=0;
532         double c2r=1,c2g=0,c2b=0;
533
534         if (_direction==0)
535         {
536                 if (IfMouseTouchY(x,y,z)==true)
537                 {
538                         _lineBActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
539                 } else {
540                         _lineBActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
541                 }
542                 if (IfMouseTouchZ(x,y,z)==true)
543                 {
544                         _lineAActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
545                 } else {
546                         _lineAActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
547                 }
548         }
549
550         if (_direction==1)
551         {
552                 if (IfMouseTouchX(x,y,z)==true)
553                 {
554                         _lineBActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
555                 } else {
556                         _lineBActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
557                 }
558                 if (IfMouseTouchZ(x,y,z)==true)
559                 {
560                         _lineAActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
561                 } else {
562                         _lineAActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
563                 }
564         }
565
566         if (_direction==2)
567         {
568                 if (IfMouseTouchX(x,y,z)==true)
569                 {
570                         _lineBActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
571                 } else {
572                         _lineBActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
573                 }
574                 if (IfMouseTouchY(x,y,z)==true)
575                 {
576                         _lineAActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
577                 } else {
578                         _lineAActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
579                 }
580         }
581         Refresh();
582 }
583
584
585 //EED 5 juin 2009
586 //void wxVtkMPR2DView::TransfromCoordViewWorld(double &X, double &Y, double &Z, int type) // virtual
587 void wxVtkMPR2DView::TransFromCoordScreenToWorld(double &X, double &Y, double &Z, bool keepNormalDirection, int type) //virtual //keepNormalDirection=false, type=2
588 {
589
590         wxVtkBaseView::TransFromCoordScreenToWorld(X,Y,Z,keepNormalDirection,_direction);
591
592         if ((_direction==0) && (keepNormalDirection==true) )
593         {
594                 X = ((vtkMPRBaseData*)GetVtkBaseData())->GetX();
595         }
596
597         if ((_direction==1) && (keepNormalDirection==true) )
598         {
599                 Y = ((vtkMPRBaseData*)GetVtkBaseData())->GetY();
600         }
601
602         if ((_direction==2) && (keepNormalDirection==true) )
603         {
604                 Z = ((vtkMPRBaseData*)GetVtkBaseData())->GetZ();
605         }
606
607 }
608
609 //-------------------------------------------------------------------
610 int wxVtkMPR2DView::GetDirection() // virtual
611 {
612     return _direction;
613 }
614
615
616 //-------------------------------------------------------------------
617 //-------------------------------------------------------------------
618 //-------------------------------------------------------------------
619 //void boxVolumeObserver::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) {  // virtual
620 //      if (eventId==vtkCommand::StartInteractionEvent){
621 //              _renWin->SetDesiredUpdateRate(10);
622 //      }
623 //      if (eventId==vtkCommand::InteractionEvent){
624 //              _renWin->SetDesiredUpdateRate(0.001);
625 //      }
626 //      if (eventId==vtkCommand::EndInteractionEvent){
627 //              vtkPlanes *planes = vtkPlanes::New();
628 //              vtkBoxWidget *boxwidget = reinterpret_cast<vtkBoxWidget*>(wdg);
629 //              boxwidget->GetPlanes(planes);
630 //              _volumeMapper->SetClippingPlanes(planes);
631 //              planes -> Delete();
632 //      }
633 //}
634
635 //-------------------------------------------------------------------
636 //void boxVolumeObserver::SetRenWin( vtkRenderWindow *renWin ){
637 //      _renWin = renWin;
638 //}
639 //-------------------------------------------------------------------
640 //void boxVolumeObserver::SetVolumeMapper(vtkVolumeRayCastMapper *volumeMapper){
641 //      _volumeMapper = volumeMapper;
642 //}