Skip to content
This repository was archived by the owner on May 27, 2026. It is now read-only.

Commit 8f81db4

Browse files
committed
COMP: Style, change template variable name
From `N` to `VN` to comply with style
1 parent d163f14 commit 8f81db4

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

include/itkInd2Sub.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,33 @@ namespace itk
3737
*
3838
* @return FixedArray with subindexes: [i,j,k, ...
3939
*/
40-
template <unsigned int N>
41-
FixedArray<unsigned int, N>
42-
Ind2Sub(const unsigned int & linear_index, const FixedArray<unsigned int, N> & ns)
40+
template <unsigned int VN>
41+
FixedArray<unsigned int, VN>
42+
Ind2Sub(const unsigned int & linear_index, const FixedArray<unsigned int, VN> & ns)
4343
{
44-
for (unsigned int d = 0; d < N; ++d)
44+
for (unsigned int d = 0; d < VN; ++d)
4545
{
4646
if (ns[d] == 0)
4747
throw std::runtime_error("itk::Ind2Sub: input size cannot be zero");
4848
}
4949

5050
// accumulative product.
51-
FixedArray<unsigned int, N> cumprod;
52-
unsigned int accum = 1;
51+
FixedArray<unsigned int, VN> cumprod;
52+
unsigned int accum = 1;
5353
cumprod[0] = accum;
54-
for (unsigned int d = 1; d < N; ++d)
54+
for (unsigned int d = 1; d < VN; ++d)
5555
{
5656
accum *= ns[d - 1];
5757
cumprod[d] = accum;
5858
}
59-
unsigned int max_index = accum * ns[N - 1] - 1;
59+
unsigned int max_index = accum * ns[VN - 1] - 1;
6060
if (linear_index > max_index)
6161
throw std::runtime_error("itk::Ind2Sub: input index is incompatible with the given size");
6262

63-
FixedArray<unsigned int, N> out;
64-
unsigned int temp_index(linear_index);
63+
FixedArray<unsigned int, VN> out;
64+
unsigned int temp_index(linear_index);
6565
// loop well defined. it will go to > N after --0
66-
for (unsigned int i = N - 1; i < N; --i)
66+
for (unsigned int i = VN - 1; i < VN; --i)
6767
{
6868
unsigned int rem = (temp_index) % cumprod[i];
6969
out[i] = (temp_index - rem) / cumprod[i];
@@ -77,18 +77,18 @@ Ind2Sub(const unsigned int & linear_index, const FixedArray<unsigned int, N> & n
7777
* @brief Return SubIndex [i,j,k,...] from linear index and matrix size.
7878
* \sa Ind2Sub
7979
*/
80-
template <unsigned int N>
81-
itk::Index<N>
82-
Ind2Sub(const unsigned int & linear_index, const itk::Size<N> & ns)
80+
template <unsigned int VN>
81+
itk::Index<VN>
82+
Ind2Sub(const unsigned int & linear_index, const itk::Size<VN> & ns)
8383
{
84-
FixedArray<unsigned int, N> ns_array;
85-
for (unsigned int d = 0; d < N; ++d)
84+
FixedArray<unsigned int, VN> ns_array;
85+
for (unsigned int d = 0; d < VN; ++d)
8686
{
8787
ns_array[d] = ns[d];
8888
}
89-
FixedArray<unsigned int, N> out_array = Ind2Sub<N>(linear_index, ns_array);
90-
itk::Index<N> out_index;
91-
for (unsigned int d = 0; d < N; ++d)
89+
FixedArray<unsigned int, VN> out_array = Ind2Sub<VN>(linear_index, ns_array);
90+
itk::Index<VN> out_index;
91+
for (unsigned int d = 0; d < VN; ++d)
9292
{
9393
out_index[d] = out_array[d];
9494
}

0 commit comments

Comments
 (0)