26 #include <itkMinimumMaximumImageCalculator.h>
31 template<
typename TPixel,
unsigned int VImageDimension>
35 typedef itk::Image<TPixel, VImageDimension>
ImageType;
36 typedef itk::Image<TPixel, VImageDimension> MaskType;
38 typedef itk::MinimumMaximumImageCalculator<ImageType> MinMaxComputerType;
39 typedef typename FilterType::RunLengthFeaturesFilterType TextureFilterType;
47 auto oldOffsets = filter->GetOffsets();
48 auto oldOffsetsIterator = oldOffsets->Begin();
49 while (oldOffsetsIterator != oldOffsets->End())
51 bool continueOuterLoop =
false;
52 typename FilterType::OffsetType
offset = oldOffsetsIterator->Value();
53 for (
unsigned int i = 0; i < VImageDimension; ++i)
57 continueOuterLoop =
true;
65 newOffset->push_back(offset);
70 if (continueOuterLoop)
72 newOffset->push_back(offset);
74 filter->SetOffsets(newOffset);
79 requestedFeatures->push_back(TextureFilterType::ShortRunEmphasis);
80 requestedFeatures->push_back(TextureFilterType::LongRunEmphasis);
81 requestedFeatures->push_back(TextureFilterType::GreyLevelNonuniformity);
82 requestedFeatures->push_back(TextureFilterType::RunLengthNonuniformity);
83 requestedFeatures->push_back(TextureFilterType::LowGreyLevelRunEmphasis);
84 requestedFeatures->push_back(TextureFilterType::HighGreyLevelRunEmphasis);
85 requestedFeatures->push_back(TextureFilterType::ShortRunLowGreyLevelEmphasis);
86 requestedFeatures->push_back(TextureFilterType::ShortRunHighGreyLevelEmphasis);
87 requestedFeatures->push_back(TextureFilterType::LongRunLowGreyLevelEmphasis);
88 requestedFeatures->push_back(TextureFilterType::LongRunHighGreyLevelEmphasis);
89 requestedFeatures->push_back(TextureFilterType::RunPercentage);
90 requestedFeatures->push_back(TextureFilterType::NumberOfRuns);
93 minMaxComputer->SetImage(itkImage);
94 minMaxComputer->Compute();
96 filter->SetInput(itkImage);
97 filter->SetMaskImage(maskImage);
98 filter->SetRequestedFeatures(requestedFeatures);
99 int rangeOfPixels = params.
m_Range;
100 if (rangeOfPixels < 2)
105 filter->SetPixelValueMinMax((TPixel)(-1024.5),(TPixel)(3096.5));
106 filter->SetNumberOfBinsPerAxis(3096.5+1024.5);
109 filter->SetPixelValueMinMax(minMaxComputer->GetMinimum(),minMaxComputer->GetMaximum());
110 filter->SetNumberOfBinsPerAxis(rangeOfPixels);
113 filter->SetDistanceValueMinMax(0,rangeOfPixels);
117 auto featureMeans = filter->GetFeatureMeans ();
118 auto featureStd = filter->GetFeatureStandardDeviations();
120 std::ostringstream ss;
122 std::string strRange = ss.str();
123 for (std::size_t i = 0; i < featureMeans->size(); ++i)
127 case TextureFilterType::ShortRunEmphasis :
128 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") ShortRunEmphasis Means",featureMeans->ElementAt(i)));
129 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") ShortRunEmphasis Std.",featureStd->ElementAt(i)));
131 case TextureFilterType::LongRunEmphasis :
132 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") LongRunEmphasis Means",featureMeans->ElementAt(i)));
133 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") LongRunEmphasis Std.",featureStd->ElementAt(i)));
135 case TextureFilterType::GreyLevelNonuniformity :
136 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") GreyLevelNonuniformity Means",featureMeans->ElementAt(i)));
137 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") GreyLevelNonuniformity Std.",featureStd->ElementAt(i)));
139 case TextureFilterType::RunLengthNonuniformity :
140 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") RunLengthNonuniformity Means",featureMeans->ElementAt(i)));
141 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") RunLengthNonuniformity Std.",featureStd->ElementAt(i)));
143 case TextureFilterType::LowGreyLevelRunEmphasis :
144 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") LowGreyLevelRunEmphasis Means",featureMeans->ElementAt(i)));
145 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") LowGreyLevelRunEmphasis Std.",featureStd->ElementAt(i)));
147 case TextureFilterType::HighGreyLevelRunEmphasis :
148 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") HighGreyLevelRunEmphasis Means",featureMeans->ElementAt(i)));
149 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") HighGreyLevelRunEmphasis Std.",featureStd->ElementAt(i)));
151 case TextureFilterType::ShortRunLowGreyLevelEmphasis :
152 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") ShortRunLowGreyLevelEmphasis Means",featureMeans->ElementAt(i)));
153 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") ShortRunLowGreyLevelEmphasis Std.",featureStd->ElementAt(i)));
155 case TextureFilterType::ShortRunHighGreyLevelEmphasis :
156 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") ShortRunHighGreyLevelEmphasis Means",featureMeans->ElementAt(i)));
157 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") ShortRunHighGreyLevelEmphasis Std.",featureStd->ElementAt(i)));
159 case TextureFilterType::LongRunLowGreyLevelEmphasis :
160 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") LongRunLowGreyLevelEmphasis Means",featureMeans->ElementAt(i)));
161 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") LongRunLowGreyLevelEmphasis Std.",featureStd->ElementAt(i)));
163 case TextureFilterType::LongRunHighGreyLevelEmphasis :
164 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") LongRunHighGreyLevelEmphasis Means",featureMeans->ElementAt(i)));
165 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") LongRunHighGreyLevelEmphasis Std.",featureStd->ElementAt(i)));
167 case TextureFilterType::RunPercentage :
168 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") RunPercentage Means",featureMeans->ElementAt(i)));
169 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") RunPercentage Std.",featureStd->ElementAt(i)));
171 case TextureFilterType::NumberOfRuns :
172 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") NumberOfRuns Means",featureMeans->ElementAt(i)));
173 featureList.push_back(std::make_pair(
"RunLength. ("+ strRange+
") NumberOfRuns Std.",featureStd->ElementAt(i)));
182 m_Range(1.0), m_UseCtRange(false), m_Direction(0)
203 featureList.push_back(
"RunLength. ShortRunEmphasis Means");
204 featureList.push_back(
"RunLength. ShortRunEmphasis Std.");
205 featureList.push_back(
"RunLength. LongRunEmphasis Means");
206 featureList.push_back(
"RunLength. LongRunEmphasis Std.");
207 featureList.push_back(
"RunLength. GreyLevelNonuniformity Means");
208 featureList.push_back(
"RunLength. GreyLevelNonuniformity Std.");
209 featureList.push_back(
"RunLength. RunLengthNonuniformity Means");
210 featureList.push_back(
"RunLength. RunLengthNonuniformity Std.");
211 featureList.push_back(
"RunLength. LowGreyLevelRunEmphasis Means");
212 featureList.push_back(
"RunLength. LowGreyLevelRunEmphasis Std.");
213 featureList.push_back(
"RunLength. HighGreyLevelRunEmphasis Means");
214 featureList.push_back(
"RunLength. HighGreyLevelRunEmphasis Std.");
215 featureList.push_back(
"RunLength. ShortRunLowGreyLevelEmphasis Means");
216 featureList.push_back(
"RunLength. ShortRunLowGreyLevelEmphasis Std.");
217 featureList.push_back(
"RunLength. ShortRunHighGreyLevelEmphasis Means");
218 featureList.push_back(
"RunLength. ShortRunHighGreyLevelEmphasis Std.");
219 featureList.push_back(
"RunLength. LongRunHighGreyLevelEmphasis Means");
220 featureList.push_back(
"RunLength. LongRunHighGreyLevelEmphasis Std.");
#define AccessByItk_3(mitkImage, itkImageTypeFunction, arg1, arg2, arg3)
itk::SmartPointer< Self > Pointer
std::vector< std::string > FeatureNameListType
itk::Image< unsigned char, 3 > ImageType
void CalculateGrayLevelRunLengthFeatures(itk::Image< TPixel, VImageDimension > *itkImage, mitk::Image::Pointer mask, mitk::GIFGrayLevelRunLength::FeatureListType &featureList, mitk::GIFGrayLevelRunLength::ParameterStruct params)
std::vector< std::pair< std::string, double > > FeatureListType
This class computes run length descriptions from an image.
virtual FeatureNameListType GetFeatureNames() override
Returns a list of the names of all features that are calculated from 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 FeatureListType CalculateFeatures(const Image::Pointer &image, const Image::Pointer &feature) override
Calculates the Cooccurence-Matrix based features for this class.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.