]> Creatis software - clitk.git/blob - vv/vvImageReader.h
e13d2e49ff57e5acf1a77e433d1cb2fdcea3a4ea
[clitk.git] / vv / vvImageReader.h
1 /*=========================================================================
2
3  Program:   vv
4  Language:  C++
5  Author :   Pierre Seroul (pierre.seroul@gmail.com)
6
7 Copyright (C) 2008
8 Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
9 CREATIS-LRMN http://www.creatis.insa-lyon.fr
10
11 This program is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, version 3 of the License.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
23 =========================================================================*/
24 #ifndef vvImageReader_H
25 #define vvImageReader_H
26
27 #include <string>
28 #include <vector>
29 #include <QThread>
30
31 #include "itkCommand.h"
32 #include "vvImage.h"
33 #include "vvConstants.h"
34
35 class vvImageReader : public QThread {
36
37 public:
38     vvImageReader();
39     ~vvImageReader();
40
41     void SetInputFilename(const std::string & filename);
42     void SetInputFilenames(const std::vector<std::string> & filenames);
43
44     vvImage::Pointer GetOutput() {
45         return mImage;
46     }
47
48     std::string GetLastError() {
49         return mLastError;
50     }
51
52     //====================================================================
53     // Main function
54     void Update();
55     void Update(LoadedImageType type);
56     void Update(int dim, std::string InputPixelType, LoadedImageType type);
57     //void Extract(int dim, std::string InputPixelType, int slice);
58
59 protected:
60     void run();
61     //====================================================================
62     std::vector<std::string> mInputFilenames;
63     ///Method used to load the image, see vvConstants.h for definition
64     LoadedImageType mType;
65     itk::Command::Pointer mObserver;
66
67     std::string mLastError;
68
69     //====================================================================
70     template<unsigned int VImageDimension>
71     void UpdateWithDim(std::string inputPixelType);
72
73     //====================================================================
74     /*template<unsigned int VImageDimension>
75     void ExtractWithDim(std::string inputPixelType, int slice);*/
76
77     //====================================================================
78     template<class InputPixelType, unsigned int VImageDimension>
79     void UpdateWithDimAndInputPixelType();
80     ///Input dimension and pixel type
81     int mDim;
82     std::string mInputPixelType;
83
84 private:
85     vvImage::Pointer mImage;
86
87 }; // end class vvImageReader
88
89 #endif /* end #define CLITKvvImageReader_H */
90