Skip to content

Commit 0c6fac9

Browse files
committed
STYLE: Address greptile review on MultipleImageIterator
- operator[] takes unsigned int (matches Size() return type and m_Iterators::operator[] signature; prevents silent negative-index UB). - Remove 'using namespace std;' at global scope and explicitly qualify std:: usages in the test driver, per ITK code-style.
1 parent a46a4c4 commit 0c6fac9

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

Modules/Core/MultipleImageIterator/include/itkMultipleImageIterator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class MultipleImageIterator
4040
using ImageType = typename IteratorType::ImageType;
4141
/// Access one of the iterators
4242
IteratorType &
43-
operator[](const int i)
43+
operator[](const unsigned int i)
4444
{
4545
return m_Iterators[i];
4646
}

Modules/Core/MultipleImageIterator/test/DumpIntensities.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@
2525
#include "itkMultipleImageIterator.h"
2626

2727
// Dumps random samples from files into a csv file
28-
using namespace std;
2928

3029
int
3130
DumpIntensities(int argc, char * argv[])
3231
{
3332
if (argc < 3)
3433
{
35-
cerr << "Usage: DumpIntensities outfile inImage [inImage ...]" << endl;
34+
std::cerr << "Usage: DumpIntensities outfile inImage [inImage ...]" << std::endl;
3635
return 1;
3736
}
3837
using PixelType = unsigned short;
@@ -42,7 +41,7 @@ DumpIntensities(int argc, char * argv[])
4241
using IteratorType = itk::ImageRegionIterator<ImageType>;
4342
itk::MultipleImageIterator<IteratorType> it;
4443

45-
vector<ImageType::Pointer> images; // Need to keep a reference as iterators only have weak references
44+
std::vector<ImageType::Pointer> images; // Need to keep a reference as iterators only have weak references
4645
for (int i = 2; i < argc; ++i)
4746
{
4847
ReaderType::Pointer r = ReaderType::New();
@@ -56,7 +55,7 @@ DumpIntensities(int argc, char * argv[])
5655

5756
unsigned long long c = 0;
5857
using Vec3 = itk::FixedArray<PixelType, 3>;
59-
vector<Vec3> values;
58+
std::vector<Vec3> values;
6059
for (it.GoToBegin(); !it.IsAtEnd(); ++it, ++c)
6160
{
6261
if (c % 42 == 0)

0 commit comments

Comments
 (0)