Skip to content

Commit

Permalink
STYLE: Make flow control variables have a local scope
Browse files Browse the repository at this point in the history
Make the flow control statement variables have a local scope.
  • Loading branch information
jhlegarreta authored and hjmjohnson committed Sep 12, 2022
1 parent 3c6de8f commit 4d0d137
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions Modules/Filtering/ImageCompare/test/itkSTAPLEImageFilterTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,13 @@ template <unsigned int VDimension>
int
Stapler<VDimension>::Execute()
{
size_t i;

typename itk::ImageFileReader<InputImageType>::Pointer reader;
typename itk::ImageFileWriter<OutputImageType>::Pointer writer = itk::ImageFileWriter<OutputImageType>::New();

size_t number_of_files = m_Files.size();

// Set the inputs
for (i = 0; i < number_of_files; ++i)
for (size_t i = 0; i < number_of_files; ++i)
{
reader = itk::ImageFileReader<InputImageType>::New();
reader->SetFileName(m_Files[i].c_str());
Expand All @@ -185,7 +183,6 @@ Stapler<VDimension>::Execute()
int
itkSTAPLEImageFilterTest(int argc, char * argv[])
{
int i;
StaplerBase * stapler;

if (argc < 5)
Expand All @@ -211,7 +208,7 @@ itkSTAPLEImageFilterTest(int argc, char * argv[])
return EXIT_FAILURE;
}

for (i = 0; i < argc - 5; ++i)
for (int i = 0; i < argc - 5; ++i)
{
stapler->AddFileName(argv[i + 5]);
}
Expand Down Expand Up @@ -242,13 +239,13 @@ itkSTAPLEImageFilterTest(int argc, char * argv[])
std::cout << "-----"
<< "\t\t-------------- "
<< "\t--------------" << std::endl;
unsigned int j;
for (j = 0; j < stapler->GetNumberOfFiles(); ++j)

for (unsigned int i = 0; i < stapler->GetNumberOfFiles(); ++i)
{
avg_q += stapler->GetSpecificity(j);
avg_p += stapler->GetSensitivity(j);
std::cout << j << ": " << stapler->GetFileName(j) << "\t" << stapler->GetSensitivity(j) << "\t\t"
<< stapler->GetSpecificity(j) << std::endl;
avg_q += stapler->GetSpecificity(i);
avg_p += stapler->GetSensitivity(i);
std::cout << i << ": " << stapler->GetFileName(i) << "\t" << stapler->GetSensitivity(i) << "\t\t"
<< stapler->GetSpecificity(i) << std::endl;
}
avg_p /= static_cast<double>(stapler->GetNumberOfFiles());
avg_q /= static_cast<double>(stapler->GetNumberOfFiles());
Expand Down

0 comments on commit 4d0d137

Please sign in to comment.