]> Creatis software - clitk.git/blob - common/clitkImageToImageGenericFilterBase.h
removed headers
[clitk.git] / common / clitkImageToImageGenericFilterBase.h
1 #ifndef CLITKIMAGETOIMAGEGENERICFILTERBASE_H
2 #define CLITKIMAGETOIMAGEGENERICFILTERBASE_H
3 #include "clitkCommon.h"
4 #include "clitkImageCommon.h"
5 #include "clitkCommonGenericFilter.h"
6
7 // itk include
8 #include <itkImage.h>
9
10 // vv include
11 #include "vvImage.h"
12 #include "vvFromITK.h"
13 #include "vvToITK.h"
14
15 namespace clitk {
16   
17   //--------------------------------------------------------------------
18   class ImageToImageGenericFilterBase: public itk::Object {
19     
20   public: 
21     // constructor - destructor
22     ImageToImageGenericFilterBase(std::string filterName);
23     virtual ~ImageToImageGenericFilterBase();
24
25     // Types
26     typedef ImageToImageGenericFilterBase Self;
27     typedef Object                        Superclass;
28     typedef itk::SmartPointer<Self>       Pointer;
29     typedef itk::SmartPointer<const Self> ConstPointer;
30
31     // Filters information
32     const std::string & GetFilterName();
33     void SetFilterName(std::string & n);
34
35     // Generic IO
36     /// Returns the dimension and pixel type of the *first* input
37     void GetInputImageDimensionAndPixelType(unsigned int& dim, std::string& pixeltype,
38                                             unsigned int & components);
39
40     // File IO
41     void SetInputFilename(const std::string & filename);
42     void AddInputFilename(const std::string & filename);
43     void SetInputFilenames(const std::vector<std::string> & filenames);
44     void EnableReadOnDisk(bool b);
45     void SetOutputFilename(const std::string & filename);
46     void AddOutputFilename(const std::string & filename);
47     void SetOutputFilenames(const std::vector<std::string> & filenames);
48     std::string GetOutputFilename();
49     void SetIOVerbose(bool b);
50
51     // VVImage IO
52     void SetInputVVImage (vvImage::Pointer input);
53     void SetInputVVImages (std::vector<vvImage::Pointer> input);
54     void AddInputVVImage (vvImage::Pointer input);
55     vvImage::Pointer GetOutputVVImage ();
56     std::vector<vvImage::Pointer> GetOutputVVImages ();
57
58     // Information on available image types
59     void PrintAvailableImageTypes();
60     virtual std::string GetAvailableImageTypes() = 0;
61
62     virtual bool CheckImageType(unsigned int dim,unsigned int ncomp, std::string pixeltype) = 0;
63     virtual bool CheckImageType() = 0;
64
65     // Main function to call for using the filter. 
66     virtual bool Update() = 0;
67
68   protected:  
69     bool mReadOnDisk;
70     /// Call this function to dispatch an output towards the correct sink
71     template<class ImageType> 
72     void SetNextOutput(typename ImageType::Pointer output);
73
74     /// Call this function to get the nth itk input image, regardless of input source
75     template<class ImageType> 
76     typename ImageType::Pointer GetInput(unsigned int n);
77
78     std::vector<std::string> mInputFilenames;
79     std::list<std::string> mOutputFilenames;
80
81     bool mIOVerbose;
82     unsigned int mDim;
83     std::string mPixelTypeName;
84     unsigned int mNbOfComponents;
85     std::string mFilterName;
86
87     std::vector<vvImage::Pointer> mInputVVImages;
88     std::vector<vvImage::Pointer> mOutputVVImages;
89
90     void ImageTypeError();
91     void SetImageTypeError();
92     bool mFailOnImageTypeError;
93
94   }; // end class clitk::ImageToImageGenericFilter
95
96 #define ADD_VEC_IMAGE_TYPE(DIM, COMP, PT) this->mImageTypesManager.template AddNewDimensionAndPixelType<DIM,COMP, PT>();
97 #define ADD_IMAGE_TYPE(DIM, PT) this->mImageTypesManager.template AddNewDimensionAndPixelType<DIM, PT>();
98
99   //#include "clitkImageToImageGenericFilterBase.txx"
100
101 } // end namespace
102
103 #endif /* end #define CLITKIMAGETOIMAGEGENERICFILTERBASE_H */
104