ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkThresholdImageFilter.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 /*=========================================================================
00019  *
00020  *  Portions of this file are subject to the VTK Toolkit Version 3 copyright.
00021  *
00022  *  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00023  *
00024  *  For complete copyright, license and disclaimer of warranty information
00025  *  please refer to the NOTICE file at the top of the ITK source tree.
00026  *
00027  *=========================================================================*/
00028 #ifndef __itkThresholdImageFilter_h
00029 #define __itkThresholdImageFilter_h
00030 
00031 #include "itkInPlaceImageFilter.h"
00032 
00033 #include "itkConceptChecking.h"
00034 
00035 namespace itk
00036 {
00054 template< class TImage >
00055 class ITK_EXPORT ThresholdImageFilter:public InPlaceImageFilter< TImage, TImage >
00056 {
00057 public:
00059   typedef ThresholdImageFilter                 Self;
00060   typedef InPlaceImageFilter< TImage, TImage > Superclass;
00061   typedef SmartPointer< Self >                 Pointer;
00062   typedef SmartPointer< const Self >           ConstPointer;
00063 
00065   itkNewMacro(Self);
00066 
00068   itkTypeMacro(ThresholdImageFilter, InPlaceImageFilter);
00069 
00071   typedef typename TImage::PixelType PixelType;
00072 
00074 #ifdef ITK_USE_CONCEPT_CHECKING
00075 
00077   itkConceptMacro( PixelTypeComparableCheck,
00078                    ( Concept::Comparable< PixelType > ) );
00079   itkConceptMacro( PixelTypeOStreamWritableCheck,
00080                    ( Concept::OStreamWritable< PixelType > ) );
00081 
00083 #endif
00084 
00087   itkSetMacro(OutsideValue, PixelType);
00088 
00090   itkGetConstMacro(OutsideValue, PixelType);
00091 
00093   void ThresholdAbove(const PixelType & thresh);
00094 
00096   void ThresholdBelow(const PixelType & thresh);
00097 
00099   void ThresholdOutside(const PixelType & lower, const PixelType & upper);
00100 
00102   itkSetMacro(Lower, PixelType);
00103   itkGetConstMacro(Lower, PixelType);
00105 
00107   itkSetMacro(Upper, PixelType);
00108   itkGetConstMacro(Upper, PixelType);
00110 
00112   typedef TImage                                InputImageType;
00113   typedef typename InputImageType::ConstPointer InputImagePointer;
00114   typedef typename InputImageType::RegionType   InputImageRegionType;
00115   typedef typename InputImageType::PixelType    InputImagePixelType;
00116 
00118   typedef TImage                               OutputImageType;
00119   typedef typename OutputImageType::Pointer    OutputImagePointer;
00120   typedef typename OutputImageType::RegionType OutputImageRegionType;
00121   typedef typename OutputImageType::PixelType  OutputImagePixelType;
00122 protected:
00123   ThresholdImageFilter();
00124   ~ThresholdImageFilter() {}
00125   void PrintSelf(std::ostream & os, Indent indent) const;
00127 
00138   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
00139                             ThreadIdType threadId);
00140 
00141 private:
00142   ThresholdImageFilter(const Self &); //purposely not implemented
00143   void operator=(const Self &);       //purposely not implemented
00144 
00145   PixelType m_OutsideValue;
00146   PixelType m_Lower;
00147   PixelType m_Upper;
00148 };
00149 } // end namespace itk
00150 
00151 #ifndef ITK_MANUAL_INSTANTIATION
00152 #include "itkThresholdImageFilter.hxx"
00153 #endif
00154 
00155 #endif
00156