]> Creatis software - clitk.git/blob - itk/clitkLocallyAdaptiveBinaryThresholdImageFunction.h
changes in license header
[clitk.git] / itk / clitkLocallyAdaptiveBinaryThresholdImageFunction.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 __clitkLocallyAdaptiveBinaryThresholdImageFunction_h
19 #define __clitkLocallyAdaptiveBinaryThresholdImageFunction_h
20 #include "itkBinaryThresholdImageFunction.h"
21
22 namespace clitk
23 {
24
25 template <class TInputImage, class TCoordRep = float >
26 class ITK_EXPORT LocallyAdaptiveBinaryThresholdImageFunction :
27     public itk::BinaryThresholdImageFunction< TInputImage, TCoordRep >
28 {
29 public:
30   /** Standard class typedefs. */
31   typedef LocallyAdaptiveBinaryThresholdImageFunction            Self;
32   typedef itk::BinaryThresholdImageFunction<TInputImage,TCoordRep> Superclass;
33   typedef itk::SmartPointer<Self>                                  Pointer;
34   typedef itk::SmartPointer<const Self>                            ConstPointer;
35   
36   /** Run-time type information (and related methods). */
37   itkTypeMacro(LocallyAdaptiveBinaryThresholdImageFunction, BinaryThresholdImageFunction);
38
39   /** Method for creation through the object factory. */
40   itkNewMacro(Self);
41
42   /** InputImageType typedef support. */
43   typedef TInputImage InputImageType;
44
45   /** OutputType typdef support. */
46   typedef typename Superclass::OutputType OutputType;
47
48   /** Index typedef support. */
49   typedef typename Superclass::IndexType IndexType;
50   
51   /** ContinuousIndex typedef support. */
52   typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
53
54   /** Point typedef support. */
55   typedef typename Superclass::PointType PointType;
56
57   /** PixelType typedef support. */
58   typedef typename Superclass::PixelType PixelType;
59
60   /** Dimension of the underlying image. */
61   itkStaticConstMacro(ImageDimension, unsigned int,
62                       InputImageType::ImageDimension);
63
64   /** SizeType of the input image */
65   typedef typename InputImageType::SizeType InputSizeType;
66
67   /** Set the radius of the neighborhood used in computation. */
68   itkSetMacro(Radius, InputSizeType);
69
70   /** Get the radius of the neighborhood used in computation */
71   itkGetConstReferenceMacro(Radius, InputSizeType);
72
73   /** Evalulate the function at specified index */
74   virtual bool EvaluateAtIndex( const IndexType& index ) const;
75   
76   /** Evaluate the function at non-integer positions */
77   virtual bool Evaluate( const PointType& point ) const
78     { 
79     IndexType index;
80     this->ConvertPointToNearestIndex( point, index );
81     return this->EvaluateAtIndex( index ); 
82     }
83   virtual bool EvaluateAtContinuousIndex( 
84     const ContinuousIndexType& cindex ) const
85     { 
86     IndexType index;
87     this->ConvertContinuousIndexToNearestIndex( cindex, index );
88     return this->EvaluateAtIndex( index ); 
89     }
90
91   // JV
92   itkBooleanMacro(LowerBorderIsGiven);
93   itkSetMacro( LowerBorderIsGiven, bool);
94   itkGetConstReferenceMacro( LowerBorderIsGiven, bool);
95   itkBooleanMacro(UpperBorderIsGiven);
96   itkSetMacro( UpperBorderIsGiven, bool);
97   itkGetConstReferenceMacro( UpperBorderIsGiven, bool);
98   itkSetMacro( Multiplier, double);
99   itkGetConstMacro( Multiplier, double);
100   itkBooleanMacro(MaximumSDIsGiven);
101   itkSetMacro( MaximumSDIsGiven, bool);
102   itkGetConstReferenceMacro( MaximumSDIsGiven, bool);
103   itkSetMacro( MaximumSD, double);
104   itkGetConstMacro( MaximumSD, double);
105   
106
107   
108 protected:
109   LocallyAdaptiveBinaryThresholdImageFunction();
110   ~LocallyAdaptiveBinaryThresholdImageFunction(){};
111   void PrintSelf(std::ostream& os, itk::Indent indent) const;
112
113 private:
114   LocallyAdaptiveBinaryThresholdImageFunction( const Self& ); //purposely not implemented
115   void operator=( const Self& ); //purposely not implemented
116
117   InputSizeType m_Radius;
118
119   // JV 
120   bool m_LowerBorderIsGiven;
121   bool m_UpperBorderIsGiven;
122   bool m_MaximumSDIsGiven;
123   double m_Multiplier;
124   double m_MaximumSD;
125
126 };
127
128 } // end namespace clitk
129
130 // Define instantiation macro for this template.
131 #define ITK_TEMPLATE_LocallyAdaptiveBinaryThresholdImageFunction(_, EXPORT, x, y) namespace itk { \
132   _(2(class EXPORT LocallyAdaptiveBinaryThresholdImageFunction< ITK_TEMPLATE_2 x >)) \
133   namespace Templates { typedef LocallyAdaptiveBinaryThresholdImageFunction< ITK_TEMPLATE_2 x > \
134                                          LocallyAdaptiveBinaryThresholdImageFunction##y; } \
135   }
136
137 # include "clitkLocallyAdaptiveBinaryThresholdImageFunction.txx"
138
139 #endif