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

itkMovingHistogramImageFilterBase.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkMovingHistogramImageFilterBase.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-23 03:43:42 $
00007   Version:   $Revision: 1.7 $
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 __itkMovingHistogramImageFilterBase_h
00018 #define __itkMovingHistogramImageFilterBase_h
00019 
00020 #include "itkKernelImageFilter.h"
00021 #include <list>
00022 #include <map>
00023 #include <set>
00024 
00025 namespace itk {
00026 
00090 template<class TInputImage, class TOutputImage, class TKernel >
00091 class ITK_EXPORT MovingHistogramImageFilterBase :
00092     public KernelImageFilter<TInputImage, TOutputImage, TKernel>
00093 {
00094 public:
00096   typedef MovingHistogramImageFilterBase                         Self;
00097   typedef KernelImageFilter<TInputImage, TOutputImage, TKernel>  Superclass;
00098   typedef SmartPointer<Self>                                     Pointer;
00099   typedef SmartPointer<const Self>                               ConstPointer;
00100 
00102   itkNewMacro(Self);  
00103 
00105   itkTypeMacro(MovingHistogramImageFilterBase, 
00106                KernelImageFilter);
00107 
00109   typedef TInputImage                                            InputImageType;
00110   typedef TOutputImage                                           OutputImageType;
00111   typedef typename TInputImage::RegionType                       RegionType;
00112   typedef typename TInputImage::SizeType                         SizeType;
00113   typedef typename TInputImage::IndexType                        IndexType;
00114   typedef typename TInputImage::PixelType                        PixelType;
00115   typedef typename TInputImage::OffsetType                       OffsetType;
00116   typedef typename Superclass::OutputImageRegionType             OutputImageRegionType;
00117   typedef typename TOutputImage::PixelType                       OutputPixelType;
00118 
00120   itkStaticConstMacro(ImageDimension, unsigned int,
00121                       TInputImage::ImageDimension);
00122 
00124   typedef TKernel                                                KernelType;
00125 
00127   typedef typename KernelType::ConstIterator                     KernelIteratorType;
00128 
00130   typedef typename KernelType::SizeType                          RadiusType;
00131 
00132   typedef typename std::list< OffsetType >                       OffsetListType;
00133 
00134   typedef typename std::map< OffsetType, OffsetListType, typename OffsetType::LexicographicCompare >          OffsetMapType;
00135 
00137   void SetKernel( const KernelType& kernel );
00138 
00139   itkGetConstMacro(PixelsPerTranslation, unsigned long);
00140   
00141 protected:
00142   MovingHistogramImageFilterBase();
00143   ~MovingHistogramImageFilterBase() {};
00144 
00145   void PrintSelf(std::ostream& os, Indent indent) const;
00146   
00147   void GetDirAndOffset(const IndexType LineStart, 
00148                       const IndexType PrevLineStart,
00149                       OffsetType &LineOffset,
00150                       OffsetType &Changes,
00151                       int &LineDirection);
00152 
00153   // store the added and removed pixel offset in a list
00154   OffsetMapType m_AddedOffsets;
00155   OffsetMapType m_RemovedOffsets;
00156 
00157   // store the offset of the kernel to initialize the histogram
00158   OffsetListType m_KernelOffsets;
00159 
00160   FixedArray< int, itkGetStaticConstMacro(ImageDimension) > m_Axes;
00161 
00162   unsigned long m_PixelsPerTranslation;
00163 
00164 
00165 private:
00166   MovingHistogramImageFilterBase(const Self&); //purposely not implemented
00167   void operator=(const Self&); //purposely not implemented
00168 
00169   class DirectionCost
00170     {
00171     public :
00172     DirectionCost( int dimension, int count )
00173       {
00174       m_Dimension = dimension;
00175       m_Count = count;
00176       }
00177     
00182     inline bool operator< ( const DirectionCost &dc ) const
00183       {
00184       if( m_Count > dc.m_Count )
00185         { return true; }
00186       else if( m_Count < dc.m_Count )
00187         { return false; }
00188       else //if (m_Count == dc.m_Count) 
00189         { return m_Dimension > dc.m_Dimension; }
00190       }
00192 
00193     int m_Dimension;
00194     int m_Count;
00195     };
00196 
00197 }; // end of class
00198 
00199 } // end namespace itk
00200   
00201 #ifndef ITK_MANUAL_INSTANTIATION
00202 #include "itkMovingHistogramImageFilterBase.txx"
00203 #endif
00204 
00205 #endif
00206 

Generated at Mon Jul 12 2010 19:11:03 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000