1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
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.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18 #ifndef CLITKIMAGETOIMAGEGENERICFILTERBASE_H
19 #define CLITKIMAGETOIMAGEGENERICFILTERBASE_H
20 #include "clitkCommon.h"
21 #include "clitkImageCommon.h"
22 #include "clitkCommonGenericFilter.h"
29 #include "vvFromITK.h"
34 //--------------------------------------------------------------------
35 class ImageToImageGenericFilterBase: public itk::Object {
38 // constructor - destructor
39 ImageToImageGenericFilterBase(std::string filterName);
40 virtual ~ImageToImageGenericFilterBase();
43 typedef ImageToImageGenericFilterBase Self;
44 typedef Object Superclass;
45 typedef itk::SmartPointer<Self> Pointer;
46 typedef itk::SmartPointer<const Self> ConstPointer;
48 // Filters information
49 const std::string & GetFilterName();
50 void SetFilterName(std::string & n);
53 /// Returns the dimension and pixel type of the *first* input
54 void GetInputImageDimensionAndPixelType(unsigned int& dim, std::string& pixeltype,
55 unsigned int & components);
58 void SetInputFilename(const std::string & filename);
59 void AddInputFilename(const std::string & filename);
60 void SetInputFilenames(const std::vector<std::string> & filenames);
61 void EnableReadOnDisk(bool b);
62 void SetOutputFilename(const std::string & filename);
63 void AddOutputFilename(const std::string & filename);
64 void SetOutputFilenames(const std::vector<std::string> & filenames);
65 std::string GetOutputFilename();
66 void SetIOVerbose(bool b);
69 void SetInputVVImage (vvImage::Pointer input);
70 void SetInputVVImages (std::vector<vvImage::Pointer> input);
71 void AddInputVVImage (vvImage::Pointer input);
72 vvImage::Pointer GetOutputVVImage ();
73 std::vector<vvImage::Pointer> GetOutputVVImages ();
75 // Information on available image types
76 void PrintAvailableImageTypes();
77 virtual std::string GetAvailableImageTypes() = 0;
79 virtual bool CheckImageType(unsigned int dim,unsigned int ncomp, std::string pixeltype) = 0;
80 virtual bool CheckImageType() = 0;
82 // Main function to call for using the filter.
83 virtual bool Update() = 0;
87 /// Call this function to dispatch an output towards the correct sink
88 template<class ImageType>
89 void SetNextOutput(typename ImageType::Pointer output);
91 /// Call this function to get the nth itk input image, regardless of input source
92 template<class ImageType>
93 typename ImageType::Pointer GetInput(unsigned int n);
95 std::vector<std::string> mInputFilenames;
96 std::list<std::string> mOutputFilenames;
100 std::string mPixelTypeName;
101 unsigned int mNbOfComponents;
102 std::string mFilterName;
104 std::vector<vvImage::Pointer> mInputVVImages;
105 std::vector<vvImage::Pointer> mOutputVVImages;
107 void ImageTypeError();
108 void SetImageTypeError();
109 bool mFailOnImageTypeError;
111 }; // end class clitk::ImageToImageGenericFilter
113 #define ADD_VEC_IMAGE_TYPE(DIM, COMP, PT) this->mImageTypesManager.template AddNewDimensionAndPixelType<DIM,COMP, PT>();
114 #define ADD_IMAGE_TYPE(DIM, PT) this->mImageTypesManager.template AddNewDimensionAndPixelType<DIM, PT>();
115 #define ADD_DEFAULT_IMAGE_TYPES(DIM) ADD_IMAGE_TYPE(DIM, char); \
116 ADD_IMAGE_TYPE(DIM, uchar); \
117 ADD_IMAGE_TYPE(DIM, short); \
118 ADD_IMAGE_TYPE(DIM, ushort); \
119 ADD_IMAGE_TYPE(DIM, int); \
120 ADD_IMAGE_TYPE(DIM, float); \
121 ADD_IMAGE_TYPE(DIM, double);
123 //#include "clitkImageToImageGenericFilterBase.txx"
127 #endif /* end #define CLITKIMAGETOIMAGEGENERICFILTERBASE_H */