]> Creatis software - clitk.git/blob - vv/vvToolResample.h
- small correction about Render (a bit less unuseful Render)
[clitk.git] / vv / vvToolResample.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://oncora1.lyon.fnclcc.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
19 #ifndef _VVTOOLRESAMPLE_H
20 #define _VVTOOLRESAMPLE_H
21
22 #include "ui_vvToolResample.h"
23 #include "clitkCommon.h"
24 #include "clitkImageResampleGenericFilter.h"
25 #include "vvImage.h"
26 #include "vvSlicerManager.h"
27 #include "vvToolWidgetBase.h"
28 #include "vvToolBase.h"
29
30 #include <QtDesigner/QDesignerExportWidget>
31 #include <QTreeWidget>
32
33 //------------------------------------------------------------------------------
34 class vvToolResample :  
35   public vvToolWidgetBase,
36   public vvToolBase<vvToolResample>, 
37   private Ui::vvToolResample {
38
39   Q_OBJECT
40     
41   public:
42   // constructor - destructor
43   vvToolResample(vvMainWindowBase * parent=0, Qt::WindowFlags f=0);
44
45   // Get output result
46   vvImage::Pointer GetOutput() {
47     return mOutput;
48   }
49   std::string GetOutputFileName();
50   static void Initialize();
51   void apply();
52
53 public slots:
54   //  void SetImagesList(QTreeWidget * tree);
55   void UpdateControlSizeAndSpacing();
56   void ComputeNewSizeFromSpacing();
57   void ComputeNewSizeFromScale();
58   void ComputeNewSizeFromIso();
59   void ComputeNewSpacingFromSize();
60   void ComputeNewSpacingFromScale();
61   void ComputeNewSpacingFromIso();
62   void UpdateInterpolation();
63   void UpdateGaussianFilter();
64   void InputIsSelected(vvSlicerManager* m);
65
66 protected:
67   Ui::vvToolResample ui;
68   vvImage::Pointer mOutput;
69   clitk::ImageResampleGenericFilter::Pointer mFilter;
70
71   vvSlicerManager* mCurrentSlicerManager;
72   vvImage::Pointer mCurrentImage;
73   int mCurrentIndex;
74
75   std::vector<int> mInputOrigin;
76   std::vector<int> mInputSize;
77   std::vector<double> mInputSpacing;
78   std::vector<int> mOutputSize;
79   std::vector<double> mOutputSpacing;
80   int mDimension;
81
82   QString mLastError;
83
84   QString mInputFileName;
85
86   QString mInputFileFormat;
87   QString mPixelType;
88   QString ComponentType;
89
90   QStringList OutputListFormat;
91
92   void UpdateInputInfo();
93   void UpdateOutputInfo();
94   void UpdateOutputFormat();
95   void FillSizeEdit(std::vector<int> size);
96   void FillSpacingEdit(std::vector<double> spacing);
97   void UpdateOutputSizeAndSpacing();
98
99   QString GetSizeInBytes(std::vector<int> & size);
100   QString GetVectorDoubleAsString(std::vector<double> vectorDouble);
101   QString GetVectorIntAsString(std::vector<int> vectorInt);
102
103 }; // end class vvToolResample
104 //------------------------------------------------------------------------------
105
106
107 #endif
108