Skip to content

Commit 2b4544f

Browse files
authored
Merge pull request #27 from thewtex/memory-access
Memory access
2 parents 882b6dd + baeb363 commit 2b4544f

5 files changed

+65
-50
lines changed

CTestConfig.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set(CTEST_PROJECT_NAME "ITK")
2+
set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC")
3+
4+
set(CTEST_DROP_METHOD "http")
5+
set(CTEST_DROP_SITE "open.cdash.org")
6+
set(CTEST_DROP_LOCATION "/submit.php?project=Insight")
7+
set(CTEST_DROP_SITE_CDASH TRUE)

include/itkCoocurrenceTextureFeaturesImageFilter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter:public ImageToIm
231231
virtual void GenerateOutputInformation() ITK_OVERRIDE;
232232

233233
private:
234-
typename DigitalisedImageType::Pointer m_DigitalisedInputImageg;
234+
typename DigitalisedImageType::Pointer m_DigitalizedInputImage;
235235

236236
NeighborhoodRadiusType m_NeighborhoodRadius;
237237
OffsetVectorPointer m_Offsets;

include/itkCoocurrenceTextureFeaturesImageFilter.hxx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ CoocurrenceTextureFeaturesImageFilter< TInputImage, TOutputImage >
5353
hood.SetRadius( 1 );
5454

5555
// Select all "previous" neighbors that are face+edge+vertex
56-
// connected to the iterated pixel. Do not include the curentInNeighborhood pixel.
56+
// connected to the iterated pixel. Do not include the currentInNeighborhood pixel.
5757
unsigned int centerIndex = hood.GetCenterNeighborhoodIndex();
5858
OffsetVectorPointer offsets = OffsetVector::New();
5959
for( unsigned int d = 0; d < centerIndex; d++ )
@@ -108,7 +108,7 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
108108
functorF->SetNumberOfThreads(this->GetNumberOfThreads());
109109

110110
functorF->Update();
111-
m_DigitalisedInputImageg = functorF->GetOutput();
111+
m_DigitalizedInputImage = functorF->GetOutput();
112112
}
113113

114114
template<typename TInputImage, typename TOutputImage>
@@ -117,7 +117,7 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
117117
::AfterThreadedGenerateData()
118118
{
119119
// Free internal image
120-
this->m_DigitalisedInputImageg = ITK_NULLPTR;
120+
this->m_DigitalizedInputImage = ITK_NULLPTR;
121121
}
122122

123123

@@ -140,7 +140,7 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
140140
// Separation of the non-boundary region that will be processed in a different way
141141
NeighborhoodAlgorithm::ImageBoundaryFacesCalculator< TInputImage > boundaryFacesCalculator;
142142
typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator< InputImageType >::FaceListType
143-
faceList = boundaryFacesCalculator( this->m_DigitalisedInputImageg, outputRegionForThread, m_NeighborhoodRadius );
143+
faceList = boundaryFacesCalculator( this->m_DigitalizedInputImage, outputRegionForThread, m_NeighborhoodRadius );
144144
typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator< InputImageType >::FaceListType::iterator fit = faceList.begin();
145145

146146
// Declaration of the variables useful to iterate over the all image region
@@ -161,7 +161,7 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
161161
vnl_matrix<unsigned int> hist(m_NumberOfBinsPerAxis, m_NumberOfBinsPerAxis);
162162

163163
// Declaration of the variables useful to iterate over the all neighborhood region
164-
PixelType curentInNeighborhoodPixelIntensity;
164+
PixelType currentInNeighborhoodPixelIntensity;
165165

166166
// Declaration of the variables useful to iterate over the run
167167
PixelType pixelIntensity( NumericTraits<PixelType>::ZeroValue() );
@@ -170,7 +170,7 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
170170
/// ***** Non-boundary Region *****
171171
for (; fit != faceList.end(); ++fit )
172172
{
173-
NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitalisedInputImageg, *fit );
173+
NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitalizedInputImage, *fit );
174174
typedef itk::ImageRegionIterator< OutputImageType> IteratorType;
175175
IteratorType outputIt( outputPtr, *fit );
176176

@@ -196,14 +196,14 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
196196
// Iteration over the all neighborhood region
197197
for(NeighborIndexType nb = 0; nb<inputNIt.Size(); ++nb)
198198
{
199-
// Test if the curent voxel is in the mask and is the range of the image intensity specified
200-
curentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb);
201-
if( curentInNeighborhoodPixelIntensity < 0 )
199+
// Test if the current voxel is in the mask and is the range of the image intensity specified
200+
currentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb);
201+
if( currentInNeighborhoodPixelIntensity < 0 )
202202
{
203203
continue;
204204
}
205205

