Skip to content

Commit b237c2b

Browse files
committed
ENH: Initialize all arrays in LabelSetUtils.h file
Initialize all arrays in `LabelSetUtils.h` file.
1 parent 420c9f7 commit b237c2b

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

include/itkLabelSetUtils.h

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,9 @@ doOneDimensionErodeFirstPass(TInIter & inputIterator,
257257
// const RealType magnitude = (magnitudeSign * iscale * iscale)/(2.0 *
258258
// sigma);
259259
const RealType magnitude = (magnitudeSign * iscale * iscale) / (2.0);
260-
LineBufferType lineBuf(lineLength);
261-
LabelBufferType labBuf(lineLength);
260+
const RealType initValue = 0.0;
261+
LineBufferType lineBuf(lineLength, initValue);
262+
LabelBufferType labBuf(lineLength, initValue);
262263

263264
inputIterator.SetDirection(direction);
264265
outputIterator.SetDirection(direction);
@@ -394,10 +395,11 @@ doOneDimensionDilateFirstPass(TInIter & inputIterator,
394395
// const RealType magnitude = (magnitudeSign * iscale * iscale)/(2.0 *
395396
// sigma);
396397
const RealType magnitude = (magnitudeSign * iscale * iscale) / (2.0);
397-
LineBufferType lineBuf(lineLength);
398-
LabelBufferType labBuf(lineLength);
399-
LineBufferType tmpLineBuf(lineLength);
400-
LabelBufferType newLabBuf(lineLength);
398+
const RealType initValue = 0.0;
399+
LineBufferType lineBuf(lineLength, initValue);
400+
LabelBufferType labBuf(lineLength, initValue);
401+
LineBufferType tmpLineBuf(lineLength, initValue);
402+
LabelBufferType newLabBuf(lineLength, initValue);
401403

402404
inputIterator.SetDirection(direction);
403405
outputIterator.SetDirection(direction);
@@ -476,8 +478,9 @@ doOneDimensionErode(TInIter & inputIterator,
476478
iscale = imageScale;
477479
}
478480
const RealType magnitude = (magnitudeSign * iscale * iscale) / (2.0 * sigma);
479-
LineBufferType lineBuf(lineLength);
480-
LabelBufferType labBuf(lineLength);
481+
const RealType initValue = 0.0;
482+
LineBufferType lineBuf(lineLength, initValue);
483+
LabelBufferType lineBuf(lineLength, initValue);
481484

482485
inputIterator.SetDirection(direction);
483486
outputDistIterator.SetDirection(direction);
@@ -618,11 +621,12 @@ doOneDimensionDilate(TInIter & inputIterator,
618621
// restructure equation to reduce numerical error
619622
const RealType magnitude = (magnitudeSign * iscale * iscale) / (2.0 * sigma);
620623
// const RealType magnitude = (magnitudeSign * iscale * iscale)/(2.0 );
621-
LineBufferType lineBuf(lineLength);
622-
LabelBufferType labBuf(lineLength);
623-
LineBufferType tmpLineBuf(lineLength);
624-
LabelBufferType newLabBuf(lineLength);
625-
LabelBufferType tmpLabBuf(lineLength);
624+
const RealType initValue = 0.0;
625+
LineBufferType lineBuf(lineLength, initValue);
626+
LabelBufferType labBuf(lineLength, initValue);
627+
LineBufferType tmpLineBuf(lineLength, initValue);
628+
LabelBufferType newLabBuf(lineLength, initValue);
629+
LabelBufferType tmpLabBuf(lineLength, initValue);
626630

627631
inputIterator.SetDirection(direction);
628632
inputDistIterator.SetDirection(direction);

0 commit comments

Comments
 (0)