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 ===========================================================================**/
18 #ifndef __clitkLocallyAdaptiveBinaryThresholdImageFunction_h
19 #define __clitkLocallyAdaptiveBinaryThresholdImageFunction_h
20 #include "itkBinaryThresholdImageFunction.h"
25 template <class TInputImage, class TCoordRep = float >
26 class ITK_EXPORT LocallyAdaptiveBinaryThresholdImageFunction :
27 public itk::BinaryThresholdImageFunction< TInputImage, TCoordRep >
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;
36 /** Run-time type information (and related methods). */
37 itkTypeMacro(LocallyAdaptiveBinaryThresholdImageFunction, BinaryThresholdImageFunction);
39 /** Method for creation through the object factory. */
42 /** InputImageType typedef support. */
43 typedef TInputImage InputImageType;
45 /** OutputType typdef support. */
46 typedef typename Superclass::OutputType OutputType;
48 /** Index typedef support. */
49 typedef typename Superclass::IndexType IndexType;
51 /** ContinuousIndex typedef support. */
52 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
54 /** Point typedef support. */
55 typedef typename Superclass::PointType PointType;
57 /** PixelType typedef support. */
58 typedef typename Superclass::PixelType PixelType;
60 /** Dimension of the underlying image. */
61 itkStaticConstMacro(ImageDimension, unsigned int,
62 InputImageType::ImageDimension);
64 /** SizeType of the input image */
65 typedef typename InputImageType::SizeType InputSizeType;
67 /** Set the radius of the neighborhood used in computation. */
68 itkSetMacro(Radius, InputSizeType);
70 /** Get the radius of the neighborhood used in computation */
71 itkGetConstReferenceMacro(Radius, InputSizeType);
73 /** Evalulate the function at specified index */
74 virtual bool EvaluateAtIndex( const IndexType& index ) const;
76 /** Evaluate the function at non-integer positions */
77 virtual bool Evaluate( const PointType& point ) const
80 this->ConvertPointToNearestIndex( point, index );
81 return this->EvaluateAtIndex( index );
83 virtual bool EvaluateAtContinuousIndex(
84 const ContinuousIndexType& cindex ) const
87 this->ConvertContinuousIndexToNearestIndex( cindex, index );
88 return this->EvaluateAtIndex( index );
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);
109 LocallyAdaptiveBinaryThresholdImageFunction();
110 ~LocallyAdaptiveBinaryThresholdImageFunction(){};
111 void PrintSelf(std::ostream& os, itk::Indent indent) const;
114 LocallyAdaptiveBinaryThresholdImageFunction( const Self& ); //purposely not implemented
115 void operator=( const Self& ); //purposely not implemented
117 InputSizeType m_Radius;
120 bool m_LowerBorderIsGiven;
121 bool m_UpperBorderIsGiven;
122 bool m_MaximumSDIsGiven;
128 } // end namespace clitk
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; } \
137 # include "clitkLocallyAdaptiveBinaryThresholdImageFunction.txx"