1 #ifndef CLITKIMAGETOIMAGEGENERICFILTERBASE_H
2 #define CLITKIMAGETOIMAGEGENERICFILTERBASE_H
3 #include "clitkCommon.h"
4 #include "clitkImageCommon.h"
5 #include "clitkCommonGenericFilter.h"
12 #include "vvFromITK.h"
17 //--------------------------------------------------------------------
18 class ImageToImageGenericFilterBase: public itk::Object {
21 // constructor - destructor
22 ImageToImageGenericFilterBase(std::string filterName);
23 virtual ~ImageToImageGenericFilterBase();
26 typedef ImageToImageGenericFilterBase Self;
27 typedef Object Superclass;
28 typedef itk::SmartPointer<Self> Pointer;
29 typedef itk::SmartPointer<const Self> ConstPointer;
31 // Filters information
32 const std::string & GetFilterName();
33 void SetFilterName(std::string & n);
36 /// Returns the dimension and pixel type of the *first* input
37 void GetInputImageDimensionAndPixelType(unsigned int& dim, std::string& pixeltype,
38 unsigned int & components);
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);
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 ();
58 // Information on available image types
59 void PrintAvailableImageTypes();
60 virtual std::string GetAvailableImageTypes() = 0;
62 virtual bool CheckImageType(unsigned int dim,unsigned int ncomp, std::string pixeltype) = 0;
63 virtual bool CheckImageType() = 0;
65 // Main function to call for using the filter.
66 virtual bool Update() = 0;
70 /// Call this function to dispatch an output towards the correct sink
71 template<class ImageType>
72 void SetNextOutput(typename ImageType::Pointer output);
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);
78 std::vector<std::string> mInputFilenames;
79 std::list<std::string> mOutputFilenames;
83 std::string mPixelTypeName;
84 unsigned int mNbOfComponents;
85 std::string mFilterName;
87 std::vector<vvImage::Pointer> mInputVVImages;
88 std::vector<vvImage::Pointer> mOutputVVImages;
90 void ImageTypeError();
91 void SetImageTypeError();
92 bool mFailOnImageTypeError;
94 }; // end class clitk::ImageToImageGenericFilter
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>();
99 //#include "clitkImageToImageGenericFilterBase.txx"
103 #endif /* end #define CLITKIMAGETOIMAGEGENERICFILTERBASE_H */