Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkRobustAutomaticThresholdImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkRobustAutomaticThresholdImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-23 03:43:42 $
00007   Version:   $Revision: 1.3 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkRobustAutomaticThresholdImageFilter_h
00018 #define __itkRobustAutomaticThresholdImageFilter_h
00019 
00020 #include "itkImageToImageFilter.h"
00021 #include "itkRobustAutomaticThresholdCalculator.h"
00022 
00023 namespace itk {
00024 
00042 template<class TInputImage, class TGradientImage=TInputImage, class TOutputImage=TInputImage>
00043 class ITK_EXPORT RobustAutomaticThresholdImageFilter : 
00044     public ImageToImageFilter<TInputImage, TOutputImage>
00045 {
00046 public:
00048   typedef RobustAutomaticThresholdImageFilter           Self;
00049   typedef ImageToImageFilter<TInputImage,TOutputImage>  Superclass;
00050   typedef SmartPointer<Self>                            Pointer;
00051   typedef SmartPointer<const Self>                      ConstPointer;
00052 
00054   itkNewMacro(Self);  
00055 
00057   itkTypeMacro(RobustAutomaticThresholdImageFilter, ImageToImageFilter);
00058 
00060   typedef TInputImage                          InputImageType;
00061   typedef TGradientImage                       GradientImageType;
00062 
00064   typedef typename TInputImage::PixelType      InputPixelType;
00065   typedef typename TOutputImage::PixelType     OutputPixelType;
00066   typedef typename TGradientImage::PixelType   GradientPixelType;
00067 
00069   typedef typename TInputImage::Pointer        InputImagePointer;
00070   typedef typename TOutputImage::Pointer       OutputImagePointer;
00071   typedef typename TGradientImage::Pointer     GradientImagePointer;
00072 
00073   typedef typename TInputImage::SizeType       InputSizeType;
00074   typedef typename TInputImage::IndexType      InputIndexType;
00075   typedef typename TInputImage::RegionType     InputImageRegionType;
00076   typedef typename TOutputImage::SizeType      OutputSizeType;
00077   typedef typename TOutputImage::IndexType     OutputIndexType;
00078   typedef typename TOutputImage::RegionType    OutputImageRegionType;
00079 
00080   typedef RobustAutomaticThresholdCalculator< TInputImage, TGradientImage >
00081                                                CalculatorType;
00082   
00084   itkStaticConstMacro(InputImageDimension, unsigned int,
00085                       TInputImage::ImageDimension );
00086   itkStaticConstMacro(OutputImageDimension, unsigned int,
00087                       TOutputImage::ImageDimension );
00089 
00092   itkSetMacro(OutsideValue,OutputPixelType);
00093 
00095   itkGetConstMacro(OutsideValue,OutputPixelType);
00096 
00099   itkSetMacro(InsideValue,OutputPixelType);
00100 
00102   itkGetConstMacro(InsideValue,OutputPixelType);
00103 
00105   itkGetConstMacro(Threshold,InputPixelType);
00106 
00107   itkSetMacro(Pow, double);
00108   itkGetConstMacro(Pow, double);
00109 
00110 #ifdef ITK_USE_CONCEPT_CHECKING
00111 
00112   itkConceptMacro(OutputComparableCheck,
00113     (Concept::Comparable<OutputPixelType>));
00114   itkConceptMacro(OutputOStreamWritableCheck,
00115     (Concept::OStreamWritable<OutputPixelType>));
00116 
00118 #endif
00119 
00121   void SetGradientImage(GradientImageType *input)
00122     {
00123     // Process object is not const-correct so the const casting is required.
00124     this->SetNthInput( 1, const_cast<GradientImageType *>(input) );
00125     }
00126 
00128   GradientImageType * GetGradientImage()
00129     {
00130     return static_cast<GradientImageType*>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
00131     }
00132 
00133 
00135   void SetInput1(TInputImage *input)
00136     {
00137     this->SetInput( input );
00138     }
00139 
00141   void SetInput2(GradientImageType *input)
00142     {
00143     this->SetGradientImage( input );
00144     }
00145 
00146 protected:
00147   RobustAutomaticThresholdImageFilter();
00148   ~RobustAutomaticThresholdImageFilter(){};
00149   void PrintSelf(std::ostream& os, Indent indent) const;
00150 
00151   void GenerateInputRequestedRegion();
00152   void GenerateData ();
00153 
00154 private:
00155   RobustAutomaticThresholdImageFilter(const Self&); //purposely not implemented
00156   void operator=(const Self&); //purposely not implemented
00157 
00158   double              m_Pow;
00159   InputPixelType      m_Threshold;
00160   OutputPixelType     m_InsideValue;
00161   OutputPixelType     m_OutsideValue;
00162 
00163 
00164 }; // end of class
00165 
00166 } // end namespace itk
00167   
00168 #ifndef ITK_MANUAL_INSTANTIATION
00169 #include "itkRobustAutomaticThresholdImageFilter.txx"
00170 #endif
00171 
00172 #endif
00173 

Generated at Tue Sep 15 04:42:07 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000