10 #include <itkMinimumMaximumImageCalculator.h>
15 template<
typename TPixel,
unsigned int VImageDimension>
19 typedef itk::Image<TPixel, VImageDimension>
ImageType;
20 typedef itk::Image<TPixel, VImageDimension> MaskType;
22 typedef itk::MinimumMaximumImageCalculator<ImageType> MinMaxComputerType;
23 typedef typename FilterType::TextureFeaturesFilterType TextureFilterType;
31 auto oldOffsets = filter->GetOffsets();
32 auto oldOffsetsIterator = oldOffsets->Begin();
33 while(oldOffsetsIterator != oldOffsets->End())
35 bool continueOuterLoop =
false;
36 typename FilterType::OffsetType
offset = oldOffsetsIterator->Value();
37 for (
unsigned int i = 0; i < VImageDimension; ++i)
39 offset[i] *= config.
range;
40 if (config.
direction == i + 2 && offset[i] != 0)
42 continueOuterLoop =
true;
50 newOffset->push_back(offset);
56 if (continueOuterLoop)
58 newOffset->push_back(offset);
61 filter->SetOffsets(newOffset);
65 requestedFeatures->push_back(TextureFilterType::Energy);
66 requestedFeatures->push_back(TextureFilterType::Entropy);
67 requestedFeatures->push_back(TextureFilterType::Correlation);
68 requestedFeatures->push_back(TextureFilterType::InverseDifferenceMoment);
69 requestedFeatures->push_back(TextureFilterType::Inertia);
70 requestedFeatures->push_back(TextureFilterType::ClusterShade);
71 requestedFeatures->push_back(TextureFilterType::ClusterProminence);
72 requestedFeatures->push_back(TextureFilterType::HaralickCorrelation);
73 requestedFeatures->push_back(TextureFilterType::Autocorrelation);
74 requestedFeatures->push_back(TextureFilterType::Contrast);
75 requestedFeatures->push_back(TextureFilterType::Dissimilarity);
76 requestedFeatures->push_back(TextureFilterType::MaximumProbability);
77 requestedFeatures->push_back(TextureFilterType::InverseVariance);
78 requestedFeatures->push_back(TextureFilterType::Homogeneity1);
79 requestedFeatures->push_back(TextureFilterType::ClusterTendency);
80 requestedFeatures->push_back(TextureFilterType::Variance);
81 requestedFeatures->push_back(TextureFilterType::SumAverage);
82 requestedFeatures->push_back(TextureFilterType::SumEntropy);
83 requestedFeatures->push_back(TextureFilterType::SumVariance);
84 requestedFeatures->push_back(TextureFilterType::DifferenceAverage);
85 requestedFeatures->push_back(TextureFilterType::DifferenceEntropy);
86 requestedFeatures->push_back(TextureFilterType::DifferenceVariance);
87 requestedFeatures->push_back(TextureFilterType::InverseDifferenceMomentNormalized);
88 requestedFeatures->push_back(TextureFilterType::InverseDifferenceNormalized);
89 requestedFeatures->push_back(TextureFilterType::InverseDifference);
92 minMaxComputer->SetImage(itkImage);
93 minMaxComputer->Compute();
95 filter->SetInput(itkImage);
96 filter->SetMaskImage(maskImage);
97 filter->SetRequestedFeatures(requestedFeatures);
98 filter->SetPixelValueMinMax(minMaxComputer->GetMinimum()-0.5,minMaxComputer->GetMaximum()+0.5);
103 auto featureMeans = filter->GetFeatureMeans ();
104 auto featureStd = filter->GetFeatureStandardDeviations();
106 std::ostringstream ss;
108 std::string strRange = ss.str();
109 for (std::size_t i = 0; i < featureMeans->size(); ++i)
113 case TextureFilterType::Energy :
114 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Energy Means",featureMeans->ElementAt(i)));
115 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Energy Std.",featureStd->ElementAt(i)));
117 case TextureFilterType::Entropy :
118 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Entropy Means",featureMeans->ElementAt(i)));
119 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Entropy Std.",featureStd->ElementAt(i)));
121 case TextureFilterType::Correlation :
122 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Correlation Means",featureMeans->ElementAt(i)));
123 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Correlation Std.",featureStd->ElementAt(i)));
125 case TextureFilterType::InverseDifferenceMoment :
126 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") InverseDifferenceMoment Means",featureMeans->ElementAt(i)));
127 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") InverseDifferenceMoment Std.",featureStd->ElementAt(i)));
129 case TextureFilterType::Inertia :
130 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Inertia Means",featureMeans->ElementAt(i)));
131 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Inertia Std.",featureStd->ElementAt(i)));
133 case TextureFilterType::ClusterShade :
134 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") ClusterShade Means",featureMeans->ElementAt(i)));
135 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") ClusterShade Std.",featureStd->ElementAt(i)));
137 case TextureFilterType::ClusterProminence :
138 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") ClusterProminence Means",featureMeans->ElementAt(i)));
139 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") ClusterProminence Std.",featureStd->ElementAt(i)));
141 case TextureFilterType::HaralickCorrelation :
142 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") HaralickCorrelation Means",featureMeans->ElementAt(i)));
143 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") HaralickCorrelation Std.",featureStd->ElementAt(i)));
145 case TextureFilterType::Autocorrelation :
146 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Autocorrelation Means",featureMeans->ElementAt(i)));
147 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Autocorrelation Std.",featureStd->ElementAt(i)));
149 case TextureFilterType::Contrast :
150 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Contrast Means",featureMeans->ElementAt(i)));
151 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Contrast Std.",featureStd->ElementAt(i)));
153 case TextureFilterType::Dissimilarity :
154 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Dissimilarity Means",featureMeans->ElementAt(i)));
155 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Dissimilarity Std.",featureStd->ElementAt(i)));
157 case TextureFilterType::MaximumProbability :
158 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") MaximumProbability Means",featureMeans->ElementAt(i)));
159 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") MaximumProbability Std.",featureStd->ElementAt(i)));
161 case TextureFilterType::InverseVariance :
162 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") InverseVariance Means",featureMeans->ElementAt(i)));
163 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") InverseVariance Std.",featureStd->ElementAt(i)));
165 case TextureFilterType::Homogeneity1 :
166 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Homogeneity1 Means",featureMeans->ElementAt(i)));
167 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Homogeneity1 Std.",featureStd->ElementAt(i)));
169 case TextureFilterType::ClusterTendency :
170 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") ClusterTendency Means",featureMeans->ElementAt(i)));
171 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") ClusterTendency Std.",featureStd->ElementAt(i)));
173 case TextureFilterType::Variance :
174 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Variance Means",featureMeans->ElementAt(i)));
175 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") Variance Std.",featureStd->ElementAt(i)));
177 case TextureFilterType::SumAverage :
178 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") SumAverage Means",featureMeans->ElementAt(i)));
179 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") SumAverage Std.",featureStd->ElementAt(i)));
181 case TextureFilterType::SumEntropy :
182 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") SumEntropy Means",featureMeans->ElementAt(i)));
183 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") SumEntropy Std.",featureStd->ElementAt(i)));
185 case TextureFilterType::SumVariance :
186 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") SumVariance Means",featureMeans->ElementAt(i)));
187 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") SumVariance Std.",featureStd->ElementAt(i)));
189 case TextureFilterType::DifferenceAverage :
190 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") DifferenceAverage Means",featureMeans->ElementAt(i)));
191 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") DifferenceAverage Std.",featureStd->ElementAt(i)));
193 case TextureFilterType::DifferenceEntropy :
194 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") DifferenceEntropy Means",featureMeans->ElementAt(i)));
195 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") DifferenceEntropy Std.",featureStd->ElementAt(i)));
197 case TextureFilterType::DifferenceVariance :
198 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") DifferenceVariance Means",featureMeans->ElementAt(i)));
199 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") DifferenceVariance Std.",featureStd->ElementAt(i)));
201 case TextureFilterType::InverseDifferenceMomentNormalized :
202 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") InverseDifferenceMomentNormalized Means",featureMeans->ElementAt(i)));
203 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") InverseDifferenceMomentNormalized Std.",featureStd->ElementAt(i)));
205 case TextureFilterType::InverseDifferenceNormalized :
206 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") InverseDifferenceNormalized Means",featureMeans->ElementAt(i)));
207 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") InverseDifferenceNormalized Std.",featureStd->ElementAt(i)));
209 case TextureFilterType::InverseDifference :
210 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") InverseDifference Means",featureMeans->ElementAt(i)));
211 featureList.push_back(std::make_pair(
"co-occ. ("+ strRange+
") InverseDifference Std.",featureStd->ElementAt(i)));
220 m_Range(1.0), m_Direction(0)
230 config.
range = m_Range;
240 featureList.push_back(
"co-occ. Energy Means");
241 featureList.push_back(
"co-occ. Energy Std.");
242 featureList.push_back(
"co-occ. Entropy Means");
243 featureList.push_back(
"co-occ. Entropy Std.");
244 featureList.push_back(
"co-occ. Correlation Means");
245 featureList.push_back(
"co-occ. Correlation Std.");
246 featureList.push_back(
"co-occ. InverseDifferenceMoment Means");
247 featureList.push_back(
"co-occ. InverseDifferenceMoment Std.");
248 featureList.push_back(
"co-occ. Inertia Means");
249 featureList.push_back(
"co-occ. Inertia Std.");
250 featureList.push_back(
"co-occ. ClusterShade Means");
251 featureList.push_back(
"co-occ. ClusterShade Std.");
252 featureList.push_back(
"co-occ. ClusterProminence Means");
253 featureList.push_back(
"co-occ. ClusterProminence Std.");
254 featureList.push_back(
"co-occ. HaralickCorrelation Means");
255 featureList.push_back(
"co-occ. HaralickCorrelation Std.");
256 featureList.push_back(
"co-occ. Autocorrelation Means");
257 featureList.push_back(
"co-occ. Autocorrelation Std.");
258 featureList.push_back(
"co-occ. Contrast Means");
259 featureList.push_back(
"co-occ. Contrast Std.");
260 featureList.push_back(
"co-occ. Dissimilarity Means");
261 featureList.push_back(
"co-occ. Dissimilarity Std.");
262 featureList.push_back(
"co-occ. MaximumProbability Means");
263 featureList.push_back(
"co-occ. MaximumProbability Std.");
264 featureList.push_back(
"co-occ. InverseVariance Means");
265 featureList.push_back(
"co-occ. InverseVariance Std.");
266 featureList.push_back(
"co-occ. Homogeneity1 Means");
267 featureList.push_back(
"co-occ. Homogeneity1 Std.");
268 featureList.push_back(
"co-occ. ClusterTendency Means");
269 featureList.push_back(
"co-occ. ClusterTendency Std.");
270 featureList.push_back(
"co-occ. Variance Means");
271 featureList.push_back(
"co-occ. Variance Std.");
272 featureList.push_back(
"co-occ. SumAverage Means");
273 featureList.push_back(
"co-occ. SumAverage Std.");
274 featureList.push_back(
"co-occ. SumEntropy Means");
275 featureList.push_back(
"co-occ. SumEntropy Std.");
276 featureList.push_back(
"co-occ. SumVariance Means");
277 featureList.push_back(
"co-occ. SumVariance Std.");
278 featureList.push_back(
"co-occ. DifferenceAverage Means");
279 featureList.push_back(
"co-occ. DifferenceAverage Std.");
280 featureList.push_back(
"co-occ. DifferenceEntropy Means");
281 featureList.push_back(
"co-occ. DifferenceEntropy Std.");
282 featureList.push_back(
"co-occ. DifferenceVariance Means");
283 featureList.push_back(
"co-occ. DifferenceVariance Std.");
284 featureList.push_back(
"co-occ. InverseDifferenceMomentNormalized Means");
285 featureList.push_back(
"co-occ. InverseDifferenceMomentNormalized Std.");
286 featureList.push_back(
"co-occ. InverseDifferenceNormalized Means");
287 featureList.push_back(
"co-occ. InverseDifferenceNormalized Std.");
288 featureList.push_back(
"co-occ. InverseDifference Means");
289 featureList.push_back(
"co-occ. InverseDifference Std.");
#define AccessByItk_3(mitkImage, itkImageTypeFunction, arg1, arg2, arg3)
This class computes texture descriptions from an image.
itk::SmartPointer< Self > Pointer
void CalculateCoocurenceFeatures(itk::Image< TPixel, VImageDimension > *itkImage, mitk::Image::Pointer mask, mitk::GIFCooccurenceMatrix::FeatureListType &featureList, mitk::GIFCooccurenceMatrix::GIFCooccurenceMatrixConfiguration config)
std::vector< std::string > FeatureNameListType
itk::Image< unsigned char, 3 > ImageType
std::vector< std::pair< std::string, double > > FeatureListType
virtual FeatureListType CalculateFeatures(const Image::Pointer &image, const Image::Pointer &feature) override
Calculates the Cooccurence-Matrix based features for this class.
void MITKCORE_EXPORT CastToItkImage(const mitk::Image *mitkImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
Cast an mitk::Image to an itk::Image with a specific type.
virtual FeatureNameListType GetFeatureNames() override
Returns a list of the names of all features that are calculated from this class.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.