]> Creatis software - clitk.git/blob - vv/vvResamplerDialog.h
Initial revision
[clitk.git] / vv / vvResamplerDialog.h
1 #ifndef _VVRESAMPLERDIALOG_H
2 #define _VVRESAMPLERDIALOG_H
3
4 /*=========================================================================
5
6 Program:   vv
7 Module:    $RCSfile: vvResamplerDialog.h,v $
8 Language:  C++
9 Date:      $Date: 2010/01/06 13:31:57 $
10 Version:   $Revision: 1.1 $
11 Author :   David Sarrut (david.sarrut@gmail.com)
12
13 Copyright (C) 2008
14 Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
15 CREATIS-LRMN http://www.creatis.insa-lyon.fr
16
17 This program is free software: you can redistribute it and/or modify
18 it under the terms of the GNU General Public License as published by
19 the Free Software Foundation, version 3 of the License.
20
21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 GNU General Public License for more details.
25
26 You should have received a copy of the GNU General Public License
27 along with this program.  If not, see <http://www.gnu.org/licenses/>.
28
29 =========================================================================*/
30
31
32 #include "ui_vvResamplerDialog.h"
33 #include "clitkCommon.h"
34 #include "vvImage.h"
35 #include "vvSlicerManager.h"
36
37 #include <QtDesigner/QDesignerExportWidget>
38 #include <QTreeWidget>
39
40 //====================================================================
41 class QDESIGNER_WIDGET_EXPORT vvResamplerDialog : public QDialog, private Ui::vvResamplerDialog {
42
43     Q_OBJECT
44
45 public:
46     // constructor - destructor
47     vvResamplerDialog(QWidget * parent=0, Qt::WindowFlags f=0);
48     void SetSlicerManagers(std::vector<vvSlicerManager*> & m,int current_image_index);
49
50     // Get output result
51     vvImage::Pointer GetOutput() {
52         return mOutput;
53     }
54     bool GetDisplayResult() {
55         return display_result->checkState() > 0;
56     }
57     std::string GetOutputFileName();
58
59 public slots:
60 //  void SetImagesList(QTreeWidget * tree);
61     void Resample();
62     void UpdateControlSizeAndSpacing();
63     void ComputeNewSizeFromSpacing();
64     void ComputeNewSizeFromScale();
65     void ComputeNewSizeFromIso();
66     void ComputeNewSpacingFromSize();
67     void ComputeNewSpacingFromScale();
68     void ComputeNewSpacingFromIso();
69     void UpdateInterpolation();
70     void UpdateGaussianFilter();
71     void UpdateCurrentInputImage();
72
73 protected:
74     Ui::vvResamplerDialog ui;
75     std::vector<vvSlicerManager*> mSlicerManagers;
76     vvImage::Pointer mOutput;
77
78     vvImage::Pointer mCurrentImage;
79     int mCurrentIndex;
80
81     std::vector<int> mInputOrigin;
82     std::vector<int> mInputSize;
83     std::vector<double> mInputSpacing;
84     std::vector<int> mOutputSize;
85     std::vector<double> mOutputSpacing;
86     int mDimension;
87
88     QString mLastError;
89
90     QString mInputFileName;
91
92     QString mInputFileFormat;
93     QString mPixelType;
94     QString ComponentType;
95
96     QStringList OutputListFormat;
97
98     void Init();
99     void UpdateInputInfo();
100     void UpdateOutputInfo();
101     void UpdateOutputFormat();
102     void FillSizeEdit(std::vector<int> size);
103     void FillSpacingEdit(std::vector<double> spacing);
104     void UpdateOutputSizeAndSpacing();
105
106     QString GetSizeInBytes(std::vector<int> & size);
107     QString GetVectorDoubleAsString(std::vector<double> vectorDouble);
108     QString GetVectorIntAsString(std::vector<int> vectorInt);
109
110 }; // end class vvResamplerDialog
111 //====================================================================
112
113 #endif /* end #define _VVRESAMPLERDIALOG_H */
114