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: 2003/09/10 14:28:31 $ 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 __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 00131 itkGetObjectMacro(SourceHistogram, HistogramType); 00132 itkGetObjectMacro(ReferenceHistogram, HistogramType); 00133 itkGetObjectMacro(OutputHistogram, HistogramType); 00134 00135 00136 protected: 00137 HistogramMatchingImageFilter(); 00138 ~HistogramMatchingImageFilter() {}; 00139 void PrintSelf(std::ostream& os, Indent indent) const; 00140 00141 void BeforeThreadedGenerateData(); 00142 void AfterThreadedGenerateData(); 00143 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, 00144 int threadId ); 00145 00147 void ComputeMinMaxMean( const InputImageType * image, 00148 double& minValue, double& maxValue, double& meanValue ); 00149 00151 void ConstructHistogram( const InputImageType * image, 00152 HistogramType * histogram, double minValue, 00153 double maxValue ); 00154 00155 private: 00156 HistogramMatchingImageFilter(const Self&); //purposely not implemented 00157 void operator=(const Self&); //purposely not implemented 00158 00159 unsigned long m_NumberOfHistogramLevels; 00160 unsigned long m_NumberOfMatchPoints; 00161 bool m_ThresholdAtMeanIntensity; 00162 00163 InputPixelType m_SourceIntensityThreshold; 00164 InputPixelType m_ReferenceIntensityThreshold; 00165 OutputPixelType m_OutputIntensityThreshold; 00166 00167 double m_SourceMinValue; 00168 double m_SourceMaxValue; 00169 double m_SourceMeanValue; 00170 double m_ReferenceMinValue; 00171 double m_ReferenceMaxValue; 00172 double m_ReferenceMeanValue; 00173 double m_OutputMinValue; 00174 double m_OutputMaxValue; 00175 double m_OutputMeanValue; 00176 00177 HistogramPointer m_SourceHistogram; 00178 HistogramPointer m_ReferenceHistogram; 00179 HistogramPointer m_OutputHistogram; 00180 00181 typedef vnl_matrix<double> TableType; 00182 TableType m_QuantileTable; 00183 00184 typedef vnl_vector<double> GradientArrayType; 00185 GradientArrayType m_Gradients; 00186 double m_LowerGradient; 00187 double m_UpperGradient; 00188 00189 }; 00190 00191 00192 } // end namespace itk 00193 00194 #ifndef ITK_MANUAL_INSTANTIATION 00195 #include "itkHistogramMatchingImageFilter.txx" 00196 #endif 00197 00198 #endif

Generated at Sun Apr 1 02:33:01 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000