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