206-
// Test if the curent offset is still pointing to a voxel inside th neighborhood
206+
// Test if the current offset is still pointing to a voxel inside th neighborhood
207207
tempOffset = inputNIt.GetOffset(nb) + offset;
208208
if(!(this->IsInsideNeighborhood(tempOffset)))
209209
{
@@ -229,7 +229,7 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
229229

230230
// Increase the corresponding bin in the histogram
231231
totalNumberOfFreq++;
232-
hist[curentInNeighborhoodPixelIntensity][pixelIntensity]++;
232+
hist[currentInNeighborhoodPixelIntensity][pixelIntensity]++;
233233
}
234234
}
235235
// Compute the run length features
@@ -456,7 +456,7 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage>
456456

457457
Superclass::PrintSelf( os, indent );
458458

459-
itkPrintSelfObjectMacro( DigitalisedInputImageg );
459+
itkPrintSelfObjectMacro( DigitalizedInputImage );
460460

461461
os << indent << "NeighborhoodRadius"
462462
<< static_cast< typename NumericTraits<

include/itkRunLengthTextureFeaturesImageFilter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter:public ImageToImag
230230
void NormalizeOffsetDirection(OffsetType &offset);
231231
bool IsInsideNeighborhood(const OffsetType &iteratedOffset);
232232
void IncreaseHistogram(unsigned int **hist, unsigned int &totalNumberOfRuns,
233-
const PixelType &curentInNeighborhoodPixelIntensity,
233+
const PixelType &currentInNeighborhoodPixelIntensity,
234234
const OffsetType &offset, const unsigned int &pixelDistance);
235235
void ComputeFeatures( unsigned int **hist, const unsigned int &totalNumberOfRuns,
236236
typename TOutputImage::PixelType &outputPixel);
@@ -243,7 +243,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter:public ImageToImag
243243
virtual void UpdateOutputInformation() ITK_OVERRIDE;
244244

245245
private:
246-
typename InputImageType::Pointer m_DigitalisedInputImageg;
246+
typename InputImageType::Pointer m_DigitalizedInputImage;
247247
NeighborhoodRadiusType m_NeighborhoodRadius;
248248
OffsetVectorPointer m_Offsets;
249249
unsigned int m_NumberOfBinsPerAxis;

