]> Creatis software - clitk.git/blob - common/vvImageReader.h
With ITKv5, change VectorResample and VectorCast Image Filter to Resample and Cast...
[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   void SetPatientCoordinateSystem(bool patientCoordinateSystem);
63
64   //====================================================================
65   // Main function
66   void Update();
67   void Update(LoadedImageType type);
68   void Update(int dim, std::string InputPixelType, LoadedImageType type);
69
70 protected:
71   //====================================================================
72   std::vector<std::string> mInputFilenames;
73   ///Method used to load the image, see vvConstants.h for definition
74   LoadedImageType mType;
75   unsigned int mSlice;
76   itk::Command::Pointer mObserver;
77
78   std::string mLastError;
79
80   //====================================================================
81   template<unsigned int VImageDimension>
82   void UpdateWithDim(std::string inputPixelType);
83
84   //====================================================================
85   /*template<unsigned int VImageDimension>
86   void ExtractWithDim(std::string inputPixelType, int slice);*/
87
88   //====================================================================
89   template<class InputPixelType, unsigned int VImageDimension>
90   void UpdateWithDimAndInputPixelType();
91   template<class InputPixelType, unsigned int VImageDimension>
92   void UpdateWithDimAndInputVectorPixelType();
93   ///Input dimension and pixel type
94   int mDim;
95   bool mPatientCoordinateSystem;
96   std::string mInputPixelType;
97
98   //====================================================================
99 //  void ReadNkiImageTransform();
100   void ReadMatImageTransform();
101 private:
102   vvImageReader();
103   ~vvImageReader();
104
105   vvImage::Pointer mImage;
106 }; // end class vvImageReader
107
108 #endif /* end #define CLITKvvImageReader_H */
109