Skip to content
Snippets Groups Projects
Commit 3311743f authored by Manuel Grizonnet's avatar Manuel Grizonnet
Browse files

ENH: ScalarImageToHigherOrderTexturesFilter has outputs

Number of outputs change years ago as the RunPercentage output wa removed in commit fc0becc1  (see orfeotoolbox/otb@fc0becc1).

Filter number of outputs updated and also the documentation.
parent aaf76e73
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,7 @@
namespace otb
{
/** \class ScalarImageToHigherOrderTexturesFilter
* \brief This class compute 11 local higher order statistics textures coefficients
* \brief This class compute 10 local higher order statistics textures coefficients
* based on the grey level run-length matrix
*
* This filter computes the following Haralick textures over a sliding window with
......@@ -175,9 +175,6 @@ public:
/** Get the Run Length Nonuniformity output image */
OutputImageType * GetRunLengthNonuniformityOutput();
/** Get the Run Percentage output image */
OutputImageType * GetRunPercentageOutput();
/** Get the Low Grey-Level Run Emphasis output image */
OutputImageType * GetLowGreyLevelRunEmphasisOutput();
......
......@@ -39,7 +39,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage>
m_SubsampleFactor(),
m_SubsampleOffset()
{
// There are 11 outputs corresponding to the 8 textures indices
// There are 10 outputs corresponding to the 8 textures indices
this->SetNumberOfRequiredOutputs(10);
// Create the 11 outputs
......@@ -53,7 +53,6 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage>
this->SetNthOutput(7, OutputImageType::New());
this->SetNthOutput(8, OutputImageType::New());
this->SetNthOutput(9, OutputImageType::New());
this->SetNthOutput(10, OutputImageType::New());
m_Radius.Fill(10);
......@@ -137,19 +136,6 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage>
return static_cast<OutputImageType *>(this->GetOutput(3));
}
template <class TInputImage, class TOutputImage>
typename ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage>
::OutputImageType *
ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage>
::GetRunPercentageOutput()
{
if (this->GetNumberOfOutputs() < 5)
{
return nullptr;
}
return static_cast<OutputImageType *>(this->GetOutput(4));
}
template <class TInputImage, class TOutputImage>
typename ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage>
::OutputImageType *
......@@ -261,7 +247,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage>
typename OutputImageType::PointType outOrigin;
this->GetInput()->TransformIndexToPhysicalPoint(inputRegion.GetIndex()+m_SubsampleOffset,outOrigin);
for (unsigned int i=0 ; i<this->GetNumberOfOutputs() ; i++)
for (unsigned int i=0 ; i < this->GetNumberOfOutputs() ; i++)
{
OutputImagePointerType outputPtr = this->GetOutput(i);
outputPtr->SetLargestPossibleRegion(outputRegion);
......@@ -270,6 +256,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage>
}
}
template <class TInputImage, class TOutputImage>
void
ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage>
......@@ -300,7 +287,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage>
outputIndex[1] = outputIndex[1] * m_SubsampleFactor[1] + m_SubsampleOffset[1] + inputLargest.GetIndex(1);
outputSize[0] = 1 + (outputSize[0] - 1) * m_SubsampleFactor[0];
outputSize[1] = 1 + (outputSize[1] - 1) * m_SubsampleFactor[1];
InputRegionType inputRequestedRegion(outputIndex,outputSize);
// Apply the radius
......@@ -333,7 +320,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage>
typedef typename itk::ImageRegionIterator<OutputImageType> IteratorType;
std::vector<IteratorType> outputImagesIterators;
for (unsigned int i = 0; i < 10; ++i)
for (unsigned int i = 0; i < this->GetNumberOfOutputs(); ++i)
{
outputImagesIterators.push_back( IteratorType(this->GetOutput(i), outputRegionForThread) );
outputImagesIterators[i].GoToBegin();
......@@ -402,28 +389,17 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage>
typename ScalarImageToRunLengthFeaturesFilterType::FeatureValueVector&
featuresMeans = *(runLengthFeatureCalculator->GetFeatureMeans().GetPointer());
// Fill outputs
outputImagesIterators[0].Set(featuresMeans[0]);
outputImagesIterators[1].Set(featuresMeans[1]);
outputImagesIterators[2].Set(featuresMeans[2]);
outputImagesIterators[3].Set(featuresMeans[3]);
outputImagesIterators[4].Set(featuresMeans[4]);
outputImagesIterators[5].Set(featuresMeans[5]);
outputImagesIterators[6].Set(featuresMeans[6]);
outputImagesIterators[7].Set(featuresMeans[7]);
outputImagesIterators[8].Set(featuresMeans[8]);
outputImagesIterators[9].Set(featuresMeans[9]);
// Fill output
for (unsigned int i = 0; i < this->GetNumberOfOutputs(); ++i)
{
// Fill output
outputImagesIterators[i].Set(featuresMeans[i]);
// Increment iterators
++outputImagesIterators[i];
}
// Update progress
progress.CompletedPixel();
// Increment iterators
for (unsigned int i = 0; i < 10; ++i)
{
++outputImagesIterators[i];
}
}
}
} // End namespace otb
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment