ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkBinaryThresholdSpatialFunction.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkBinaryThresholdSpatialFunction_h
00019 #define __itkBinaryThresholdSpatialFunction_h
00020 
00021 #include "itkSpatialFunction.h"
00022 #include "itkImageBase.h"
00023 
00024 namespace itk
00025 {
00041 template< typename TFunction >
00042 class ITK_EXPORT BinaryThresholdSpatialFunction:
00043   public SpatialFunction< bool,
00044                           ::itk::GetImageDimension< TFunction >::ImageDimension,
00045                           typename TFunction::InputType >
00046 {
00047 public:
00049   typedef BinaryThresholdSpatialFunction Self;
00050   typedef SpatialFunction< bool,
00051                            ::itk::GetImageDimension< TFunction >::ImageDimension,
00052                            typename TFunction::InputType > Superclass;
00053 
00054   typedef SmartPointer< Self >       Pointer;
00055   typedef SmartPointer< const Self > ConstPointer;
00056 
00058   itkTypeMacro(BinaryThresholdSpatialFunction, SpatialFunction);
00059 
00061   itkNewMacro(Self);
00062 
00064   typedef typename Superclass::OutputType OutputType;
00065 
00067   typedef typename TFunction::InputType InputType;
00068 
00070   typedef TFunction FunctionType;
00071 
00073   typedef typename TFunction::OutputType FunctionOutputType;
00074 
00076   itkSetMacro(LowerThreshold, FunctionOutputType);
00077   itkGetConstReferenceMacro(LowerThreshold, FunctionOutputType);
00079 
00081   itkSetMacro(UpperThreshold, FunctionOutputType);
00082   itkGetConstReferenceMacro(UpperThreshold, FunctionOutputType);
00084 
00086   itkSetObjectMacro(Function, FunctionType);
00087   itkGetConstObjectMacro(Function, FunctionType);
00089 
00091   virtual OutputType Evaluate(const InputType & point) const;
00092 
00093 protected:
00094 
00095   BinaryThresholdSpatialFunction();
00096   ~BinaryThresholdSpatialFunction();
00097   void PrintSelf(std::ostream & os, Indent indent) const;
00098 
00099   FunctionOutputType m_LowerThreshold;
00100   FunctionOutputType m_UpperThreshold;
00101 
00102   typename FunctionType::Pointer m_Function;
00103 private:
00104   BinaryThresholdSpatialFunction(const Self &); //purposely not implemented
00105   void operator=(const Self &);                 //purposely not implemented
00106 };
00107 } // end namespace itk
00108 
00109 #ifndef ITK_MANUAL_INSTANTIATION
00110 #include "itkBinaryThresholdSpatialFunction.hxx"
00111 #endif
00112 
00113 #endif
00114