]> Creatis software - clitk.git/blob - vv/vvToolCropImage.h
11ee8def9e7f5bfd8b26bacf6b64d0fd7ca058a8
[clitk.git] / vv / vvToolCropImage.h
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 #ifndef VVTOOLCROPIMAGE_H
19 #define VVTOOLCROPIMAGE_H
20
21 //qt
22 #include <QtGlobal>
23 #if QT_VERSION < 0x050000
24 #include <QtDesigner/QDesignerExportWidget>
25 #else
26 #include <QtUiPlugin/QDesignerExportWidget>
27 #endif
28 #include <QDialog>
29 #include <QSlider>
30 // vv
31 #include "vvToolBase.h"
32 #include "vvToolWidgetBase.h"
33 #include "vvMainWindowBase.h"
34 #include "ui_vvToolCropImage.h"
35
36 //------------------------------------------------------------------------------
37 class vvToolCropImage:
38   public vvToolWidgetBase,
39   public vvToolBase<vvToolCropImage>, 
40   private Ui::vvToolCropImage 
41 {
42   Q_OBJECT
43     public:
44   vvToolCropImage(vvMainWindowBase * parent=0, Qt::WindowFlags f=0);
45   ~vvToolCropImage();
46
47   virtual void InputIsSelected(vvSlicerManager *m);
48
49 public slots:
50   virtual void apply();
51   virtual bool close();
52   virtual void reject();
53   void autoCropValueChanged(double v);
54   void sliderValueChanged(int id);
55
56
57   //-----------------------------------------------------
58   static void Initialize() {
59     SetToolName("Crop");
60     SetToolMenuName("Crop");
61     SetToolIconFilename(":/common/icons/crop.png");
62     SetToolTip("Crop image.");
63   }
64
65  protected:
66   Ui::vvToolCropImage ui;
67   int * mReducedExtent;
68   int * mInitialExtent;
69   int mExtentSize;
70   void UpdateExtent();
71   virtual void closeEvent(QCloseEvent *event);
72
73   std::vector<QSlider*> mSliders;
74 }; // end class vvToolCropImage
75 //------------------------------------------------------------------------------
76
77 #endif
78