Skip to content

Commit f976a6f

Browse files
committed
ENH: Initialize all arrays in LabelSetUtils.h file
Initialize all arrays in `LabelSetUtils.h` file.
1 parent f247673 commit f976a6f

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

include/itkLabelSetUtils.h

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,9 @@ doOneDimensionErodeFirstPass(TInIter & inputIterator,
259259
// const RealType magnitude = (m_MagnitudeSign * iscale * iscale)/(2.0 *
260260
// Sigma);
261261
const RealType magnitude = (m_MagnitudeSign * iscale * iscale) / (2.0);
262-
LineBufferType LineBuf(LineLength);
263-
LabelBufferType LabBuf(LineLength);
262+
const RealType initValue = 0.0;
263+
LineBufferType LineBuf(LineLength, initValue);
264+
LabelBufferType LabBuf(LineLength, initValue);
264265

265266
inputIterator.SetDirection(direction);
266267
outputIterator.SetDirection(direction);
@@ -396,10 +397,11 @@ doOneDimensionDilateFirstPass(TInIter & inputIterator,
396397
// const RealType magnitude = (m_MagnitudeSign * iscale * iscale)/(2.0 *
397398
// Sigma);
398399
const RealType magnitude = (m_MagnitudeSign * iscale * iscale) / (2.0);
399-
LineBufferType LineBuf(LineLength);
400-
LabelBufferType LabBuf(LineLength);
401-
LineBufferType tmpLineBuf(LineLength);
402-
LabelBufferType newLabBuf(LineLength);
400+
const RealType initValue = 0.0;
401+
LineBufferType LineBuf(LineLength, initValue);
402+
LabelBufferType LabBuf(LineLength, initValue);
403+
LineBufferType tmpLineBuf(LineLength, initValue);
404+
LabelBufferType newLabBuf(LineLength, initValue);
403405

404406
inputIterator.SetDirection(direction);
405407
outputIterator.SetDirection(direction);
@@ -479,7 +481,7 @@ doOneDimensionErode(TInIter & inputIterator,
479481
}
480482
const RealType magnitude = (m_MagnitudeSign * iscale * iscale) / (2.0 * Sigma);
481483
LineBufferType LineBuf(LineLength);
482-
LabelBufferType LabBuf(LineLength);
484+
LabelBufferType LabBuf(LineLength, 0.0);
483485

484486
inputIterator.SetDirection(direction);
485487
outputDistIterator.SetDirection(direction);
@@ -620,11 +622,12 @@ doOneDimensionDilate(TInIter & inputIterator,
620622
// restructure equation to reduce numerical error
621623
const RealType magnitude = (m_MagnitudeSign * iscale * iscale) / (2.0 * Sigma);
622624
// const RealType magnitude = (m_MagnitudeSign * iscale * iscale)/(2.0 );
623-
LineBufferType LineBuf(LineLength);
624-
LabelBufferType LabBuf(LineLength);
625-
LineBufferType tmpLineBuf(LineLength);
626-
LabelBufferType newLabBuf(LineLength);
627-
LabelBufferType tmpLabBuf(LineLength);
625+
const RealType initValue = 0.0;
626+
LineBufferType LineBuf(LineLength, initValue);
627+
LabelBufferType LabBuf(LineLength, initValue);
628+
LineBufferType tmpLineBuf(LineLength, initValue);
629+
LabelBufferType newLabBuf(LineLength, initValue);
630+
LabelBufferType tmpLabBuf(LineLength, initValue);
628631

629632
inputIterator.SetDirection(direction);
630633
inputDistIterator.SetDirection(direction);

0 commit comments

Comments
 (0)