]> Creatis software - clitk.git/blob - vv/vvToolHistogramCommand.cxx
Debug RTStruct conversion with empty struc
[clitk.git] / vv / vvToolHistogramCommand.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 "vvToolHistogramCommand.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 vvToolHistogramCommand::vvToolHistogramCommand()
43 {
44   mFollowMouse = false;
45 }
46 //------------------------------------------------------------------------------
47
48
49
50
51 //------------------------------------------------------------------------------
52 void vvToolHistogramCommand::Execute(vtkObject *caller,
53                                      unsigned long event,
54                                      void *vtkNotUsed(callData))
55 {
56   if (event == vtkCommand::MouseWheelForwardEvent) {
57     mHist->expandWindow();
58   }
59   if (event == vtkCommand::MouseWheelBackwardEvent) {
60     mHist->reduceWindow();
61   }
62   if (event == vtkCommand::LeftButtonPressEvent) {
63     mFollowMouse = !mFollowMouse;
64   }
65   if (event == vtkCommand::MouseMoveEvent) {
66     if (mFollowMouse) {
67       vtkSmartPointer<vtkRenderWindowInteractor> interactor = mHist->GetHistogramWidget()->GetRenderWindow()->GetInteractor();
68       if (interactor->GetEventPosition()[0] != interactor->GetLastEventPosition()[0])
69         mHist->translateWindow(interactor->GetEventPosition()[0] - interactor->GetLastEventPosition()[0]);
70     }
71   }
72 }
73 //------------------------------------------------------------------------------