1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
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
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.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
19 #ifndef VVTOOLWIDGETBASE_H
20 #define VVTOOLWIDGETBASE_H
23 #if QT_VERSION >= 0x050000
24 #include <QtUiPlugin/QDesignerExportWidget>
26 #include <QtDesigner/QDesignerExportWidget>
28 #include "ui_vvToolWidgetBase.h"
29 #include "clitkImageToImageGenericFilter.h"
32 #include <QCloseEvent>
34 class vvMainWindowBase;
36 //------------------------------------------------------------------------------
37 class vvToolWidgetBase:
39 public Ui::vvToolWidgetBase
44 vvToolWidgetBase(vvMainWindowBase * parent=0, Qt::WindowFlags f=Qt::Dialog, bool initialize=true); // default is a dialog
45 virtual ~vvToolWidgetBase();
47 virtual void InputIsSelected(vvSlicerManager *m);
48 virtual void InputIsSelected(std::vector<vvSlicerManager*> & l);
49 void AddInputSelector(QString s, clitk::ImageToImageGenericFilterBase * f, bool allowSkip=false);
50 void AddInputSelector(QString s, bool allowSkip=false);
51 void HideInputSelector();
56 virtual void apply() = 0;
58 void InputIsSelected();
59 virtual void AnImageIsBeingClosed(vvSlicerManager * m);
60 virtual void SelectedImageHasChanged(vvSlicerManager * m);
62 virtual void keyPressEvent(QKeyEvent *event);
65 virtual void Initialization();
66 void InitializeInputs();
67 Ui::vvToolWidgetBase ui;
68 clitk::ImageToImageGenericFilterBase::Pointer mFilter;
69 vvMainWindowBase * mMainWindow;
70 std::vector<vvSlicerManager*> mSlicerManagersCompatible;
71 vvSlicerManager * mCurrentSlicerManager;
72 int mCurrentCompatibleIndex;
73 vvImage * mCurrentImage;
75 QWidget * mWidgetForTab;
77 // The static members manage all tool instances
78 static QWidget * mStaticWidgetForTab; // <-- MUST BE CHANGED IN VECTOR
79 static int mTabNumber;
80 static QVBoxLayout * mStaticVerticalLayout; // <-- MUST BE CHANGED IN VECTOR
81 static bool mIsAnotherToolWaitInput;
82 virtual void CheckInputList(std::vector<vvSlicerManager*> & l, int & index) { }
83 virtual void closeEvent(QCloseEvent *event);
84 void SwapCurrentWidget();
85 bool mPreventToUseTwoToolsOnSameInput;
87 }; // end class vvToolWidgetBase
88 //------------------------------------------------------------------------------