ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
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 00135 HistogramType; 00136 00137 typedef HistogramToTextureFeaturesFilter< HistogramType > 00138 TextureFeaturesFilterType; 00139 00140 typedef short TextureFeatureName; 00141 typedef VectorContainer< unsigned char, TextureFeatureName > FeatureNameVector; 00142 00143 typedef typename FeatureNameVector::Pointer FeatureNameVectorPointer; 00144 typedef typename FeatureNameVector::ConstPointer FeatureNameVectorConstPointer; 00145 typedef VectorContainer< unsigned char, double > FeatureValueVector; 00146 typedef typename FeatureValueVector::Pointer FeatureValueVectorPointer; 00147 00149 typedef DataObject::Pointer DataObjectPointer; 00150 00152 typedef DataObjectDecorator< FeatureValueVector > 00153 FeatureValueVectorDataObjectType; 00154 00155 const FeatureValueVectorDataObjectType * GetFeatureMeansOutput() const; 00156 00157 const FeatureValueVectorDataObjectType * GetFeatureStandardDeviationsOutput() const; 00158 00161 using Superclass::SetInput; 00162 void SetInput(const ImageType *); 00163 00164 const ImageType * GetInput() const; 00165 00167 itkGetConstReferenceObjectMacro(FeatureMeans, FeatureValueVector); 00168 itkGetConstReferenceObjectMacro(FeatureStandardDeviations, FeatureValueVector); 00170 00172 itkSetConstObjectMacro(RequestedFeatures, FeatureNameVector); 00173 itkGetConstObjectMacro(RequestedFeatures, FeatureNameVector); 00175 00178 itkSetConstObjectMacro(Offsets, OffsetVector); 00179 itkGetConstObjectMacro(Offsets, OffsetVector); 00181 00184 void SetNumberOfBinsPerAxis(unsigned int); 00185 00188 void SetPixelValueMinMax(PixelType min, PixelType max); 00190 00193 void SetMaskImage(const ImageType *); 00194 00195 const ImageType * GetMaskImage() const; 00196 00199 void SetInsidePixelValue(PixelType InsidePixelValue); 00200 00201 itkGetConstMacro(FastCalculations, bool); 00202 itkSetMacro(FastCalculations, bool); 00203 itkBooleanMacro(FastCalculations); 00204 protected: 00205 ScalarImageToTextureFeaturesFilter(); 00206 virtual ~ScalarImageToTextureFeaturesFilter() {} 00207 void PrintSelf(std::ostream & os, Indent indent) const; 00208 00209 void FastCompute(); 00210 00211 void FullCompute(); 00212 00214 virtual void GenerateData(); 00215 00217 typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; 00218 using Superclass::MakeOutput; 00219 virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType); 00220 00221 private: 00222 typename CooccurrenceMatrixFilterType::Pointer m_GLCMGenerator; 00223 00224 FeatureValueVectorPointer m_FeatureMeans; 00225 FeatureValueVectorPointer m_FeatureStandardDeviations; 00226 FeatureNameVectorConstPointer m_RequestedFeatures; 00227 OffsetVectorConstPointer m_Offsets; 00228 bool m_FastCalculations; 00229 }; 00230 } // end of namespace Statistics 00231 } // end of namespace itk 00232 00233 #ifndef ITK_MANUAL_INSTANTIATION 00234 #include "itkScalarImageToTextureFeaturesFilter.hxx" 00235 #endif 00236 00237 #endif 00238