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

itkHistogramMatchingImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkHistogramMatchingImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/11 19:39:01 $
00007   Version:   $Revision: 1.4 $
00008 
00009   Copyright (c) 2002 Insight 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 __itkHistogramMatchingImageFilter_h
00018 #define __itkHistogramMatchingImageFilter_h
00019 
00020 #include "itkImageToImageFilter.h"
00021 #include "itkHistogram.h"
00022 #include "vnl/vnl_matrix.h"
00023 
00024 namespace itk
00025 {
00026 
00059 template <class TInputImage, class TOutputImage>
00060 class ITK_EXPORT HistogramMatchingImageFilter:
00061     public ImageToImageFilter<TInputImage,TOutputImage>
00062 {
00063 public:
00065   typedef HistogramMatchingImageFilter         Self;
00066   typedef ImageToImageFilter<TInputImage,TOutputImage>  Superclass;
00067   typedef SmartPointer<Self>  Pointer;
00068   typedef SmartPointer<const Self>  ConstPointer;
00069 
00071   itkNewMacro(Self);  
00072 
00074   itkTypeMacro(HistogramMatchingImageFilter, ImageToImageFilter);
00075 
00077   itkStaticConstMacro(ImageDimension, unsigned int,
00078                       TInputImage::ImageDimension);
00079 
00081   typedef typename TOutputImage::RegionType OutputImageRegionType;
00082 
00084   typedef typename Superclass::InputImageType InputImageType;
00085   typedef typename Superclass::InputImagePointer InputImagePointer;
00086   typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
00087   typedef typename Superclass::OutputImageType OutputImageType;
00088   typedef typename Superclass::OutputImagePointer OutputImagePointer;
00089   
00091   typedef typename InputImageType::PixelType InputPixelType;
00092   typedef typename OutputImageType::PixelType OutputPixelType;
00093 
00095   typedef Statistics::Histogram<InputPixelType, 1> HistogramType;
00096   typedef typename HistogramType::Pointer HistogramPointer;
00097 
00099   void SetSourceImage( const InputImageType * source )
00100     { this->SetInput( source ); }
00101   const InputImageType * GetSourceImage(void)
00102     { return this->GetInput(); }
00103 
00105   void SetReferenceImage( const InputImageType * reference );
00106   const InputImageType * GetReferenceImage(void);
00107 
00109   itkSetMacro( NumberOfHistogramLevels, unsigned long );
00110   itkGetMacro( NumberOfHistogramLevels, unsigned long );
00111 
00113   itkSetMacro( NumberOfMatchPoints, unsigned long );
00114   itkGetMacro( NumberOfMatchPoints, unsigned long );
00115 
00121   itkSetMacro( ThresholdAtMeanIntensity, bool );
00122   itkGetMacro( ThresholdAtMeanIntensity, bool );
00123   itkBooleanMacro( ThresholdAtMeanIntensity );
00124 
00126   virtual void GenerateInputRequestedRegion();
00127 
00128 protected:
00129   HistogramMatchingImageFilter();
00130   ~HistogramMatchingImageFilter() {};
00131   void PrintSelf(std::ostream& os, Indent indent) const;
00132 
00133   void BeforeThreadedGenerateData();
00134   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00135                             int threadId );
00136 
00138   void ComputeMinMaxMean( const InputImageType * image,
00139     double& minValue, double& maxValue, double& meanValue ); 
00140 
00142   void ConstructHistogram( const InputImageType * image,
00143     HistogramType * histogram, double minValue,
00144     double maxValue );
00145 
00146 private:
00147   HistogramMatchingImageFilter(const Self&); //purposely not implemented
00148   void operator=(const Self&); //purposely not implemented
00149 
00150   unsigned long         m_NumberOfHistogramLevels;
00151   unsigned long         m_NumberOfMatchPoints;
00152   bool                  m_ThresholdAtMeanIntensity;
00153 
00154   InputPixelType        m_SourceIntensityThreshold;
00155   InputPixelType        m_ReferenceIntensityThreshold;
00156 
00157   double                m_SourceMinValue;
00158   double                m_SourceMaxValue;
00159   double                m_SourceMeanValue;
00160   double                m_ReferenceMinValue;
00161   double                m_ReferenceMaxValue;
00162   double                m_ReferenceMeanValue;
00163 
00164   typedef vnl_matrix<double>  TableType;
00165   TableType             m_QuantileTable;
00166 
00167   typedef vnl_vector<double>  GradientArrayType;
00168   GradientArrayType     m_Gradients;
00169   double                m_LowerGradient;
00170   double                m_UpperGradient;
00171 
00172 };
00173 
00174   
00175 } // end namespace itk
00176   
00177 #ifndef ITK_MANUAL_INSTANTIATION
00178 #include "itkHistogramMatchingImageFilter.txx"
00179 #endif
00180   
00181 #endif

Generated at Fri May 21 01:14:51 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000