]> Creatis software - clitk.git/blob - common/vvImageReader.h
06cf8c4bbc99c191c88e5d81b9ae18e921f69eea
[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   UNDEFINEDIMAGETYPE
39   } LoadedImageType;
40
41   typedef vvImageReader Self;
42   typedef itk::SmartPointer<Self> Pointer;
43   itkNewMacro(Self);
44
45   void SetInputFilename(const std::string & filename);
46   void SetInputFilenames(const std::vector<std::string> & filenames);
47
48   vvImage::Pointer GetOutput() {
49       return mImage;
50   }
51
52   std::string GetLastError() {
53       return mLastError;
54   }
55
56   void SetSlice(unsigned int i) { mSlice = i; }
57
58   //====================================================================
59   // Main function
60   void Update();
61   void Update(LoadedImageType type);
62   void Update(int dim, std::string InputPixelType, LoadedImageType type);
63
64 protected:
65   //====================================================================
66   std::vector<std::string> mInputFilenames;
67   ///Method used to load the image, see vvConstants.h for definition
68   LoadedImageType mType;
69   unsigned int mSlice;
70   itk::Command::Pointer mObserver;
71
72   std::string mLastError;
73
74   //====================================================================
75   template<unsigned int VImageDimension>
76   void UpdateWithDim(std::string inputPixelType);
77
78   //====================================================================
79   /*template<unsigned int VImageDimension>
80   void ExtractWithDim(std::string inputPixelType, int slice);*/
81
82   //====================================================================
83   template<class InputPixelType, unsigned int VImageDimension>
84   void UpdateWithDimAndInputPixelType();
85   ///Input dimension and pixel type
86   int mDim;
87   std::string mInputPixelType;
88
89   //====================================================================
90   void ReadNkiImageTransform();
91   void ReadMatImageTransform();
92 private:
93   vvImageReader();
94   ~vvImageReader();
95
96   vvImage::Pointer mImage;
97 }; // end class vvImageReader
98
99 #endif /* end #define CLITKvvImageReader_H */
100