From 4eedf6afece42dfed0860f5f84610e574bed6e72 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Mon, 16 Dec 2024 16:36:17 -0500 Subject: [PATCH] ENH: Use unsigned int for indexing into number of image dimensions Replace non-portable "long" type with "int". --- Modules/Core/Common/include/itkImageIORegion.h | 8 ++++---- Modules/Core/Common/include/itkIndex.h | 4 ++-- Modules/Core/Common/include/itkNeighborhoodOperator.h | 6 +++--- Modules/Core/Common/src/itkImageIORegion.cxx | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Modules/Core/Common/include/itkImageIORegion.h b/Modules/Core/Common/include/itkImageIORegion.h index 0026fa4e6c1..000945c2407 100644 --- a/Modules/Core/Common/include/itkImageIORegion.h +++ b/Modules/Core/Common/include/itkImageIORegion.h @@ -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 diff --git a/Modules/Core/Common/include/itkIndex.h b/Modules/Core/Common/include/itkIndex.h index 506fd1b246a..706c699ae06 100644 --- a/Modules/Core/Common/include/itkIndex.h +++ b/Modules/Core/Common/include/itkIndex.h @@ -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; } @@ -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]; } diff --git a/Modules/Core/Common/include/itkNeighborhoodOperator.h b/Modules/Core/Common/include/itkNeighborhoodOperator.h index 55232f9e845..3fb083e5a9c 100644 --- a/Modules/Core/Common/include/itkNeighborhoodOperator.h +++ b/Modules/Core/Common/include/itkNeighborhoodOperator.h @@ -91,7 +91,7 @@ class ITK_TEMPLATE_EXPORT NeighborhoodOperator : public Neighborhood= VDimension) { @@ -102,7 +102,7 @@ class ITK_TEMPLATE_EXPORT NeighborhoodOperator : public Neighborhood= m_Size.size()) { @@ -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()) { @@ -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()) { @@ -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()) {