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://www.centreleonberard.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 ===========================================================================**/
19 #ifndef CLITKMORPHOMATHFILTER_H
20 #define CLITKMORPHOMATHFILTER_H
24 #include "clitkImageCommon.h"
25 #include "clitkMorphoMath_ggo.h"
26 #include "clitkConditionalBinaryErodeImageFilter.h"
27 #include "clitkConditionalBinaryDilateImageFilter.h"
30 #include <itkLightObject.h>
31 #include <itkBinaryErodeImageFilter.h>
32 #include <itkBinaryDilateImageFilter.h>
33 #include <itkBinaryMorphologicalClosingImageFilter.h>
34 #include <itkBinaryMorphologicalOpeningImageFilter.h>
35 #include <itkBinaryBallStructuringElement.h>
36 #include <itkCastImageFilter.h>
40 //--------------------------------------------------------------------
41 template<class ImageType>
42 class ITK_EXPORT MorphoMathFilter:
43 public clitk::FilterBase,
44 public itk::ImageToImageFilter<ImageType, ImageType>
48 /** Standard class typedefs. */
49 typedef itk::ImageToImageFilter<ImageType, ImageType> Superclass;
50 typedef MorphoMathFilter<ImageType> Self;
51 typedef itk::SmartPointer<Self> Pointer;
52 typedef itk::SmartPointer<const Self> ConstPointer;
54 /** Method for creation through the object factory. */
57 /** Run-time type information (and related methods). */
58 itkTypeMacro(AddRelativePositionConstraintToLabelImageFilter, ImageToImageFilter);
61 /** Some convenient typedefs. */
62 typedef typename ImageType::ConstPointer ImageConstPointer;
63 typedef typename ImageType::Pointer ImagePointer;
64 typedef typename ImageType::RegionType RegionType;
65 typedef typename ImageType::PixelType PixelType;
66 typedef typename ImageType::SpacingType SpacingType;
67 typedef typename ImageType::SizeType SizeType;
68 typedef typename ImageType::IndexType IndexType;
69 typedef typename ImageType::PointType PointType;
70 typedef float InternalPixelType;
71 typedef itk::Image<InternalPixelType, ImageType::ImageDimension> InternalImageType;
73 /** ImageDimension constants */
74 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
75 typedef itk::Image<float, ImageDimension> FloatImageType;
77 /** Operation types */
78 typedef enum { Erode = 0, Dilate = 1,
80 CondErode = 4, CondDilate = 5
81 } OperationTypeEnumeration;
84 itkGetConstMacro(VerboseFlag, bool);
85 itkSetMacro(VerboseFlag, bool);
86 itkBooleanMacro(VerboseFlag);
88 itkGetConstMacro(BackgroundValue, PixelType);
89 itkSetMacro(BackgroundValue, PixelType);
91 itkGetConstMacro(ForegroundValue, PixelType);
92 itkSetMacro(ForegroundValue, PixelType);
94 void SetOperationType(int type);
96 itkGetConstMacro(RadiusInMM, PointType);
97 void SetRadiusInMM(PointType & p);
99 itkGetConstMacro(Radius, SizeType);
100 void SetRadius(SizeType & r);
101 void SetRadius(int r);
103 itkGetConstMacro(BoundaryToForegroundFlag, bool);
104 itkSetMacro(BoundaryToForegroundFlag, bool);
105 itkBooleanMacro(BoundaryToForegroundFlag);
107 itkGetConstMacro(ExtendSupportFlag, bool);
108 itkSetMacro(ExtendSupportFlag, bool);
109 itkBooleanMacro(ExtendSupportFlag);
113 virtual ~MorphoMathFilter();
116 PixelType m_BackgroundValue;
117 PixelType m_ForegroundValue;
118 PointType m_RadiusInMM;
120 bool m_RadiusInMMIsSet;
122 OperationTypeEnumeration m_OperationType;
123 bool m_BoundaryToForegroundFlag;
124 bool m_ExtendSupportFlag;
125 typename InternalImageType::Pointer input;
127 virtual void GenerateOutputInformation();
128 virtual void GenerateInputRequestedRegion();
129 virtual void GenerateData();
132 MorphoMathFilter(const Self&); //purposely not implemented
133 void operator=(const Self&); //purposely not implemented
136 } // end namespace clitk
137 #ifndef ITK_MANUAL_INSTANTIATION
138 #include "clitkMorphoMathFilter.txx"
141 #endif //#define CLITKMORPHOMATHFILTER_H