]> 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
364 //EED 2017-01-01 Migration VTK7
365 #if VTK_MAJOR_VERSION <= 5
366                                 // ..
367 #else
368                                 _ptsA->Modified();
369                                 _ptsB->Modified();
370 #endif
371
372                         _backX=xx;
373                         _backY=yy;
374                         _backZ=zz;
375                 } // if image
376
377 //EED 2016/02/19
378         vtkImageActor *imageactor = _imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor();
379         imageactor->SetInterpolate( GetVtkBaseData()->GetInterpolate() );
380 //EED 01nov2012
381                 UpdateColorWindowLevel();
382                 wxVtkBaseView::Refresh();
383         }
384 }
385
386 //-------------------------------------------------------------------
387 int wxVtkMPR2DView::GetActualSlice()   // virtual
388 {
389         int result;
390         if (_direction==0)
391         {
392                 result = (int)(GetVtkmprbasedata()->GetX());
393         }
394         if (_direction==1)
395         {
396                 result = (int)(GetVtkmprbasedata()->GetY());
397         }
398         if (_direction==2)
399         {
400                 result = (int)(GetVtkmprbasedata()->GetZ());
401         }
402         return result;
403 }
404 //-------------------------------------------------------------------
405 void wxVtkMPR2DView::SetActualSlice(int slice)   // virtual
406 {
407         if (_direction==0)
408         {
409                 GetVtkmprbasedata()->SetX(slice);
410         }
411         if (_direction==1)
412         {
413                 GetVtkmprbasedata()->SetY(slice);
414         }
415         if (_direction==2)
416         {
417                 GetVtkmprbasedata()->SetZ(slice);
418         }
419 }
420 //-------------------------------------------------------------------
421 bool wxVtkMPR2DView::IfMouseTouchX(double x, double y, double z)
422 {
423         double delta=5;
424         bool result=false;
425         if (_direction==0)
426         {
427         }
428         if (_direction==1)
429         {
430                 if (( x<GetVtkmprbasedata()->GetX()+delta ) && ( x>GetVtkmprbasedata()->GetX()-delta ))
431                 {
432                         result = true;
433                 }
434         }
435         if (_direction==2)
436         {
437                 if (( x<GetVtkmprbasedata()->GetX()+delta ) && ( x>GetVtkmprbasedata()->GetX()-delta ))
438                 {
439                         result = true;
440                 }
441         }
442         return result;
443 }
444 //-------------------------------------------------------------------
445 bool wxVtkMPR2DView::IfMouseTouchY(double x, double y, double z)
446 {
447         double delta=5;
448         bool result=false;
449         if (_direction==0)
450         {
451                 if (( y<GetVtkmprbasedata()->GetY()+delta ) && ( y>GetVtkmprbasedata()->GetY()-delta ))
452                 {
453                         result = true;
454                 }
455         }
456         if (_direction==1)
457         {
458         }
459         if (_direction==2)
460         {
461                 if (( y<GetVtkmprbasedata()->GetY()+delta ) && ( y>GetVtkmprbasedata()->GetY()-delta ))
462                 {
463                         result = true;
464                 }
465         }
466         return result;
467 }
468 //-------------------------------------------------------------------
469 bool wxVtkMPR2DView::IfMouseTouchZ(double x, double y, double z)
470 {
471         double delta=5;
472         bool result=false;
473         if (_direction==0)
474         {
475                 if (( z<GetVtkmprbasedata()->GetZ()+delta ) && ( z>GetVtkmprbasedata()->GetZ()-delta ))
476                 {
477                         result = true;
478                 }
479         }
480         if (_direction==1)
481         {
482                 if (( z<GetVtkmprbasedata()->GetZ()+delta ) && ( z>GetVtkmprbasedata()->GetZ()-delta ))
483                 {
484                         result = true;
485                 }
486         }
487         if (_direction==2)
488         {
489         }
490         return result;
491 }
492 //-------------------------------------------------------------------
493 void wxVtkMPR2DView::MoveX(double x, double y, double z)
494 {
495         if (_direction==0)
496         {
497         }
498         if (_direction==1)
499         {
500                 GetVtkmprbasedata()->SetX(x);
501         }
502         if (_direction==2)
503         {
504                 GetVtkmprbasedata()->SetX(x);
505         }
506 }
507 //-------------------------------------------------------------------
508 void wxVtkMPR2DView::MoveY(double x, double y, double z)
509 {
510         if (_direction==0)
511         {
512                 GetVtkmprbasedata()->SetY(y);
513         }
514         if (_direction==1)
515         {
516         }
517         if (_direction==2)
518         {
519                 GetVtkmprbasedata()->SetY(y);
520         }
521 }
522 //-------------------------------------------------------------------
523 void wxVtkMPR2DView::MoveZ(double x, double y, double z)
524 {
525         if (_direction==0)
526         {
527                 GetVtkmprbasedata()->SetZ(z);
528         }
529         if (_direction==1)
530         {
531                 GetVtkmprbasedata()->SetZ(z);
532         }
533         if (_direction==2)
534         {
535         }
536 }
537 //-------------------------------------------------------------------
538 void wxVtkMPR2DView::ChangeAxisColor(double x, double y, double z)
539 {
540         double c1r=1,c1g=1,c1b=0;
541         double c2r=1,c2g=0,c2b=0;
542
543         if (_direction==0)
544         {
545                 if (IfMouseTouchY(x,y,z)==true)
546                 {
547                         _lineBActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
548                 } else {
549                         _lineBActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
550                 }
551                 if (IfMouseTouchZ(x,y,z)==true)
552                 {
553                         _lineAActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
554                 } else {
555                         _lineAActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
556                 }
557         }
558
559         if (_direction==1)
560         {
561                 if (IfMouseTouchX(x,y,z)==true)
562                 {
563                         _lineBActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
564                 } else {
565                         _lineBActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
566                 }
567                 if (IfMouseTouchZ(x,y,z)==true)
568                 {
569                         _lineAActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
570                 } else {
571                         _lineAActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
572                 }
573         }
574
575         if (_direction==2)
576         {
577                 if (IfMouseTouchX(x,y,z)==true)
578                 {
579                         _lineBActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
580                 } else {
581                         _lineBActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
582                 }
583                 if (IfMouseTouchY(x,y,z)==true)
584                 {
585                         _lineAActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
586                 } else {
587                         _lineAActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
588                 }
589         }
590         Refresh();
591 }
592
593
594 //EED 5 juin 2009
595 //void wxVtkMPR2DView::TransfromCoordViewWorld(double &X, double &Y, double &Z, int type) // virtual
596 void wxVtkMPR2DView::TransFromCoordScreenToWorld(double &X, double &Y, double &Z, bool keepNormalDirection, int type) //virtual //keepNormalDirection=false, type=2
597 {
598
599         wxVtkBaseView::TransFromCoordScreenToWorld(X,Y,Z,keepNormalDirection,_direction);
600
601         if ((_direction==0) && (keepNormalDirection==true) )
602         {
603                 X = ((vtkMPRBaseData*)GetVtkBaseData())->GetX();
604         }
605
606         if ((_direction==1) && (keepNormalDirection==true) )
607         {
608                 Y = ((vtkMPRBaseData*)GetVtkBaseData())->GetY();
609         }
610
611         if ((_direction==2) && (keepNormalDirection==true) )
612         {
613                 Z = ((vtkMPRBaseData*)GetVtkBaseData())->GetZ();
614         }
615
616 }
617
618 //-------------------------------------------------------------------
619 int wxVtkMPR2DView::GetDirection() // virtual
620 {
621     return _direction;
622 }
623
624
625 //-------------------------------------------------------------------
626 //-------------------------------------------------------------------
627 //-------------------------------------------------------------------
628 //void boxVolumeObserver::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) {  // virtual
629 //      if (eventId==vtkCommand::StartInteractionEvent){
630 //              _renWin->SetDesiredUpdateRate(10);
631 //      }
632 //      if (eventId==vtkCommand::InteractionEvent){
633 //              _renWin->SetDesiredUpdateRate(0.001);
634 //      }
635 //      if (eventId==vtkCommand::EndInteractionEvent){
636 //              vtkPlanes *planes = vtkPlanes::New();
637 //              vtkBoxWidget *boxwidget = reinterpret_cast<vtkBoxWidget*>(wdg);
638 //              boxwidget->GetPlanes(planes);
639 //              _volumeMapper->SetClippingPlanes(planes);
640 //              planes -> Delete();
641 //      }
642 //}
643
644 //-------------------------------------------------------------------
645 //void boxVolumeObserver::SetRenWin( vtkRenderWindow *renWin ){
646 //      _renWin = renWin;
647 //}
648 //-------------------------------------------------------------------
649 //void boxVolumeObserver::SetVolumeMapper(vtkVolumeRayCastMapper *volumeMapper){
650 //      _volumeMapper = volumeMapper;
651 //}