]> Creatis software - clitk.git/blob - common/vvImageReader.h
GateAsciiImageIO is now cross-platform using itksys::RegularExpression
[clitk.git] / common / 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://www.centreleonberard.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
23 #include "itkCommand.h"
24 #include "vvImage.h"
25
26 class vvImageReader : public itk::LightObject {
27
28 public:
29   //Image types
30   typedef enum _IMAGETYPE {
31   IMAGE = 20,
32   DICOM,
33   MERGED,
34   SLICED,
35   IMAGEWITHTIME,
36   MERGEDWITHTIME,
37   VECTORFIELD,
38   VECTORFIELDWITHTIME,
39   UNDEFINEDIMAGETYPE
40   } LoadedImageType;
41
42   typedef vvImageReader Self;
43   typedef itk::SmartPointer<Self> Pointer;
44   itkNewMacro(Self);
45
46   const std::vector<std::string>& GetInputFilenames(){return mInputFilenames;}
47
48   void SetInputFilename(const std::string & filename);
49   void SetInputFilenames(const std::vector<std::string> & filenames);
50
51   vvImage::Pointer GetOutput() {
52       return mImage;
53   }
54
55   std::string GetLastError() {
56       return mLastError;
57   }
58
59   void SetSlice(unsigned int i) { mSlice = i; }
60
61   //====================================================================
62   // Main function
63   void Update();
64   void Update(LoadedImageType type);
65   void Update(int dim, std::string InputPixelType, LoadedImageType type);
66
67 protected:
68   //====================================================================
69   std::vector<std::string> mInputFilenames;
70   ///Method used to load the image, see vvConstants.h for definition
71   LoadedImageType mType;
72   unsigned int mSlice;
73   itk::Command::Pointer mObserver;
74
75   std::string mLastError;
76
77   //====================================================================
78   template<unsigned int VImageDimension>
79   void UpdateWithDim(std::string inputPixelType);
80
81   //====================================================================
82   /*template<unsigned int VImageDimension>
83   void ExtractWithDim(std::string inputPixelType, int slice);*/
84
85   //====================================================================
86   template<class InputPixelType, unsigned int VImageDimension>
87   void UpdateWithDimAndInputPixelType();
88   ///Input dimension and pixel type
89   int mDim;
90   std::string mInputPixelType;
91
92   //====================================================================
93   void ReadNkiImageTransform();
94   void ReadMatImageTransform();
95 private:
96   vvImageReader();
97   ~vvImageReader();
98
99   vvImage::Pointer mImage;
100 }; // end class vvImageReader
101
102 #endif /* end #define CLITKvvImageReader_H */
103