include/itkRunLengthTextureFeaturesImageFilter.hxx

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ RunLengthTextureFeaturesImageFilter< TInputImage, TOutputImage >
3434
m_Max( NumericTraits<PixelType>::max() ),
3535
m_MinDistance( NumericTraits<RealType>::ZeroValue() ),
3636
m_MaxDistance( NumericTraits<RealType>::max() ),
37-
m_InsidePixelValue( NumericTraits<PixelType>::OneValue() ){
37+
m_InsidePixelValue( NumericTraits<PixelType>::OneValue() ),
38+
m_Spacing( 1.0 )
39+
{
3840
this->SetNumberOfRequiredInputs( 1 );
3941
this->SetNumberOfRequiredOutputs( 1 );
4042

@@ -47,7 +49,7 @@ RunLengthTextureFeaturesImageFilter< TInputImage, TOutputImage >
4749
hood.SetRadius( 1 );
4850

4951
// Select all "previous" neighbors that are face+edge+vertex
50-
// connected to the iterated pixel. Do not include the curentInNeighborhood pixel.
52+
// connected to the iterated pixel. Do not include the currentInNeighborhood pixel.
5153
unsigned int centerIndex = hood.GetCenterNeighborhoodIndex();
5254
OffsetVectorPointer offsets = OffsetVector::New();
5355
for( unsigned int d = 0; d < centerIndex; d++ )
@@ -78,12 +80,12 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
7880
{
7981
typename TInputImage::Pointer maskPointer = TInputImage::New();
8082
maskPointer = const_cast<TInputImage *>(this->GetMaskImage());
81-
this->m_DigitalisedInputImageg = InputImageType::New();
82-
this->m_DigitalisedInputImageg->SetRegions(this->GetInput()->GetRequestedRegion());
83-
this->m_DigitalisedInputImageg->CopyInformation(this->GetInput());
84-
this->m_DigitalisedInputImageg->Allocate();
83+
this->m_DigitalizedInputImage = InputImageType::New();
84+
this->m_DigitalizedInputImage->SetRegions(this->GetInput()->GetRequestedRegion());
85+
this->m_DigitalizedInputImage->CopyInformation(this->GetInput());
86+
this->m_DigitalizedInputImage->Allocate();
8587
typedef itk::ImageRegionIterator< InputImageType> IteratorType;
86-
IteratorType digitIt( this->m_DigitalisedInputImageg, this->m_DigitalisedInputImageg->GetLargestPossibleRegion() );
88+
IteratorType digitIt( this->m_DigitalizedInputImage, this->m_DigitalizedInputImage->GetLargestPossibleRegion() );
8789
typedef itk::ImageRegionConstIterator< InputImageType> ConstIteratorType;
8890
ConstIteratorType inputIt( this->GetInput(), this->GetInput()->GetLargestPossibleRegion() );
8991
unsigned int binNumber;
@@ -151,14 +153,14 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
151153
}
152154
boolRegion.SetIndex(boolStart);
153155
boolRegion.SetSize(boolSize);
154-
alreadyVisitedImage->CopyInformation( this->m_DigitalisedInputImageg );
156+
alreadyVisitedImage->CopyInformation( this->m_DigitalizedInputImage );
155157
alreadyVisitedImage->SetRegions( boolRegion );
156158
alreadyVisitedImage->Allocate();
157159

158160
// Separation of the non-boundary region that will be processed in a different way
159161
NeighborhoodAlgorithm::ImageBoundaryFacesCalculator< TInputImage > boundaryFacesCalculator;
160162
typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator< InputImageType >::FaceListType
161-
faceList = boundaryFacesCalculator( this->m_DigitalisedInputImageg, outputRegionForThread, m_NeighborhoodRadius );
163+
faceList = boundaryFacesCalculator( this->m_DigitalizedInputImage, outputRegionForThread, m_NeighborhoodRadius );
162164
typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator< InputImageType >::FaceListType::iterator fit = faceList.begin();
163165

164166
// Declaration of the variables useful to iterate over the all image region
@@ -169,14 +171,14 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
169171
// Declaration of the variables useful to iterate over the all the offsets
170172
OffsetType offset;
171173
unsigned int totalNumberOfRuns;
172-
unsigned int **hist = new unsigned int*[m_NumberOfBinsPerAxis];
173-
for(unsigned int a= 0; a < m_NumberOfBinsPerAxis; a++)
174+
unsigned int **histogram = new unsigned int*[m_NumberOfBinsPerAxis];
175+
for(unsigned int axis = 0; axis < m_NumberOfBinsPerAxis; ++axis)
174176
{
175-
hist[a] = new unsigned int[m_NumberOfBinsPerAxis];
177+
histogram[axis] = new unsigned int[m_NumberOfBinsPerAxis];
176178
}
177179

178180
// Declaration of the variables useful to iterate over the all neighborhood region
179-
PixelType curentInNeighborhoodPixelIntensity;
181+
PixelType currentInNeighborhoodPixelIntensity;
180182

181183
// Declaration of the variables useful to iterate over the run
182184
PixelType pixelIntensity( NumericTraits<PixelType>::ZeroValue() );
@@ -188,7 +190,7 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
188190
/// ***** Non-boundary Region *****
189191
for (; fit != faceList.end(); ++fit )
190192
{
191-
NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitalisedInputImageg, *fit );
193+
NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitalizedInputImage, *fit );
192194
typedef itk::ImageRegionIterator< OutputImageType> IteratorType;
193195
IteratorType outputIt( outputPtr, *fit );
194196

@@ -208,7 +210,7 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
208210
{
209211
for(unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++)
210212
{
211-
hist[a][b] = 0;
213+
histogram[a][b] = 0;
212214
}
213215
}
214216
totalNumberOfRuns = 0;
@@ -221,10 +223,10 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
221223
// Iteration over the all neighborhood region
222224
for(NeighborIndexType nb = 0; nb<inputNIt.Size(); ++nb)
223225
{
224-
curentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb);
226+
currentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb);
225227
tempOffset = inputNIt.GetOffset(nb);
226228
// Checking if the value is out-of-bounds or is outside the mask.
227-
if( curentInNeighborhoodPixelIntensity < 0 || // The pixel is outside of the mask or outside of bounds
229+
if( currentInNeighborhoodPixelIntensity < 0 || // The pixel is outside of the mask or outside of bounds
228230
alreadyVisitedImage->GetPixel( boolCurentInNeighborhoodIndex + tempOffset) )
229231
{
230232
continue;
@@ -251,7 +253,7 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
251253
// Special attention paid to boundaries of bins.
252254
// For the last bin, it is left close and right close (following the previous
253255
// gerrit patch). For all other bins, the bin is left close and right open.
254-
if ( pixelIntensity == curentInNeighborhoodPixelIntensity )
256+
if ( pixelIntensity == currentInNeighborhoodPixelIntensity )
255257
{
256258
alreadyVisitedImage->SetPixel( boolCurentInNeighborhoodIndex + iteratedOffset, true );
257259
pixelDistance++;
@@ -264,20 +266,26 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
264266
}
265267
}
266268
// Increase the corresponding bin in the histogram
267-
this->IncreaseHistogram(hist, totalNumberOfRuns,
268-
curentInNeighborhoodPixelIntensity,
269+
this->IncreaseHistogram(histogram, totalNumberOfRuns,
270+
currentInNeighborhoodPixelIntensity,
269271
offset, pixelDistance);
270272
}
271273
}
272274
// Compute the run length features
273-
this->ComputeFeatures( hist, totalNumberOfRuns, outputPixel);
275+
this->ComputeFeatures( histogram, totalNumberOfRuns, outputPixel);
274276
outputIt.Set(outputPixel);
275277

