Skip to content

Commit dc42b84

Browse files
committed
COMP: Run time improvement
1 parent 13cb8d9 commit dc42b84

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

include/itkCoocurrenceTextureFeaturesImageFilter.hxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ CoocurrenceTextureFeaturesImageFilter< TInputImage, TOutputImage >
5656
// connected to the iterated pixel. Do not include the currentInNeighborhood pixel.
5757
unsigned int centerIndex = hood.GetCenterNeighborhoodIndex();
5858
OffsetVectorPointer offsets = OffsetVector::New();
59-
for( unsigned int d = 0; d < centerIndex; d++ )
59+
for( unsigned int d = 0; d < centerIndex; ++d )
6060
{
6161
OffsetType offset = hood.GetOffset( d );
6262
offsets->push_back( offset );
@@ -146,7 +146,7 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
146146
// Declaration of the variables useful to iterate over the all image region
147147
bool isInImage;
148148
IndexType firstIndex;
149-
for ( unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; i++ )
149+
for ( unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i )
150150
{
151151
firstIndex[i] = 0;
152152
}
@@ -228,8 +228,8 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
228228
}
229229

230230
// Increase the corresponding bin in the histogram
231-
totalNumberOfFreq++;
232-
hist[currentInNeighborhoodPixelIntensity][pixelIntensity]++;
231+
++totalNumberOfFreq;
232+
++hist[currentInNeighborhoodPixelIntensity][pixelIntensity];
233233
}
234234
}
235235
// Compute the run length features
@@ -337,9 +337,9 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
337337
}
338338
const double log2 = std::log(2.0);
339339

340-
for(unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++)
340+
for(unsigned int a = 0; a < m_NumberOfBinsPerAxis; ++a)
341341
{
342-
for(unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++)
342+
for(unsigned int b = 0; b < m_NumberOfBinsPerAxis; ++b)
343343
{
344344
float frequency = hist[a][b] / (float)totalNumberOfFreq;
345345
if ( Math::AlmostEquals( frequency, NumericTraits< float >::ZeroValue() ) )

include/itkRunLengthTextureFeaturesImageFilter.hxx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ RunLengthTextureFeaturesImageFilter< TInputImage, TOutputImage >
5252
// connected to the iterated pixel. Do not include the currentInNeighborhood pixel.
5353
unsigned int centerIndex = hood.GetCenterNeighborhoodIndex();
5454
OffsetVectorPointer offsets = OffsetVector::New();
55-
for( unsigned int d = 0; d < centerIndex; d++ )
55+
for( unsigned int d = 0; d < centerIndex; ++d )
5656
{
5757
OffsetType offset = hood.GetOffset( d );
5858
offsets->push_back( offset );
@@ -145,7 +145,7 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
145145
IndexType boolCurentInNeighborhoodIndex;
146146
typedef Image<bool, TInputImage::ImageDimension> BoolImageType;
147147
typename BoolImageType::Pointer alreadyVisitedImage = BoolImageType::New();
148-
for ( unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; i++ )
148+
for ( unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i )
149149
{
150150
boolSize[i] = this->m_NeighborhoodRadius[i]*2 + 1;
151151
boolStart[i] = 0;
@@ -206,9 +206,9 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
206206
continue;
207207
}
208208
// Initialisation of the histogram
209-
for(unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++)
209+
for(unsigned int a = 0; a < m_NumberOfBinsPerAxis; ++a)
210210
{
211-
for(unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++)
211+
for(unsigned int b = 0; b < m_NumberOfBinsPerAxis; ++b)
212212
{
213213
histogram[a][b] = 0;
214214
}
@@ -256,7 +256,7 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
256256
if ( pixelIntensity == currentInNeighborhoodPixelIntensity )
257257
{
258258
alreadyVisitedImage->SetPixel( boolCurentInNeighborhoodIndex + iteratedOffset, true );
259-
pixelDistance++;
259+
++pixelDistance;
260260
iteratedOffset += offset;
261261
insideNeighborhood = this->IsInsideNeighborhood(iteratedOffset);
262262
}
@@ -411,8 +411,8 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
411411

412412
if (offsetDistanceBin < static_cast< int >( m_NumberOfBinsPerAxis ))
413413
{
414-
totalNumberOfRuns++;
415-
histogram[currentInNeighborhoodPixelIntensity][offsetDistanceBin]++;
414+
++totalNumberOfRuns;
415+
++histogram[currentInNeighborhoodPixelIntensity][offsetDistanceBin];
416416
}
417417
}
418418

@@ -438,9 +438,9 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
438438
vnl_vector<double> runLengthNonuniformityVector(
439439
m_NumberOfBinsPerAxis, 0.0 );
440440

441-
for(unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++)
441+
for(unsigned int a = 0; a < m_NumberOfBinsPerAxis; ++a)
442442
{
443-
for(unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++)
443+
for(unsigned int b = 0; b < m_NumberOfBinsPerAxis; ++b)
444444
{
445445
OutputRealType frequency = histogram[a][b];
446446
if ( Math::ExactlyEquals(frequency, NumericTraits<OutputRealType>::ZeroValue()) )

0 commit comments

Comments
 (0)