ITK
4.0.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 { 00105 template< class TImageType, 00106 class THistogramFrequencyContainer = DenseFrequencyContainer2 > 00107 class ITK_EXPORT ScalarImageToTextureFeaturesFilter:public ProcessObject 00108 { 00109 public: 00111 typedef ScalarImageToTextureFeaturesFilter Self; 00112 typedef ProcessObject Superclass; 00113 typedef SmartPointer< Self > Pointer; 00114 typedef SmartPointer< const Self > ConstPointer; 00115 00117 itkTypeMacro(ScalarImageToTextureFeaturesFilter, ProcessObject); 00118 00120 itkNewMacro(Self); 00121 00122 typedef THistogramFrequencyContainer FrequencyContainerType; 00123 typedef TImageType ImageType; 00124 typedef typename ImageType::Pointer ImagePointer; 00125 00126 typedef typename ImageType::PixelType PixelType; 00127 typedef typename ImageType::OffsetType OffsetType; 00128 typedef VectorContainer< unsigned char, OffsetType > OffsetVector; 00129 typedef typename OffsetVector::Pointer OffsetVectorPointer; 00130 typedef typename OffsetVector::ConstPointer OffsetVectorConstPointer; 00131 00132 typedef ScalarImageToCooccurrenceMatrixFilter< 00133 ImageType, FrequencyContainerType > CooccurrenceMatrixFilterType; 00134 00135 typedef typename CooccurrenceMatrixFilterType::HistogramType 00136 HistogramType; 00137 00138 typedef HistogramToTextureFeaturesFilter< HistogramType > 00139 TextureFeaturesFilterType; 00140 00141 typedef short TextureFeatureName; 00142 typedef VectorContainer< unsigned char, TextureFeatureName > FeatureNameVector; 00143 00144 typedef typename FeatureNameVector::Pointer FeatureNameVectorPointer; 00145 typedef typename FeatureNameVector::ConstPointer FeatureNameVectorConstPointer; 00146 typedef VectorContainer< unsigned char, double > FeatureValueVector; 00147 typedef typename FeatureValueVector::Pointer FeatureValueVectorPointer; 00148 00150 typedef DataObject::Pointer DataObjectPointer; 00151 00153 typedef DataObjectDecorator< FeatureValueVector > 00154 FeatureValueVectorDataObjectType; 00155 00156 const FeatureValueVectorDataObjectType * GetFeatureMeansOutput() const; 00157 00158 const FeatureValueVectorDataObjectType * GetFeatureStandardDeviationsOutput() const; 00159 00162 using Superclass::SetInput; 00163 void SetInput(const ImageType *); 00164 00165 const ImageType * GetInput() const; 00166 00168 itkGetConstReferenceObjectMacro(FeatureMeans, FeatureValueVector); 00169 itkGetConstReferenceObjectMacro(FeatureStandardDeviations, FeatureValueVector); 00171 00173 itkSetConstObjectMacro(RequestedFeatures, FeatureNameVector); 00174 itkGetConstObjectMacro(RequestedFeatures, FeatureNameVector); 00176 00179 itkSetConstObjectMacro(Offsets, OffsetVector); 00180 itkGetConstObjectMacro(Offsets, OffsetVector); 00182 00185 void SetNumberOfBinsPerAxis(unsigned int); 00186 00189 void SetPixelValueMinMax(PixelType min, PixelType max); 00191 00194 void SetMaskImage(const ImageType *); 00195 00196 const ImageType * GetMaskImage() const; 00197 00200 void SetInsidePixelValue(PixelType InsidePixelValue); 00201 00202 itkGetConstMacro(FastCalculations, bool); 00203 itkSetMacro(FastCalculations, bool); 00204 itkBooleanMacro(FastCalculations); 00205 protected: 00206 ScalarImageToTextureFeaturesFilter(); 00207 virtual ~ScalarImageToTextureFeaturesFilter() {} 00208 void PrintSelf(std::ostream & os, Indent indent) const; 00209 00210 void FastCompute(); 00211 00212 void FullCompute(); 00213 00215 virtual void GenerateData(); 00216 00218 typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; 00219 using Superclass::MakeOutput; 00220 virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType); 00221 00222 private: 00223 typename CooccurrenceMatrixFilterType::Pointer m_GLCMGenerator; 00224 00225 FeatureValueVectorPointer m_FeatureMeans; 00226 FeatureValueVectorPointer m_FeatureStandardDeviations; 00227 FeatureNameVectorConstPointer m_RequestedFeatures; 00228 OffsetVectorConstPointer m_Offsets; 00229 bool m_FastCalculations; 00230 }; 00231 } // end of namespace Statistics 00232 } // end of namespace itk 00233 00234 #ifndef ITK_MANUAL_INSTANTIATION 00235 #include "itkScalarImageToTextureFeaturesFilter.hxx" 00236 #endif 00237 00238 #endif 00239