276278
progress.CompletedPixel();
277279
++inputNIt;
278280
++outputIt;
279281
}
280282
}
283+
284+
for(unsigned int axis = 0; axis < m_NumberOfBinsPerAxis; ++axis)
285+
{
286+
delete histogram[axis];
287+
}
288+
delete histogram;
281289
}
282290

283291
template<typename TInputImage, typename TOutputImage>
@@ -387,8 +395,8 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
387395
template<typename TInputImage, typename TOutputImage>
388396
void
389397
RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
390-
::IncreaseHistogram(unsigned int **hist, unsigned int &totalNumberOfRuns,
391-
const PixelType &curentInNeighborhoodPixelIntensity,
398+
::IncreaseHistogram(unsigned int **histogram, unsigned int &totalNumberOfRuns,
399+
const PixelType &currentInNeighborhoodPixelIntensity,
392400
const OffsetType &offset, const unsigned int &pixelDistance)
393401
{
394402
float offsetDistance = 0;
@@ -404,14 +412,14 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
404412
if (offsetDistanceBin < static_cast< int >( m_NumberOfBinsPerAxis ))
405413
{
406414
totalNumberOfRuns++;
407-
hist[curentInNeighborhoodPixelIntensity][offsetDistanceBin]++;
415+
histogram[currentInNeighborhoodPixelIntensity][offsetDistanceBin]++;
408416
}
409417
}
410418

411419
template<typename TInputImage, typename TOutputImage>
412420
void
413421
RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
414-
::ComputeFeatures( unsigned int **hist,const unsigned int &totalNumberOfRuns,
422+
::ComputeFeatures( unsigned int **histogram,const unsigned int &totalNumberOfRuns,
415423
typename TOutputImage::PixelType &outputPixel)
416424
{
417425
OutputRealType shortRunEmphasis = NumericTraits<OutputRealType>::ZeroValue();
@@ -434,7 +442,7 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
434442
{
435443
for(unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++)
436444
{
437-
OutputRealType frequency = hist[a][b];
445+
OutputRealType frequency = histogram[a][b];
438446
if ( Math::ExactlyEquals(frequency, NumericTraits<OutputRealType>::ZeroValue()) )
439447
{
440448
continue;
@@ -502,31 +510,31 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage>
502510
{
503511
Superclass::PrintSelf( os, indent );
504512

505-
itkPrintSelfObjectMacro( DigitalisedInputImageg );
513+
itkPrintSelfObjectMacro( DigitalizedInputImage );
506514

507-
os << indent << "NeighborhoodRadius"
515+
os << indent << "NeighborhoodRadius: "
508516
<< static_cast< typename NumericTraits<
509517
NeighborhoodRadiusType >::PrintType >( m_NeighborhoodRadius ) << std::endl;
510518

511519
itkPrintSelfObjectMacro( Offsets );
512520

513-
os << indent << "NumberOfBinsPerAxis" << m_NumberOfBinsPerAxis << std::endl;
514-
os << indent << "Min"
521+
os << indent << "NumberOfBinsPerAxis: " << m_NumberOfBinsPerAxis << std::endl;
522+
os << indent << "Min: "
515523
<< static_cast< typename NumericTraits< PixelType >::PrintType >( m_Min )
516524
<< std::endl;
517-
os << indent << "Max"
525+
os << indent << "Max: "
518526
<< static_cast< typename NumericTraits< PixelType >::PrintType >( m_Max )
519527
<< std::endl;
520-
os << indent << "MinDistance"
528+
os << indent << "MinDistance: "
521529
<< static_cast< typename NumericTraits< RealType >::PrintType >(
522530
m_MinDistance ) << std::endl;
523-
os << indent << "MaxDistance"
531+
os << indent << "MaxDistance: "
524532
<< static_cast< typename NumericTraits< RealType >::PrintType >(
525533
m_MaxDistance ) << std::endl;
526-
os << indent << "InsidePixelValue"
534+
os << indent << "InsidePixelValue: "
527535
<< static_cast< typename NumericTraits< PixelType >::PrintType >(
528536
m_InsidePixelValue ) << std::endl;
529-
os << indent << "Spacing"
537+
os << indent << "Spacing: "
530538
<< static_cast< typename NumericTraits<
531539
typename TInputImage::SpacingType >::PrintType >( m_Spacing ) << std::endl;
532540
}

0 commit comments

Comments
 (0)