]> Creatis software - clitk.git/blob - vv/vvSlicerManagerCommand.cxx
[VV] New feature to jump on image origin
[clitk.git] / vv / vvSlicerManagerCommand.cxx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18 #include "vvSlicerManagerCommand.h"
19 #include "vvSlicerManager.h"
20
21 #include <vtkTextProperty.h>
22 #include <vtkRenderer.h>
23 #include <vtkImageActor.h>
24 #include <vtkRenderWindowInteractor.h>
25 #include <vtkPropPicker.h>
26 #include <vtkCamera.h>
27 #include <vtkImageMapToWindowLevelColors.h>
28 #include <vtkLookupTable.h>
29 #include <vtkMath.h>
30 #include <vtkAbstractPropPicker.h>
31 #include <vtkAssemblyPath.h>
32 #include <vtkCornerAnnotation.h>
33 #include <vtkRenderWindow.h>
34 #include <vvImage.h>
35 #include <vtkImageReslice.h>
36 #include "vvSlicer.h"
37 #include "vvInteractorStyleNavigator.h"
38 #include "vtkTransform.h"
39
40 #include <cmath>
41
42 //------------------------------------------------------------------------------
43 vvSlicerManagerCommand::vvSlicerManagerCommand()
44 {
45   mStartSlicer = -1;
46   mSlicerNumber=-1;
47 }
48 //------------------------------------------------------------------------------
49
50
51 //------------------------------------------------------------------------------
52 //return the num of the current slicer if visible (-1 else)
53 int vvSlicerManagerCommand::FindSlicerNumber(vtkRenderWindow* renwin)
54 {
55   int rvalue;
56   if (renwin != SM->GetSlicer(mSlicerNumber)->GetRenderWindow() ||
57       !SM->GetSlicer(mSlicerNumber)->GetRenderer()->GetDraw())
58     rvalue = -1;
59   else rvalue = mSlicerNumber;
60   //std::cerr << this << ":" << mSlicerNumber << ": " << rvalue << endl;
61   return rvalue;
62 }
63 //------------------------------------------------------------------------------
64
65
66 //------------------------------------------------------------------------------
67 void vvSlicerManagerCommand::Execute(vtkObject *caller,
68                                      unsigned long event,
69                                      void *vtkNotUsed(callData))
70 {
71   //KeyPress event
72   vvInteractorStyleNavigator *isi =
73     dynamic_cast<vvInteractorStyleNavigator *>(caller);
74   if (isi) {
75     double x = isi->GetInteractor()->GetEventPosition()[0];
76     double y = isi->GetInteractor()->GetEventPosition()[1];
77     double z;
78
79     int VisibleInWindow = this->FindSlicerNumber(isi->GetInteractor()->GetRenderWindow());
80     vtkRenderer* renderer=NULL;
81     if (VisibleInWindow>-1)
82       renderer=this->SM->GetSlicer(VisibleInWindow)->GetRenderer();
83     newLandmark = false;
84
85
86
87     if (event == vtkCommand::StartPickEvent && VisibleInWindow == -1) {
88       for (int i = 0; i < this->SM->GetNumberOfSlicers(); i++) {
89         if (this->SM->GetSlicer(i)->GetCursorVisibility() && !this->SM->IsLinked()) {
90           this->SM->GetSlicer(i)->SetCursorVisibility(0);
91           this->SM->GetSlicer(i)->SetCornerAnnotationVisibility(0);
92           this->SM->GetSlicer(i)->Render();
93         }
94       }
95     }
96     if ( VisibleInWindow > -1 ) {
97       if (event == vtkCommand::KeyPressEvent) {
98         std::string KeyPress = isi->GetInteractor()->GetKeySym();
99         if (KeyPress == "Tab") {
100           if(isi->GetInteractor()->GetShiftKey())
101             this->SM->PrevImage(VisibleInWindow);
102           else
103             this->SM->NextImage(VisibleInWindow);
104           return;
105         }
106         if (KeyPress == "f" || KeyPress == "F") {
107           FlyToPosition(isi->GetInteractor(),this->SM->GetSlicer(VisibleInWindow));
108           return;
109         }
110         if (KeyPress == "w") {
111           this->SM->SetLocalColorWindowing(VisibleInWindow);
112           return;
113         }
114         if (KeyPress == "0") {
115           this->SM->SetPreset(0);
116           this->SM->UpdateWindowLevel();
117           return;
118         }
119         if (KeyPress == "1") {
120           this->SM->SetPreset(1);
121           this->SM->UpdateWindowLevel();
122           return;
123         }
124         if (KeyPress == "2") {
125           this->SM->SetPreset(2);
126           this->SM->UpdateWindowLevel();
127
128           return;
129         }
130         if (KeyPress == "3") {
131           this->SM->SetPreset(3);
132           this->SM->UpdateWindowLevel();
133           return;
134         }
135         if (KeyPress == "4") {
136           this->SM->SetPreset(4);
137           this->SM->UpdateWindowLevel();
138           return;
139         }
140         if (KeyPress == "5") {
141           this->SM->SetPreset(5);
142           this->SM->UpdateWindowLevel();
143           return;
144         }
145         if (KeyPress == "6") {
146           this->SM->SetColorMap(0);
147           this->SM->UpdateWindowLevel();
148           return;
149         }
150         if (KeyPress == "7") {
151           this->SM->SetColorMap(1);
152           this->SM->UpdateWindowLevel();
153           return;
154         }
155         if (KeyPress == "8") {
156           this->SM->SetColorMap(2);
157           this->SM->UpdateWindowLevel();
158           return;
159         }
160         if (KeyPress == "9") {
161           this->SM->SetColorMap(3);
162           this->SM->UpdateWindowLevel();
163           return;
164         }
165         if (KeyPress == "equal") { //keycodes are in vtkWin32RenderWindowInteractor
166           this->SM->SetPreset(7);
167           //this->SM->SetColorMap(1);
168           this->SM->UpdateWindowLevel();
169           return;
170         }
171         if (KeyPress == "minus") {
172           this->SM->SetColorWindow(-this->SM->GetColorWindow());
173           this->SM->SetColorMap(-1);
174           this->SM->UpdateWindowLevel();
175           return;
176         }
177         if (KeyPress == "c") {
178           this->SM->ToggleContourSuperposition();
179           this->SM->Render();
180           return;
181         }
182         if (KeyPress == "l") {
183           this->SM->ToggleInterpolation();
184           this->SM->Render();
185           return;
186         }
187         if (KeyPress == "h") {
188           std::cout << "KeyPress == \"h\"\n";
189           this->SM->SetCursorAndCornerAnnotationVisibility(0);
190           this->SM->Render();
191           return;
192         }
193         if (KeyPress == "x") {
194           for(int i=0; i<SM->GetNumberOfSlicers(); i++) {
195             SM->RemoveActor("overlay",0);
196             SM->SetColorMap(0);
197             SM->Render();
198           }
199           return;
200         }
201         if (KeyPress == "u") {
202           this->SM->Reload();
203           this->SM->Render();
204           return;
205         }
206         if (KeyPress == "r" || KeyPress=="R") {
207           this->SM->GetSlicer(VisibleInWindow)->ResetCamera();
208           this->SM->GetSlicer(VisibleInWindow)->Render();
209           this->SM->UpdateLinkedNavigation( this->SM->GetSlicer(VisibleInWindow) );
210           return;
211         }
212         if (KeyPress == "g") {
213           double* cursorPos = this->SM->GetSlicer(VisibleInWindow)->GetCursorPosition();
214           this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(
215             cursorPos[0],cursorPos[1],cursorPos[2],cursorPos[3]);
216           this->SM->UpdateViews(1,VisibleInWindow);
217           this->SM->UpdateLinked(VisibleInWindow);
218           return;
219         }
220         if (KeyPress == "o") {
221           this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(0,0,0,0);
222           this->SM->UpdateViews(1,VisibleInWindow);
223           this->SM->UpdateLinked(VisibleInWindow);
224           return;
225         }
226         if (KeyPress == "F5") {
227           this->SM->GetSlicer(VisibleInWindow)->FlipHorizontalView();
228           this->SM->GetSlicer(VisibleInWindow)->Render();
229           return;
230         }
231         if (KeyPress == "F6") {
232           this->SM->GetSlicer(VisibleInWindow)->FlipVerticalView();
233           this->SM->GetSlicer(VisibleInWindow)->Render();
234           return;
235         }
236         if (KeyPress == "Up") {
237           this->SM->GetSlicer(VisibleInWindow)->SetSlice(this->SM->GetSlicer(VisibleInWindow)->GetSlice()+1);
238           this->SM->UpdateSlice(VisibleInWindow);
239         }
240         if (KeyPress == "Down") {
241           this->SM->GetSlicer(VisibleInWindow)->SetSlice(this->SM->GetSlicer(VisibleInWindow)->GetSlice()-1);
242           this->SM->UpdateSlice(VisibleInWindow);
243         }
244         if (KeyPress == "space") {
245           newLandmark = true;
246         }
247         if (KeyPress == "Left")
248           this->SM->SetPreviousTSlice(VisibleInWindow);
249         if (KeyPress == "Right")
250           this->SM->SetNextTSlice(VisibleInWindow);
251
252         if (KeyPress == "F2") {
253           this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->SetText(2,"Sagital\n<slice>");
254           //this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(0);
255           this->SM->SetSliceOrientation(VisibleInWindow, 0);
256           this->SM->UpdateSliceRange(VisibleInWindow);
257         }
258         if (KeyPress == "F3") {
259           this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->SetText(2,"Coronal\n<slice>");
260           //this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(1);
261           this->SM->SetSliceOrientation(VisibleInWindow, 1);
262           this->SM->UpdateSliceRange(VisibleInWindow);
263         }
264         if (KeyPress == "F4") {
265           this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->SetText(2,"Axial\n<slice>");
266           //this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(2);
267           this->SM->SetSliceOrientation(VisibleInWindow, 2);
268           this->SM->UpdateSliceRange(VisibleInWindow);
269         }
270
271       }
272
273       //All type of mouse events
274       if (event == vtkCommand::LeaveEvent) {
275         this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(-VTK_DOUBLE_MAX,-VTK_DOUBLE_MAX,
276             -VTK_DOUBLE_MAX,this->SM->GetSlicer(VisibleInWindow)->GetTSlice());
277         this->SM->GetSlicer(VisibleInWindow)->Render();
278         return;
279       }
280
281       //DD(event);
282       // Mouse release HERE
283       if (event == vtkCommand::EndPickEvent) {
284         //            DD(VisibleInWindow);
285         if (VisibleInWindow > -1)
286           this->SM->LeftButtonReleaseEvent(VisibleInWindow);
287         return; // no return !!!! ???
288       }
289
290       if (event == vtkCommand::StartWindowLevelEvent) {
291         mStartSlicer = -1;
292         this->InitialWindow = this->SM->GetColorWindow();
293         this->InitialLevel = this->SM->GetColorLevel();
294
295         if (VisibleInWindow > -1) {
296           mStartSlicer = VisibleInWindow;
297         }
298         return;
299       }
300
301       if (event == vtkCommand::EndWindowLevelEvent) {
302         mStartSlicer = -1;
303       }
304
305       if (event == vtkCommand::EndInteractionEvent) {
306         this->SM->Picked();
307         this->SM->UpdateLinkedNavigation(this->SM->GetSlicer(VisibleInWindow),true);
308         return;
309       }
310     }
311     if (VisibleInWindow > -1) {
312       this->SM->Activated();
313       this->SM->GetSlicer(VisibleInWindow)->SetCornerAnnotationVisibility(1);
314
315       if (event == vtkCommand::MouseWheelForwardEvent && !isi->GetInteractor()->GetControlKey()) {
316         this->SM->Picked();
317         this->SM->GetSlicer(VisibleInWindow)->SetSlice(this->SM->GetSlicer(VisibleInWindow)->GetSlice()+1);
318         this->SM->UpdateSlice(VisibleInWindow);
319       } else if (event == vtkCommand::MouseWheelForwardEvent && isi->GetInteractor()->GetControlKey()) {
320         double factor = 2;
321         this->Dolly(pow((double)1.1, factor),isi->GetInteractor());
322         Execute(caller, vtkCommand::EndInteractionEvent, NULL);
323       } else if (event == vtkCommand::MouseWheelBackwardEvent && !isi->GetInteractor()->GetControlKey()) {
324         this->SM->Picked();
325         this->SM->GetSlicer(VisibleInWindow)->SetSlice(this->SM->GetSlicer(VisibleInWindow)->GetSlice()-1);
326         this->SM->UpdateSlice(VisibleInWindow);
327       } else if (event == vtkCommand::MouseWheelBackwardEvent && isi->GetInteractor()->GetControlKey()) {
328         double factor = -2;
329         this->Dolly(pow((double)1.1, factor),isi->GetInteractor());
330         Execute(caller, vtkCommand::EndInteractionEvent, NULL);
331       }
332       double xWorld=0;
333       double yWorld=0;
334       double zWorld=0;
335
336       //Move into World Coordinate
337       renderer->DisplayToNormalizedDisplay(x,y);
338       renderer->NormalizedDisplayToViewport(x,y);
339       renderer->ViewportToNormalizedViewport(x,y);
340       renderer->NormalizedViewportToView(x,y,z);
341       renderer->ViewToWorld(x,y,z);
342       switch (this->SM->GetSlicer(VisibleInWindow)->GetSliceOrientation()) {
343       case vtkImageViewer2::SLICE_ORIENTATION_XY:
344         xWorld = x;
345         yWorld = y;
346         zWorld = this->SM->GetSlicer(VisibleInWindow)->GetSlice()*
347                  this->SM->GetSlicer(VisibleInWindow)->GetInput()->GetSpacing()[2] +
348                  this->SM->GetSlicer(VisibleInWindow)->GetInput()->GetOrigin()[2];
349         break;
350
351       case vtkImageViewer2::SLICE_ORIENTATION_XZ:
352         xWorld = x;
353         yWorld = this->SM->GetSlicer(VisibleInWindow)->GetSlice()*
354                  this->SM->GetSlicer(VisibleInWindow)->GetInput()->GetSpacing()[1] +
355                  this->SM->GetSlicer(VisibleInWindow)->GetInput()->GetOrigin()[1];
356         zWorld = z;
357         break;
358
359       case vtkImageViewer2::SLICE_ORIENTATION_YZ:
360         xWorld = this->SM->GetSlicer(VisibleInWindow)->GetSlice()*
361                  this->SM->GetSlicer(VisibleInWindow)->GetInput()->GetSpacing()[0] +
362                  this->SM->GetSlicer(VisibleInWindow)->GetInput()->GetOrigin()[0];
363         yWorld = y;
364         zWorld = z;
365         break;
366       }
367       this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(xWorld,yWorld,zWorld,
368           this->SM->GetSlicer(VisibleInWindow)->GetTSlice());
369       if (newLandmark) {
370         this->SM->AddLandmark(xWorld,yWorld,zWorld,
371                               this->SM->GetSlicer(VisibleInWindow)->GetTSlice());
372         this->SM->GetSlicer(VisibleInWindow)->UpdateLandmarks();
373         this->SM->Render();
374       }
375       if (event == vtkCommand::PickEvent || event == vtkCommand::StartPickEvent) {
376         this->SM->Picked();
377         this->SM->UpdateViews(1,VisibleInWindow);
378         this->SM->UpdateLinked(VisibleInWindow);
379         this->SM->UpdateInfoOnCursorPosition(VisibleInWindow);
380       } else {
381         this->SM->GetSlicer(VisibleInWindow)->Render();
382       }
383       //this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(-VTK_DOUBLE_MAX,-VTK_DOUBLE_MAX,
384       //-VTK_DOUBLE_MAX,this->SM->GetSlicer(VisibleInWindow)->GetTSlice());
385       //this->SM->GetSlicer(VisibleInWindow)->Render();
386     }
387
388     if (event == vtkCommand::WindowLevelEvent && mStartSlicer > -1) {
389       this->SM->GetSlicer(mStartSlicer)->SetCornerAnnotationVisibility(1);
390       // Adjust the window level here
391       int *size = isi->GetInteractor()->GetRenderWindow()->GetSize();
392       double window = this->InitialWindow;
393       double level = this->InitialLevel;
394       double range[2];
395       this->SM->GetImage()->GetScalarRange(range);
396
397       // Compute normalized delta
398       double dx = static_cast<double>(isi->GetWindowLevelCurrentPosition()[0] -
399                                       isi->GetWindowLevelStartPosition()[0]) / size[0];
400       double dy = static_cast<double>(isi->GetWindowLevelStartPosition()[1] -
401                                       isi->GetWindowLevelCurrentPosition()[1]) / size[1];
402       //Window is exponential in nature, use exponential to avoid falling into negative numbers
403       dx = std::exp(1.0 * (dx*fabs(dx) + dx)) ; //Quadratic behavior for more reactive interface
404       dy = 0.15 * (dy*fabs(dy) + dy) * (range[1]-range[0]);//Quadratic behavior for more reactive interface
405
406       this->SM->SetColorWindow(window*dx);
407       this->SM->SetColorLevel(level-dy);
408       this->SM->SetPreset(6);
409       this->SM->UpdateWindowLevel();
410       this->SM->Render();
411       return;
412     }
413   }
414 }
415 //------------------------------------------------------------------------------
416
417
418 //------------------------------------------------------------------------------
419 void vvSlicerManagerCommand::Dolly(double factor, vtkRenderWindowInteractor *interactor)
420 {
421   int VisibleInWindow = this->FindSlicerNumber(interactor->GetRenderWindow());
422   vtkRenderer* renderer;
423   if (VisibleInWindow>-1)
424     renderer=this->SM->GetSlicer(VisibleInWindow)->GetRenderer();
425   else {
426     return;
427   }
428
429   double viewFocus[4],viewPoint[4],motionVector[3], focalDepth;
430   double oldPos[3], newPos[3], distance[2];
431   vtkCamera *camera = renderer->GetActiveCamera();
432   camera->GetFocalPoint(viewFocus);
433
434   renderer->SetWorldPoint(viewFocus[0], viewFocus[0], viewFocus[0], 1.0);
435   renderer->WorldToDisplay();
436   renderer->GetDisplayPoint(viewFocus);
437
438   focalDepth = viewFocus[2];
439
440   oldPos[0] = renderer->GetCenter()[0];
441   oldPos[1] = renderer->GetCenter()[1];
442   oldPos[2] = focalDepth;
443
444   distance[0] = 1/factor*
445                 (interactor->GetEventPosition()[0]-renderer->GetCenter()[0]);
446   distance[1] = 1/factor*
447                 (interactor->GetEventPosition()[1]-renderer->GetCenter()[1]);
448
449   newPos[0] = interactor->GetEventPosition()[0] - distance[0];
450   newPos[1] = interactor->GetEventPosition()[1] - distance[1];
451   newPos[2] = focalDepth;
452
453   renderer->DisplayToNormalizedDisplay(oldPos[0],oldPos[1]);
454   renderer->NormalizedDisplayToViewport(oldPos[0],oldPos[1]);
455   renderer->ViewportToNormalizedViewport(oldPos[0],oldPos[1]);
456   renderer->NormalizedViewportToView(oldPos[0],oldPos[1],oldPos[2]);
457   renderer->ViewToWorld(oldPos[0],oldPos[1],oldPos[2]);
458
459   renderer->DisplayToNormalizedDisplay(newPos[0],newPos[1]);
460   renderer->NormalizedDisplayToViewport(newPos[0],newPos[1]);
461   renderer->ViewportToNormalizedViewport(newPos[0],newPos[1]);
462   renderer->NormalizedViewportToView(newPos[0],newPos[1],newPos[2]);
463   renderer->ViewToWorld(newPos[0],newPos[1],newPos[2]);
464
465   motionVector[0] = newPos[0] - oldPos[0];
466   motionVector[1] = newPos[1] - oldPos[1];
467   motionVector[2] = newPos[2] - oldPos[2];
468
469   camera->GetFocalPoint(viewFocus);
470   camera->GetPosition(viewPoint);
471   camera->SetFocalPoint(motionVector[0] + viewFocus[0],
472                         motionVector[1] + viewFocus[1],
473                         motionVector[2] + viewFocus[2]);
474
475   camera->SetPosition(motionVector[0] + viewPoint[0],
476                       motionVector[1] + viewPoint[1],
477                       motionVector[2] + viewPoint[2]);
478
479   if (camera->GetParallelProjection()) {
480     camera->SetParallelScale(camera->GetParallelScale() / factor);
481   } else {
482     camera->Dolly(factor);
483   }
484
485   if (interactor->GetLightFollowCamera()) {
486     renderer->UpdateLightsGeometryToFollowCamera();
487   }
488   renderer->ResetCameraClippingRange();
489   //interactor->Render();
490 }
491 //------------------------------------------------------------------------------
492
493
494 //------------------------------------------------------------------------------
495 void vvSlicerManagerCommand::FlyToPosition(vtkRenderWindowInteractor *interactor,vvSlicer* slicer)
496 {
497   double flyFrom[3], flyTo[3];
498   double d[3], focalPt[3], position[3], positionFrom[3];
499   int i, j;
500   int VisibleInWindow = this->FindSlicerNumber(interactor->GetRenderWindow());
501   vtkRenderer* renderer=NULL;
502   if (VisibleInWindow>-1)
503     renderer=this->SM->GetSlicer(VisibleInWindow)->GetRenderer();
504   else
505     return;
506
507   interactor->GetPicker()->Pick(interactor->GetEventPosition()[0],
508                                 interactor->GetEventPosition()[1], 0.0,
509                                 renderer);
510
511   vtkAssemblyPath *path=NULL;
512   vtkAbstractPropPicker *picker;
513   if ( (picker=vtkAbstractPropPicker::SafeDownCast(interactor->GetPicker()))) {
514     path = picker->GetPath();
515   }
516   if ( path != NULL ) {
517     flyTo[0] = picker->GetPickPosition()[0];
518     flyTo[1] = picker->GetPickPosition()[1];
519     flyTo[2] = picker->GetPickPosition()[2];
520     renderer->GetActiveCamera()->GetFocalPoint(flyFrom);
521     renderer->GetActiveCamera()->GetPosition(positionFrom);
522
523     switch (slicer->GetSliceOrientation()) {
524     case vtkImageViewer2::SLICE_ORIENTATION_XY:
525       flyTo[2] = flyFrom[2];
526       break;
527
528     case vtkImageViewer2::SLICE_ORIENTATION_XZ:
529       flyTo[1] = flyFrom[1];
530       break;
531
532     case vtkImageViewer2::SLICE_ORIENTATION_YZ:
533       flyTo[0] = flyFrom[0];
534       break;
535     }
536
537
538     for (i=0; i<3; i++) {
539       d[i] = flyTo[i] - flyFrom[i];
540     }
541     double distance = vtkMath::Normalize(d);
542     double delta = distance/15;
543
544     for (i=1; i<=15; i++) {
545       for (j=0; j<3; j++) {
546         focalPt[j] = flyFrom[j] + d[j]*i*delta;
547         position[j] = positionFrom[j] + d[j]*i*delta;
548       }
549       renderer->GetActiveCamera()->SetFocalPoint(focalPt);
550       renderer->GetActiveCamera()->SetPosition(position);
551       renderer->GetActiveCamera()->Dolly(0.3/15 + 1.0);
552       renderer->ResetCameraClippingRange();
553       interactor->Render();
554     }
555   }
556 }
557 //------------------------------------------------------------------------------