Skip to content

Commit 8fa965e

Browse files
authored
Merge pull request #53 from blowekamp/FixVariableLengthVectorInitialization
Fix variable length vector initialization
2 parents 15adda3 + 870f1f9 commit 8fa965e

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

include/itkCoocurrenceTextureFeaturesImageFilter.hxx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage, TMaskImage>
140140

141141
// Creation of the output pixel type
142142
typename TOutputImage::PixelType outputPixel;
143+
NumericTraits<typename TOutputImage::PixelType>::SetLength(outputPixel, outputPtr->GetNumberOfComponentsPerPixel());
143144

144145
// Separation of the non-boundary region that will be processed in a different way
145146
NeighborhoodAlgorithm::ImageBoundaryFacesCalculator< DigitizedImageType > boundaryFacesCalculator;
@@ -149,12 +150,6 @@ CoocurrenceTextureFeaturesImageFilter<TInputImage, TOutputImage, TMaskImage>
149150

150151
// Declaration of the variables useful to iterate over the all image region
151152
bool isInImage;
152-
IndexType firstIndex;
153-
for ( unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i )
154-
{
155-
firstIndex[i] = 0;
156-
}
157-
outputPixel = outputPtr->GetPixel(firstIndex);
158153
typename OffsetVector::ConstIterator offsets;
159154

160155
// Declaration of the variables useful to iterate over the all the offsets

include/itkRunLengthTextureFeaturesImageFilter.hxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,15 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage, TMaskImage>
136136
ThreadIdType threadId)
137137
{
138138
// Get the inputs/outputs
139-
typename TOutputImage::Pointer outputPtr = TOutputImage::New();
140-
outputPtr = this->GetOutput();
139+
TOutputImage * outputPtr = this->GetOutput();
141140

142141
ProgressReporter progress( this,
143142
threadId,
144143
outputRegionForThread.GetNumberOfPixels() );
145144

146145
// Creation of the output pixel type
147146
typename TOutputImage::PixelType outputPixel;
147+
NumericTraits<typename TOutputImage::PixelType>::SetLength(outputPixel, outputPtr->GetNumberOfComponentsPerPixel());
148148

149149
// Creation of a region with the same size as the neighborhood. This region
150150
// will be used to check if each voxel has already been visited.
@@ -174,7 +174,6 @@ RunLengthTextureFeaturesImageFilter<TInputImage, TOutputImage, TMaskImage>
174174

175175
// Declaration of the variables useful to iterate over the all image region
176176
bool isInImage;
177-
outputPixel = outputPtr->GetPixel(boolCurentInNeighborhoodIndex);
178177
typename OffsetVector::ConstIterator offsets;
179178

180179
// Declaration of the variables useful to iterate over the all the offsets

0 commit comments

Comments
 (0)