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 #include <QtDesigner/QDesignerExportWidget>
24 #include "ui_vvToolWidgetBase.h"
25 #include "clitkImageToImageGenericFilter.h"
28 #include <QCloseEvent>
30 class vvMainWindowBase;
32 //------------------------------------------------------------------------------
33 class vvToolWidgetBase:
35 public Ui::vvToolWidgetBase
40 vvToolWidgetBase(vvMainWindowBase * parent=0, Qt::WindowFlags f=Qt::Dialog, bool initialize=true); // default is a dialog
41 virtual ~vvToolWidgetBase();
43 virtual void InputIsSelected(vvSlicerManager *m);
44 virtual void InputIsSelected(std::vector<vvSlicerManager*> & l);
45 void AddInputSelector(QString s, clitk::ImageToImageGenericFilterBase * f, bool allowSkip=false);
46 void AddInputSelector(QString s, bool allowSkip=false);
47 void HideInputSelector();
52 virtual void apply() = 0;
54 void InputIsSelected();
55 virtual void AnImageIsBeingClosed(vvSlicerManager * m);
56 virtual void SelectedImageHasChanged(vvSlicerManager * m);
58 virtual void keyPressEvent(QKeyEvent *event);
61 virtual void Initialization();
62 void InitializeInputs();
63 Ui::vvToolWidgetBase ui;
64 clitk::ImageToImageGenericFilterBase::Pointer mFilter;
65 vvMainWindowBase * mMainWindow;
66 std::vector<vvSlicerManager*> mSlicerManagersCompatible;
67 vvSlicerManager * mCurrentSlicerManager;
68 int mCurrentCompatibleIndex;
69 vvImage * mCurrentImage;
71 QWidget * mWidgetForTab;
73 // The static members manage all tool instances
74 static QWidget * mStaticWidgetForTab; // <-- MUST BE CHANGED IN VECTOR
75 static int mTabNumber;
76 static QVBoxLayout * mStaticVerticalLayout; // <-- MUST BE CHANGED IN VECTOR
77 static bool mIsAnotherToolWaitInput;
78 virtual void CheckInputList(std::vector<vvSlicerManager*> & l, int & index) { }
79 virtual void closeEvent(QCloseEvent *event);
80 void SwapCurrentWidget();
81 bool mPreventToUseTwoToolsOnSameInput;
83 }; // end class vvToolWidgetBase
84 //------------------------------------------------------------------------------