Skip to content

Commit

Permalink
ENH: Use unsigned int for indexing into number of image dimensions
Browse files Browse the repository at this point in the history
Replace non-portable "long" type with "int".
  • Loading branch information
blowekamp authored and N-Dekker committed Dec 21, 2024
1 parent 4c841e0 commit 4eedf6a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Modules/Core/Common/include/itkImageIORegion.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,16 @@ class ITKCommon_EXPORT ImageIORegion : public Region
* coordinate direction i. Do not try to access image sizes beyond the
* the ImageDimension. */
SizeValueType
GetSize(unsigned long i) const;
GetSize(unsigned int i) const;

IndexValueType
GetIndex(unsigned long i) const;
GetIndex(unsigned int i) const;

void
SetSize(const unsigned long i, SizeValueType size);
SetSize(const unsigned int i, SizeValueType size);

void
SetIndex(const unsigned long i, IndexValueType idx);
SetIndex(const unsigned int i, IndexValueType idx);

/** Compare two regions. */
bool
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ struct ITK_TEMPLATE_EXPORT Index final
* \sa SetIndex()
* \sa GetElement() */
void
SetElement(unsigned long element, IndexValueType val)
SetElement(unsigned int element, IndexValueType val)
{
m_InternalArray[element] = val;
}
Expand All @@ -258,7 +258,7 @@ struct ITK_TEMPLATE_EXPORT Index final
* \sa GetIndex()
* \sa SetElement() */
IndexValueType
GetElement(unsigned long element) const
GetElement(unsigned int element) const
{
return m_InternalArray[element];
}
Expand Down
6 changes: 3 additions & 3 deletions Modules/Core/Common/include/itkNeighborhoodOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ITK_TEMPLATE_EXPORT NeighborhoodOperator : public Neighborhood<TPixel, VDi

/** Sets the dimensional direction of a directional operator. */
void
SetDirection(const unsigned long direction)
SetDirection(const unsigned int direction)
{
if (direction >= VDimension)
{
Expand All @@ -102,7 +102,7 @@ class ITK_TEMPLATE_EXPORT NeighborhoodOperator : public Neighborhood<TPixel, VDi
}

/** Returns the direction (dimension number) of a directional operator. */
unsigned long
unsigned int
GetDirection() const
{
return m_Direction;
Expand Down Expand Up @@ -181,7 +181,7 @@ class ITK_TEMPLATE_EXPORT NeighborhoodOperator : public Neighborhood<TPixel, VDi

private:
/** Direction (dimension number) of the derivative. */
unsigned long m_Direction{ 0 };
unsigned int m_Direction{ 0 };
};
} // namespace itk

Expand Down
8 changes: 4 additions & 4 deletions Modules/Core/Common/src/itkImageIORegion.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ ImageIORegion::GetRegionDimension() const
}

ImageIORegion::SizeValueType
ImageIORegion::GetSize(unsigned long i) const
ImageIORegion::GetSize(unsigned int i) const
{
if (i >= m_Size.size())
{
Expand All @@ -140,7 +140,7 @@ ImageIORegion::GetSize(unsigned long i) const
}

ImageIORegion::IndexValueType
ImageIORegion::GetIndex(unsigned long i) const
ImageIORegion::GetIndex(unsigned int i) const
{
if (i >= m_Index.size())
{
Expand All @@ -150,7 +150,7 @@ ImageIORegion::GetIndex(unsigned long i) const
}

void
ImageIORegion::SetSize(const unsigned long i, SizeValueType size)
ImageIORegion::SetSize(const unsigned int i, SizeValueType size)
{
if (i >= m_Size.size())
{
Expand All @@ -160,7 +160,7 @@ ImageIORegion::SetSize(const unsigned long i, SizeValueType size)
}

void
ImageIORegion::SetIndex(const unsigned long i, IndexValueType idx)
ImageIORegion::SetIndex(const unsigned int i, IndexValueType idx)
{
if (i >= m_Index.size())
{
Expand Down

0 comments on commit 4eedf6a

Please sign in to comment.