]> Creatis software - clitk.git/blob - itk/clitkConditionalBinaryDilateImageFilter.h
relative position 2D slice by slice (attempt)
[clitk.git] / itk / clitkConditionalBinaryDilateImageFilter.h
1 #ifndef clitkConditionalBinaryDilateImageFilter_h
2 #define clitkConditionalBinaryDilateImageFilter_h
3
4 /* =================================================
5  * @file   clitkConditionalBinaryDilateImageFilter.h
6  * @author 
7  * @date   
8  * 
9  * @brief 
10  * 
11  ===================================================*/
12
13 // clitk include
14 #include "clitkIO.h"
15 #include "clitkCommon.h"
16
17 // itk include
18 #include <vector>
19 #include <queue>
20 #include "itkBinaryMorphologyImageFilter.h"
21 #include "itkImage.h"
22 #include "itkNumericTraits.h"
23 #include "itkNeighborhoodIterator.h"
24 #include "itkConstNeighborhoodIterator.h"
25 #include "itkNeighborhood.h"
26 #include "itkImageBoundaryCondition.h"
27 #include "itkImageRegionIterator.h"
28 #include "itkConceptChecking.h"
29
30 namespace clitk
31 {
32
33   template <class TInputImage, class TOutputImage, class TKernel>
34   class ITK_EXPORT ConditionalBinaryDilateImageFilter :
35     public itk::BinaryMorphologyImageFilter< TInputImage, TOutputImage, TKernel >
36   {
37   public:
38     /** Extract dimension from input and output image. */
39     itkStaticConstMacro(InputImageDimension, unsigned int,
40                         TInputImage::ImageDimension);
41     itkStaticConstMacro(OutputImageDimension, unsigned int,
42                         TOutputImage::ImageDimension);
43
44     /** Extract the dimension of the kernel */
45     itkStaticConstMacro(KernelDimension, unsigned int,
46                         TKernel::NeighborhoodDimension);
47   
48     /** Convenient typedefs for simplifying declarations. */
49     typedef TInputImage  InputImageType;
50     typedef TOutputImage OutputImageType;
51     typedef TKernel      KernelType;
52   
53
54     /** Standard class typedefs. */
55     typedef ConditionalBinaryDilateImageFilter   Self;
56     typedef itk::BinaryMorphologyImageFilter<InputImageType, OutputImageType,
57                                         KernelType> Superclass;
58     typedef itk::SmartPointer<Self>        Pointer;
59     typedef itk::SmartPointer<const Self>  ConstPointer;
60
61     /** Method for creation through the object factory. */
62     itkNewMacro(Self);
63
64     /** Run-time type information (and related methods). */
65     itkTypeMacro(ConditionalBinaryDilateImageFilter, BinaryMorphologyImageFilter);
66
67     /** Kernel (structuring element) iterator. */
68     typedef typename KernelType::ConstIterator KernelIteratorType;
69
70     /** Image typedef support. */
71     typedef typename InputImageType::PixelType               InputPixelType;
72     typedef typename OutputImageType::PixelType              OutputPixelType;
73   typedef typename itk::NumericTraits<InputPixelType>::RealType InputRealType;
74     typedef typename InputImageType::OffsetType              OffsetType;
75     typedef typename InputImageType::IndexType               IndexType;
76
77     typedef typename InputImageType::RegionType  InputImageRegionType;
78     typedef typename OutputImageType::RegionType OutputImageRegionType;
79     typedef typename InputImageType::SizeType    InputSizeType;
80
81     /** Set the value in the image to consider as "foreground". Defaults to
82      * maximum value of PixelType. This is an alias to the
83      * ForegroundValue in the superclass. */
84     void SetDilateValue(const InputPixelType& value)
85     { this->SetForegroundValue( value ); }
86
87     /** Get the value in the image considered as "foreground". Defaults to
88      * maximum value of PixelType. This is an alias to the
89      * ForegroundValue in the superclass. */
90     InputPixelType GetDilateValue() const
91     { return this->GetForegroundValue(); }
92
93   protected:
94     ConditionalBinaryDilateImageFilter();
95     virtual ~ConditionalBinaryDilateImageFilter(){}
96   void PrintSelf(std::ostream& os, itk::Indent indent) const;
97
98     void GenerateData();
99
100     // type inherited from the superclass
101     typedef typename Superclass::NeighborIndexContainer NeighborIndexContainer;
102
103   private:
104     ConditionalBinaryDilateImageFilter(const Self&); //purposely not implemented
105     void operator=(const Self&); //purposely not implemented
106
107   };
108
109 } // end namespace itk
110
111 #ifndef ITK_MANUAL_INSTANTIATION
112 #include "clitkConditionalBinaryDilateImageFilter.txx"
113 #endif
114
115 #endif