X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkImageToImageGenericFilterBase.h;h=262d6fc82f85e3d53159ce316dfaccc3f4ee9384;hb=e54275d138c6c8ff7a10bc4002079a41e06bd27d;hp=601a752fc55f56021e2803e6dfcf8987a727ba4a;hpb=1d93f10f32528c9ef0002c051c2140f8485b39fb;p=clitk.git diff --git a/common/clitkImageToImageGenericFilterBase.h b/common/clitkImageToImageGenericFilterBase.h index 601a752..262d6fc 100644 --- a/common/clitkImageToImageGenericFilterBase.h +++ b/common/clitkImageToImageGenericFilterBase.h @@ -15,16 +15,20 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html ======================================================================-====*/ + #ifndef CLITKIMAGETOIMAGEGENERICFILTERBASE_H #define CLITKIMAGETOIMAGEGENERICFILTERBASE_H + +// clitk #include "clitkCommon.h" #include "clitkImageCommon.h" #include "clitkCommonGenericFilter.h" +#include "clitkFilterBase.h" -// itk include +// itk #include -// vv include +// vv #include "vvImage.h" #include "vvFromITK.h" #include "vvToITK.h" @@ -48,12 +52,16 @@ namespace clitk { // Filters information const std::string & GetFilterName(); void SetFilterName(std::string & n); + + // Error management + itkSetMacro(LastError, std::string); + itkGetConstMacro(LastError, std::string); + bool HasError() { return (GetLastError() != ""); } // Generic IO /// Returns the dimension and pixel type of the *first* input void GetInputImageDimensionAndPixelType(unsigned int& dim, std::string& pixeltype, unsigned int & components); - // File IO void SetInputFilename(const std::string & filename); void AddInputFilename(const std::string & filename); @@ -82,8 +90,17 @@ namespace clitk { // Main function to call for using the filter. virtual bool Update() = 0; + // Get the associated filter + FilterBase * GetFilterBase() { return m_FilterBase; } + + // Indicate that the filter must stop as soon as possible (if threaded) + void MustStop(); + itkSetMacro(StopOnError, bool); + itkGetConstMacro(StopOnError, bool); + itkBooleanMacro(StopOnError); + protected: - bool mReadOnDisk; + bool m_ReadOnDisk; /// Call this function to dispatch an output towards the correct sink template void SetNextOutput(typename ImageType::Pointer output); @@ -92,21 +109,26 @@ namespace clitk { template typename ImageType::Pointer GetInput(unsigned int n); - std::vector mInputFilenames; - std::list mOutputFilenames; + std::vector m_InputFilenames; + std::list m_OutputFilenames; - bool mIOVerbose; - unsigned int mDim; - std::string mPixelTypeName; - unsigned int mNbOfComponents; - std::string mFilterName; + bool m_IOVerbose; + unsigned int m_Dim; + std::string m_PixelTypeName; + unsigned int m_NbOfComponents; + std::string m_FilterName; - std::vector mInputVVImages; - std::vector mOutputVVImages; + std::vector m_InputVVImages; + std::vector m_OutputVVImages; void ImageTypeError(); void SetImageTypeError(); - bool mFailOnImageTypeError; + bool m_FailOnImageTypeError; + + std::string m_LastError; + void SetFilterBase(FilterBase * f) { m_FilterBase = f; } + FilterBase * m_FilterBase; + bool m_StopOnError; }; // end class clitk::ImageToImageGenericFilter