Go to the documentation of this file.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, unsigned int NDimension, class TFunction >
00051 class ITK_EXPORT HistogramToImageFilter :
00052 public ImageSource<Image< typename TFunction::OutputPixelType, NDimension > >
00053 {
00054 public:
00055
00057 typedef TFunction FunctorType;
00058 typedef typename FunctorType::OutputPixelType OutputPixelType;
00059 typedef HistogramToImageFilter Self;
00060 typedef ImageSource< Image<OutputPixelType, NDimension > > Superclass;
00061 typedef SmartPointer<Self> Pointer;
00062 typedef SmartPointer<const Self> ConstPointer;
00063
00064 typedef Image<OutputPixelType, NDimension > OutputImageType;
00065 typedef typename Superclass::Pointer OutputImagePointer;
00066 typedef typename OutputImageType::SpacingType SpacingType;
00067 typedef typename OutputImageType::PointType PointType;
00068
00069
00070
00071 typedef itk::ImageRegionIteratorWithIndex< OutputImageType > ImageIteratorType;
00072
00074 itkNewMacro(Self);
00075
00077 itkTypeMacro(HistogramToImageFilter,ImageSource);
00078
00080 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00081
00083 typedef THistogram HistogramType;
00084 typedef typename HistogramType::MeasurementVectorType MeasurementVectorType;
00085 typedef typename HistogramType::SizeType HistogramSizeType;
00086 typedef typename OutputImageType::SizeType SizeType;
00087
00090 typedef SimpleDataObjectDecorator< HistogramType* > InputHistogramObjectType;
00091
00093 itkStaticConstMacro(ImageDimension, unsigned int, NDimension );
00094
00096 virtual void SetInput( const HistogramType *histogram);
00097 virtual void SetInput( const InputHistogramObjectType *inputObject);
00098 const InputHistogramObjectType* GetInput(void);
00100
00101
00104 itkSetMacro(Spacing,SpacingType);
00105 virtual void SetSpacing(const double* values);
00107
00108
00111 itkGetConstReferenceMacro(Spacing,SpacingType);
00112
00115 itkSetMacro(Origin,PointType);
00116 virtual void SetOrigin(const double* values);
00118
00120 itkGetConstReferenceMacro(Origin,PointType);
00121
00123 itkGetMacro(Size,SizeType);
00124
00125
00132 void SetFunctor(const FunctorType& functor)
00133 {
00134 m_Functor = functor;
00135 this->Modified();
00136 }
00137
00142 FunctorType& GetFunctor() { return m_Functor; }
00143 const FunctorType& GetFunctor() const { return m_Functor; }
00145
00146 void SetTotalFrequency( unsigned long n );
00147
00148
00149
00150 protected:
00151 HistogramToImageFilter();
00152 ~HistogramToImageFilter();
00153
00154 virtual void GenerateOutputInformation();
00155 virtual void GenerateData();
00156
00157 FunctorType m_Functor;
00158
00159 SizeType m_Size;
00160 SpacingType m_Spacing;
00161 PointType m_Origin;
00162
00163
00164 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00165
00166 private:
00167 HistogramToImageFilter(const Self&);
00168 void operator=(const Self&);
00169
00170
00171 };
00172
00173 }
00174
00175 #ifndef ITK_MANUAL_INSTANTIATION
00176 #include "itkHistogramToImageFilter.txx"
00177 #endif
00178
00179 #endif
00180