ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkScalarImageToTextureFeaturesFilter.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 __itkScalarImageToTextureFeaturesFilter_h
00019 #define __itkScalarImageToTextureFeaturesFilter_h
00020 
00021 #include "itkDataObjectDecorator.h"
00022 
00023 #include "itkHistogramToTextureFeaturesFilter.h"
00024 #include "itkScalarImageToCooccurrenceMatrixFilter.h"
00025 
00026 namespace itk
00027 {
00028 namespace Statistics
00029 {
00104 template< class TImageType,
00105           class THistogramFrequencyContainer = DenseFrequencyContainer2 >
00106 class ITK_EXPORT ScalarImageToTextureFeaturesFilter:public ProcessObject
00107 {
00108 public:
00110   typedef ScalarImageToTextureFeaturesFilter Self;
00111   typedef ProcessObject                      Superclass;
00112   typedef SmartPointer< Self >               Pointer;
00113   typedef SmartPointer< const Self >         ConstPointer;
00114 
00116   itkTypeMacro(ScalarImageToTextureFeaturesFilter, ProcessObject);
00117 
00119   itkNewMacro(Self);
00120 
00121   typedef THistogramFrequencyContainer FrequencyContainerType;
00122   typedef TImageType                   ImageType;
00123   typedef typename ImageType::Pointer  ImagePointer;
00124 
00125   typedef typename ImageType::PixelType                PixelType;
00126   typedef typename ImageType::OffsetType               OffsetType;
00127   typedef VectorContainer< unsigned char, OffsetType > OffsetVector;
00128   typedef typename OffsetVector::Pointer               OffsetVectorPointer;
00129   typedef typename OffsetVector::ConstPointer          OffsetVectorConstPointer;
00130 
00131   typedef ScalarImageToCooccurrenceMatrixFilter<
00132     ImageType, FrequencyContainerType >               CooccurrenceMatrixFilterType;
00133 
00134   typedef typename CooccurrenceMatrixFilterType::HistogramType HistogramType;
00135   typedef HistogramToTextureFeaturesFilter< HistogramType >    TextureFeaturesFilterType;
00136 
00137   typedef short                                                  TextureFeatureName;
00138   typedef VectorContainer< unsigned char, TextureFeatureName >   FeatureNameVector;
00139 
00140   typedef typename FeatureNameVector::Pointer      FeatureNameVectorPointer;
00141   typedef typename FeatureNameVector::ConstPointer FeatureNameVectorConstPointer;
00142   typedef VectorContainer< unsigned char, double > FeatureValueVector;
00143   typedef typename FeatureValueVector::Pointer     FeatureValueVectorPointer;
00144 
00146   typedef DataObject::Pointer DataObjectPointer;
00147 
00149   typedef DataObjectDecorator< FeatureValueVector >
00150   FeatureValueVectorDataObjectType;
00151 
00152   const FeatureValueVectorDataObjectType * GetFeatureMeansOutput() const;
00153 
00154   const FeatureValueVectorDataObjectType * GetFeatureStandardDeviationsOutput() const;
00155 
00158   using Superclass::SetInput;
00159   void SetInput(const ImageType *);
00160 
00161   const ImageType * GetInput() const;
00162 
00164   itkGetConstReferenceObjectMacro(FeatureMeans, FeatureValueVector);
00165   itkGetConstReferenceObjectMacro(FeatureStandardDeviations, FeatureValueVector);
00167 
00169   itkSetConstObjectMacro(RequestedFeatures, FeatureNameVector);
00170   itkGetConstObjectMacro(RequestedFeatures, FeatureNameVector);
00172 
00175   itkSetConstObjectMacro(Offsets, OffsetVector);
00176   itkGetConstObjectMacro(Offsets, OffsetVector);
00178 
00181   void SetNumberOfBinsPerAxis(unsigned int);
00182 
00185   void SetPixelValueMinMax(PixelType min, PixelType max);
00187 
00190   void SetMaskImage(const ImageType *);
00191 
00192   const ImageType * GetMaskImage() const;
00193 
00196   void SetInsidePixelValue(PixelType InsidePixelValue);
00197 
00198   itkGetConstMacro(FastCalculations, bool);
00199   itkSetMacro(FastCalculations, bool);
00200   itkBooleanMacro(FastCalculations);
00201 protected:
00202   ScalarImageToTextureFeaturesFilter();
00203   virtual ~ScalarImageToTextureFeaturesFilter() {}
00204   void PrintSelf(std::ostream & os, Indent indent) const;
00205 
00206   void FastCompute();
00207 
00208   void FullCompute();
00209 
00211   virtual void GenerateData();
00212 
00214   typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
00215   using Superclass::MakeOutput;
00216   virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType);
00217 
00218 private:
00219   typename CooccurrenceMatrixFilterType::Pointer m_GLCMGenerator;
00220 
00221   typename TextureFeaturesFilterType::Pointer    m_GLCMCalculator;
00222 
00223   FeatureValueVectorPointer     m_FeatureMeans;
00224   FeatureValueVectorPointer     m_FeatureStandardDeviations;
00225   FeatureNameVectorConstPointer m_RequestedFeatures;
00226   OffsetVectorConstPointer      m_Offsets;
00227   bool                          m_FastCalculations;
00228 };
00229 } // end of namespace Statistics
00230 } // end of namespace itk
00231 
00232 #ifndef ITK_MANUAL_INSTANTIATION
00233 #include "itkScalarImageToTextureFeaturesFilter.hxx"
00234 #endif
00235 
00236 #endif
00237