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

itkHistogramToImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkHistogramToImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/01/25 09:18:58 $
00007   Version:   $Revision: 1.9 $
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 __itkHistogramToImageFilter_h
00018 #define __itkHistogramToImageFilter_h
00019 
00020 #include "itkImageSource.h"
00021 #include "itkConceptChecking.h"
00022 #include "itkHistogram.h"
00023 #include "itkImage.h"
00024 #include "itkImageRegionIteratorWithIndex.h"
00025 #include "itkSimpleDataObjectDecorator.h"
00026 
00027 
00028 namespace itk
00029 {
00030 
00050 template <class THistogram, class TFunction>
00051 class ITK_EXPORT HistogramToImageFilter :
00052   public ImageSource<Image< typename TFunction::OutputPixelType , 
00053   ::itk::Statistics::GetHistogramDimension<THistogram>::HistogramDimension> >
00054 {
00055 public:
00056 
00058   typedef TFunction                             FunctorType;
00059   typedef typename FunctorType::OutputPixelType OutputPixelType;
00060   typedef HistogramToImageFilter                Self;
00061   typedef ImageSource< Image<OutputPixelType, 
00062     ::itk::Statistics::GetHistogramDimension<THistogram>::HistogramDimension> >
00063     Superclass;
00064   typedef SmartPointer<Self>                   Pointer;
00065   typedef SmartPointer<const Self>             ConstPointer;
00066 
00067   typedef Image<OutputPixelType, 
00068     ::itk::Statistics::GetHistogramDimension<THistogram>::HistogramDimension >
00069     OutputImageType; 
00070   typedef typename Superclass::Pointer    OutputImagePointer;
00071   typedef typename OutputImageType::SpacingType SpacingType;
00072   typedef typename OutputImageType::PointType   PointType;
00073 
00074   
00075   // Define an iterator to iterate through the image
00076   typedef itk::ImageRegionIteratorWithIndex< Image<OutputPixelType, 
00077     ::itk::Statistics::GetHistogramDimension<THistogram>::HistogramDimension> >
00078                                                              ImageIteratorType;
00079 
00081   itkNewMacro(Self);
00082 
00084   itkTypeMacro(HistogramToImageFilter,ImageSource);
00085 
00087   typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00088 
00090   typedef THistogram                                     HistogramType;
00091   typedef typename HistogramType::MeasurementVectorType  MeasurementVectorType;
00092   typedef typename HistogramType::SizeType               HistogramSizeType;
00093   typedef typename HistogramType::SizeType               SizeType;
00094 
00097   typedef SimpleDataObjectDecorator< HistogramType* > InputHistogramObjectType;
00098 
00100   itkStaticConstMacro(ImageDimension, unsigned int,
00101     ::itk::Statistics::GetHistogramDimension<THistogram>::HistogramDimension );
00102 
00104   virtual void SetInput( const HistogramType *histogram);
00105   virtual void SetInput( const InputHistogramObjectType *inputObject);
00106   const InputHistogramObjectType* GetInput(void);
00108 
00109                       
00112   itkSetMacro(Spacing,SpacingType);
00113   virtual void SetSpacing(const double* values);
00115 
00116 
00119   itkGetConstReferenceMacro(Spacing,SpacingType);
00120 
00123   itkSetMacro(Origin,PointType);
00124   virtual void SetOrigin(const double* values);
00126 
00128   itkGetConstReferenceMacro(Origin,PointType);
00129 
00131   itkGetMacro(Size,HistogramSizeType);
00132 
00133 
00140   void SetFunctor(const FunctorType& functor)
00141     {
00142     m_Functor = functor;
00143     this->Modified();
00144     }
00145 
00150   FunctorType& GetFunctor() { return m_Functor; }
00151   const FunctorType& GetFunctor() const { return m_Functor; }
00153 
00154   void SetTotalFrequency( unsigned long n );
00155   
00156 
00157   
00158 protected:
00159   HistogramToImageFilter();
00160   ~HistogramToImageFilter();
00161 
00162   virtual void GenerateOutputInformation();
00163   virtual void GenerateData();
00164   
00165   FunctorType m_Functor;
00166   
00167   SizeType        m_Size;
00168   SpacingType     m_Spacing;
00169   PointType       m_Origin;
00170 
00171   
00172   virtual void PrintSelf(std::ostream& os, Indent indent) const;
00173 
00174 private:
00175   HistogramToImageFilter(const Self&); //purposely not implemented
00176   void operator=(const Self&); //purposely not implemented
00177 
00178 
00179 };
00180 
00181 } // end namespace itk
00182 
00183 #ifndef ITK_MANUAL_INSTANTIATION
00184 #include "itkHistogramToImageFilter.txx"
00185 #endif
00186 
00187 #endif
00188 

Generated at Wed Nov 5 21:51:50 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000