ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkHistogramToTextureFeaturesFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkHistogramToTextureFeaturesFilter_h
00019 #define __itkHistogramToTextureFeaturesFilter_h
00020 
00021 #include "itkHistogram.h"
00022 #include "itkMacro.h"
00023 #include "itkProcessObject.h"
00024 #include "itkSimpleDataObjectDecorator.h"
00025 
00026 namespace itk
00027 {
00028 namespace Statistics
00029 {
00102 template< class THistogram >
00103 class ITK_EXPORT HistogramToTextureFeaturesFilter:public ProcessObject
00104 {
00105 public:
00107   typedef HistogramToTextureFeaturesFilter Self;
00108   typedef ProcessObject                    Superclass;
00109   typedef SmartPointer< Self >             Pointer;
00110   typedef SmartPointer< const Self >       ConstPointer;
00111 
00113   itkTypeMacro(HistogramToTextureFeaturesFilter, ProcessObject);
00114 
00116   itkNewMacro(Self);
00117 
00118   typedef THistogram                                    HistogramType;
00119   typedef typename HistogramType::Pointer               HistogramPointer;
00120   typedef typename HistogramType::ConstPointer          HistogramConstPointer;
00121   typedef typename HistogramType::MeasurementType       MeasurementType;
00122   typedef typename HistogramType::MeasurementVectorType MeasurementVectorType;
00123   typedef typename HistogramType::IndexType             IndexType;
00124   typedef typename HistogramType::AbsoluteFrequencyType AbsoluteFrequencyType;
00125   typedef typename HistogramType::RelativeFrequencyType RelativeFrequencyType;
00126 
00127   typedef typename HistogramType::TotalAbsoluteFrequencyType
00128   TotalAbsoluteFrequencyType;
00129 
00130   typedef typename HistogramType::TotalRelativeFrequencyType
00131   TotalRelativeFrequencyType;
00132 
00134   typedef std::vector< RelativeFrequencyType > RelativeFrequencyContainerType;
00135 
00137   using Superclass::SetInput;
00138   void SetInput(const HistogramType *histogram);
00139 
00140   const HistogramType * GetInput() const;
00141 
00143   typedef DataObject::Pointer DataObjectPointer;
00144 
00146   typedef SimpleDataObjectDecorator< MeasurementType > MeasurementObjectType;
00147 
00149   MeasurementType GetEnergy() const;
00150 
00151   const MeasurementObjectType * GetEnergyOutput() const;
00152 
00154   MeasurementType GetEntropy() const;
00155 
00156   const MeasurementObjectType * GetEntropyOutput() const;
00157 
00159   MeasurementType GetCorrelation() const;
00160 
00161   const MeasurementObjectType * GetCorrelationOutput() const;
00162 
00164   MeasurementType GetInverseDifferenceMoment() const;
00165 
00166   const MeasurementObjectType * GetInverseDifferenceMomentOutput() const;
00167 
00169   MeasurementType GetInertia() const;
00170 
00171   const MeasurementObjectType * GetInertiaOutput() const;
00172 
00174   MeasurementType GetClusterShade() const;
00175 
00176   const MeasurementObjectType * GetClusterShadeOutput() const;
00177 
00179   MeasurementType GetClusterProminence() const;
00180 
00181   const MeasurementObjectType * GetClusterProminenceOutput() const;
00182 
00184   MeasurementType GetHaralickCorrelation() const;
00185 
00186   const MeasurementObjectType * GetHaralickCorrelationOutput() const;
00187 
00189   typedef enum {
00190     Energy,
00191     Entropy,
00192     Correlation,
00193     InverseDifferenceMoment,
00194     Inertia,
00195     ClusterShade,
00196     ClusterProminence,
00197     HaralickCorrelation,
00198     InvalidFeatureName
00199     }  TextureFeatureName;
00200 
00202   MeasurementType GetFeature(TextureFeatureName name);
00203 
00204 protected:
00205   HistogramToTextureFeaturesFilter();
00206   ~HistogramToTextureFeaturesFilter() {}
00207   void PrintSelf(std::ostream & os, Indent indent) const;
00208 
00210   typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
00211   using Superclass::MakeOutput;
00212   virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType);
00213 
00214   void GenerateData();
00215 
00216 private:
00217   HistogramToTextureFeaturesFilter(const Self &); //purposely not implemented
00218   void operator=(const Self &);                   //purposely not implemented
00219 
00220   void ComputeMeansAndVariances(double & pixelMean, double & marginalMean,
00221                                 double & marginalDevSquared, double & pixelVariance);
00222 
00223   RelativeFrequencyContainerType m_RelativeFrequencyContainer;
00224 };
00225 } // end of namespace Statistics
00226 } // end of namespace itk
00227 
00228 #ifndef ITK_MANUAL_INSTANTIATION
00229 #include "itkHistogramToTextureFeaturesFilter.hxx"
00230 #endif
00231 
00232 #endif
00233