]> Creatis software - clitk.git/blob - vv/vvImageReader.h
cbe7d1607e62b63c1bca49cdaeb93fd8cf8ed909
[clitk.git] / vv / vvImageReader.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 #ifndef vvImageReader_H
19 #define vvImageReader_H
20 #include <string>
21 #include <vector>
22 #include <QThread>
23
24 #include "itkCommand.h"
25 #include "vvImage.h"
26 #include "vvConstants.h"
27
28 class vvImageReader : public itk::LightObject, public QThread {
29
30 public:
31   typedef vvImageReader Self;
32   typedef itk::SmartPointer<Self> Pointer;
33   itkNewMacro(Self);
34
35   void SetInputFilename(const std::string & filename);
36   void SetInputFilenames(const std::vector<std::string> & filenames);
37
38   vvImage::Pointer GetOutput() {
39       return mImage;
40   }
41
42   std::string GetLastError() {
43       return mLastError;
44   }
45
46   void SetSlice(unsigned int i) { mSlice = i; }
47
48   //====================================================================
49   // Main function
50   void Update();
51   void Update(LoadedImageType type);
52   void Update(int dim, std::string InputPixelType, LoadedImageType type);
53
54 protected:
55   void run();
56   //====================================================================
57   std::vector<std::string> mInputFilenames;
58   ///Method used to load the image, see vvConstants.h for definition
59   LoadedImageType mType;
60   unsigned int mSlice;
61   itk::Command::Pointer mObserver;
62
63   std::string mLastError;
64
65   //====================================================================
66   template<unsigned int VImageDimension>
67   void UpdateWithDim(std::string inputPixelType);
68
69   //====================================================================
70   /*template<unsigned int VImageDimension>
71   void ExtractWithDim(std::string inputPixelType, int slice);*/
72
73   //====================================================================
74   template<class InputPixelType, unsigned int VImageDimension>
75   void UpdateWithDimAndInputPixelType();
76   ///Input dimension and pixel type
77   int mDim;
78   std::string mInputPixelType;
79
80   //====================================================================
81   void ReadNkiImageTransform();
82   void ReadMatImageTransform();
83 private:
84   vvImageReader();
85   ~vvImageReader();
86
87   vvImage::Pointer mImage;
88 }; // end class vvImageReader
89
90 #endif /* end #define CLITKvvImageReader_H */
91