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