00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
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);
00107
00108
00111 itkSetMacro(Spacing,SpacingType);
00112 virtual void SetSpacing(const double* values);
00113
00114
00117 itkGetConstReferenceMacro(Spacing,SpacingType);
00118
00121 itkSetMacro(Origin,PointType);
00122 virtual void SetOrigin(const double* values);
00123
00125 itkGetConstReferenceMacro(Origin,PointType);
00126
00128 itkGetMacro(Size,HistogramSizeType);
00129
00130
00137 void SetFunctor(const FunctorType& functor)
00138 {
00139 m_Functor = functor;
00140 this->Modified();
00141 }
00146 FunctorType& GetFunctor() { return m_Functor; };
00147 const FunctorType& GetFunctor() const { return m_Functor; };
00148
00149 void SetTotalFrequency( unsigned long n );
00150
00151
00152
00153 protected:
00154 HistogramToImageFilter();
00155 ~HistogramToImageFilter();
00156
00157 virtual void GenerateOutputInformation(){};
00158 virtual void GenerateData();
00159
00160 FunctorType m_Functor;
00161
00162 SizeType m_Size;
00163 SpacingType m_Spacing;
00164 PointType m_Origin;
00165
00166
00167 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00168
00169 private:
00170 HistogramToImageFilter(const Self&);
00171 void operator=(const Self&);
00172
00173
00174 };
00175
00176 }
00177
00178 #ifndef ITK_MANUAL_INSTANTIATION
00179 #include "itkHistogramToImageFilter.txx"
00180 #endif
00181
00182 #endif