Skip to content

Commit cea19d9

Browse files
committed
STYLE: Move duplicate code in BinaryContourImageFilter outside if/else
Avoided having the very same `ComputeIndex()` call in both the `if` and the `else` clause, in `BinaryContourImageFilter::DynamicThreadedGenerateData`.
1 parent c60439c commit cea19d9

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Modules/Filtering/ImageLabel/include/itkBinaryContourImageFilter.hxx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,12 @@ BinaryContourImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData
138138
{
139139
const InputImagePixelType PVal = inLineIt.Get();
140140

141+
// We've hit the start of a run
142+
SizeValueType length = 0;
143+
const IndexType thisIndex = inLineIt.ComputeIndex();
144+
141145
if (Math::AlmostEquals(PVal, m_ForegroundValue))
142146
{
143-
// We've hit the start of a run
144-
SizeValueType length = 0;
145-
const IndexType thisIndex = inLineIt.ComputeIndex();
146-
147147
outLineIt.Set(m_BackgroundValue);
148148

149149
++length;
@@ -162,10 +162,6 @@ BinaryContourImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData
162162
}
163163
else
164164
{
165-
// We've hit the start of a run
166-
SizeValueType length = 0;
167-
const IndexType thisIndex = inLineIt.ComputeIndex();
168-
169165
outLineIt.Set(PVal);
170166
++length;
171167
++inLineIt;

0 commit comments

Comments
 (0)