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