Skip to content

Commit 4b43536

Browse files
Leengitdzenanz
authored andcommitted
STYLE: Change template parameter name prefix N to V
STYLE: Remove N as acceptable template parameter name prefix
1 parent 0df9d43 commit 4b43536

File tree

167 files changed

+2264
-2283
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+2264
-2283
lines changed

Modules/Core/Common/include/itkCovariantVector.h

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace itk
3333
* type held at each pixel in an Image or at each vertex of an Mesh.
3434
* The template parameter T can be any data type that behaves like a
3535
* primitive (or atomic) data type (int, short, float, complex).
36-
* The NVectorDimension defines the number of components in the vector array.
36+
* The VVectorDimension defines the number of components in the vector array.
3737
*
3838
* CovariantVector is not a dynamically extendible array like std::vector. It is
3939
* intended to be used like a mathematical vector.
@@ -65,13 +65,13 @@ namespace itk
6565
* \endsphinx
6666
*/
6767

68-
template <typename T, unsigned int NVectorDimension = 3>
69-
class ITK_TEMPLATE_EXPORT CovariantVector : public FixedArray<T, NVectorDimension>
68+
template <typename T, unsigned int VVectorDimension = 3>
69+
class ITK_TEMPLATE_EXPORT CovariantVector : public FixedArray<T, VVectorDimension>
7070
{
7171
public:
7272
/** Standard class type aliases. */
7373
using Self = CovariantVector;
74-
using Superclass = FixedArray<T, NVectorDimension>;
74+
using Superclass = FixedArray<T, VVectorDimension>;
7575

7676
/** ValueType can be used to declare a variable that is the same type
7777
* as a data element held in an CovariantVector. */
@@ -82,19 +82,19 @@ class ITK_TEMPLATE_EXPORT CovariantVector : public FixedArray<T, NVectorDimensio
8282
using ComponentType = T;
8383

8484
/** Dimension of the Space */
85-
static constexpr unsigned int Dimension = NVectorDimension;
85+
static constexpr unsigned int Dimension = VVectorDimension;
8686

8787
/** I am a covariant vector. */
8888
using CovariantVectorType = Self;
8989

9090
/** The Array type from which this CovariantVector is derived. */
91-
using BaseArray = FixedArray<T, NVectorDimension>;
91+
using BaseArray = FixedArray<T, VVectorDimension>;
9292

9393
/** Get the dimension (size) of the vector. */
9494
static unsigned int
9595
GetCovariantVectorDimension()
9696
{
97-
return NVectorDimension;
97+
return VVectorDimension;
9898
}
9999

100100
/** Set a vnl_vector_ref referencing the same memory block. */
@@ -127,7 +127,7 @@ class ITK_TEMPLATE_EXPORT CovariantVector : public FixedArray<T, NVectorDimensio
127127
/** Pass-through constructor for the Array base class. Implicit casting is
128128
* performed to initialize constructor from any another one of datatype. */
129129
template <typename TVectorValueType>
130-
CovariantVector(const CovariantVector<TVectorValueType, NVectorDimension> & r)
130+
CovariantVector(const CovariantVector<TVectorValueType, VVectorDimension> & r)
131131
: BaseArray(r)
132132
{}
133133
CovariantVector(const ValueType r[Dimension])
@@ -137,22 +137,22 @@ class ITK_TEMPLATE_EXPORT CovariantVector : public FixedArray<T, NVectorDimensio
137137
/** Assignment operator with implicit casting from another data type */
138138
template <typename TCovariantVectorValueType>
139139
Self &
140-
operator=(const CovariantVector<TCovariantVectorValueType, NVectorDimension> & r)
140+
operator=(const CovariantVector<TCovariantVectorValueType, VVectorDimension> & r)
141141
{
142142
BaseArray::operator=(r);
143143
return *this;
144144
}
145145

146146
/** Pass-through assignment operator for the Array base class. */
147147
CovariantVector &
148-
operator=(const ValueType r[NVectorDimension]);
148+
operator=(const ValueType r[VVectorDimension]);
149149

150150
/** Scalar operator*=. Scales elements by a scalar. */
151151
template <typename Tt>
152152
inline const Self &
153153
operator*=(const Tt & value)
154154
{
155-
for (unsigned int i = 0; i < NVectorDimension; ++i)
155+
for (unsigned int i = 0; i < VVectorDimension; ++i)
156156
{
157157
(*this)[i] = static_cast<ValueType>((*this)[i] * value);
158158
}
@@ -164,7 +164,7 @@ class ITK_TEMPLATE_EXPORT CovariantVector : public FixedArray<T, NVectorDimensio
164164
const Self &
165165
operator/=(const Tt & value)
166166
{
167-
for (unsigned int i = 0; i < NVectorDimension; ++i)
167+
for (unsigned int i = 0; i < VVectorDimension; ++i)
168168
{
169169
(*this)[i] = static_cast<ValueType>((*this)[i] / value);
170170
}
@@ -200,15 +200,15 @@ class ITK_TEMPLATE_EXPORT CovariantVector : public FixedArray<T, NVectorDimensio
200200

201201
/** operator*. Performs the scalar product with a vector (contravariant).
202202
* This scalar product is invariant under affine transformations */
203-
ValueType operator*(const Vector<T, NVectorDimension> & other) const;
203+
ValueType operator*(const Vector<T, VVectorDimension> & other) const;
204204

205205
/** Scalar operator*. Scale the elements of a vector by a scalar.
206206
* Return a new vector. */
207207
inline Self operator*(const ValueType & val) const
208208
{
209209
Self result;
210210

211-
for (unsigned int i = 0; i < NVectorDimension; ++i)
211+
for (unsigned int i = 0; i < VVectorDimension; ++i)
212212
{
213213
result[i] = static_cast<ValueType>((*this)[i] * val);
214214
}
@@ -223,7 +223,7 @@ class ITK_TEMPLATE_EXPORT CovariantVector : public FixedArray<T, NVectorDimensio
223223
{
224224
Self result;
225225

226-
for (unsigned int i = 0; i < NVectorDimension; ++i)
226+
for (unsigned int i = 0; i < VVectorDimension; ++i)
227227
{
228228
result[i] = static_cast<ValueType>((*this)[i] / val);
229229
}
@@ -238,7 +238,7 @@ class ITK_TEMPLATE_EXPORT CovariantVector : public FixedArray<T, NVectorDimensio
238238
static unsigned int
239239
GetNumberOfComponents()
240240
{
241-
return NVectorDimension;
241+
return VVectorDimension;
242242
}
243243

244244
/** Divides the covariant vector components by the norm and return the norm */
@@ -253,9 +253,9 @@ class ITK_TEMPLATE_EXPORT CovariantVector : public FixedArray<T, NVectorDimensio
253253
* Casting is done with C-Like rules */
254254
template <typename TCoordRepB>
255255
void
256-
CastFrom(const CovariantVector<TCoordRepB, NVectorDimension> & pa)
256+
CastFrom(const CovariantVector<TCoordRepB, VVectorDimension> & pa)
257257
{
258-
for (unsigned int i = 0; i < NVectorDimension; ++i)
258+
for (unsigned int i = 0; i < VVectorDimension; ++i)
259259
{
260260
(*this)[i] = static_cast<T>(pa[i]);
261261
}
@@ -264,17 +264,17 @@ class ITK_TEMPLATE_EXPORT CovariantVector : public FixedArray<T, NVectorDimensio
264264

265265
/** Premultiply Operator for product of a vector and a scalar.
266266
* CovariantVector< T, N > = T * CovariantVector< T,N > */
267-
template <typename T, unsigned int NVectorDimension>
268-
inline CovariantVector<T, NVectorDimension> operator*(const T & scalar, const CovariantVector<T, NVectorDimension> & v)
267+
template <typename T, unsigned int VVectorDimension>
268+
inline CovariantVector<T, VVectorDimension> operator*(const T & scalar, const CovariantVector<T, VVectorDimension> & v)
269269
{
270270
return v.operator*(scalar);
271271
}
272272

273273
/** Performs the scalar product of a covariant with a contravariant.
274274
* This scalar product is invariant under affine transformations */
275-
template <typename T, unsigned int NVectorDimension>
276-
inline T operator*(const Vector<T, NVectorDimension> & contravariant,
277-
const CovariantVector<T, NVectorDimension> & covariant)
275+
template <typename T, unsigned int VVectorDimension>
276+
inline T operator*(const Vector<T, VVectorDimension> & contravariant,
277+
const CovariantVector<T, VVectorDimension> & covariant)
278278
{
279279
return covariant.operator*(contravariant);
280280
}
@@ -289,9 +289,9 @@ ITKCommon_EXPORT void
289289
CrossProduct(CovariantVector<int, 3>, const Vector<int, 3> &, const Vector<int, 3> &);
290290

291291

292-
template <typename T, unsigned int NVectorDimension>
292+
template <typename T, unsigned int VVectorDimension>
293293
inline void
294-
swap(CovariantVector<T, NVectorDimension> & a, CovariantVector<T, NVectorDimension> & b)
294+
swap(CovariantVector<T, VVectorDimension> & a, CovariantVector<T, VVectorDimension> & b)
295295
{
296296
a.swap(b);
297297
}

Modules/Core/Common/include/itkCovariantVector.hxx

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -28,160 +28,160 @@ CovariantVector<T, TVectorDimension>::CovariantVector(const ValueType & r)
2828
: Superclass{ r }
2929
{}
3030

31-
template <typename T, unsigned int NVectorDimension>
32-
CovariantVector<T, NVectorDimension> &
33-
CovariantVector<T, NVectorDimension>::operator=(const ValueType r[NVectorDimension])
31+
template <typename T, unsigned int VVectorDimension>
32+
CovariantVector<T, VVectorDimension> &
33+
CovariantVector<T, VVectorDimension>::operator=(const ValueType r[VVectorDimension])
3434
{
3535
BaseArray::operator=(r);
3636
return *this;
3737
}
3838

39-
template <typename T, unsigned int NVectorDimension>
39+
template <typename T, unsigned int VVectorDimension>
4040
auto
41-
CovariantVector<T, NVectorDimension>::operator+=(const Self & vec) -> const Self &
41+
CovariantVector<T, VVectorDimension>::operator+=(const Self & vec) -> const Self &
4242
{
43-
for (unsigned int i = 0; i < NVectorDimension; ++i)
43+
for (unsigned int i = 0; i < VVectorDimension; ++i)
4444
{
4545
(*this)[i] += vec[i];
4646
}
4747
return *this;
4848
}
4949

50-
template <typename T, unsigned int NVectorDimension>
50+
template <typename T, unsigned int VVectorDimension>
5151
auto
52-
CovariantVector<T, NVectorDimension>::operator-=(const Self & vec) -> const Self &
52+
CovariantVector<T, VVectorDimension>::operator-=(const Self & vec) -> const Self &
5353
{
54-
for (unsigned int i = 0; i < NVectorDimension; ++i)
54+
for (unsigned int i = 0; i < VVectorDimension; ++i)
5555
{
5656
(*this)[i] -= vec[i];
5757
}
5858
return *this;
5959
}
6060

61-
template <typename T, unsigned int NVectorDimension>
62-
CovariantVector<T, NVectorDimension>
63-
CovariantVector<T, NVectorDimension>::operator-() const
61+
template <typename T, unsigned int VVectorDimension>
62+
CovariantVector<T, VVectorDimension>
63+
CovariantVector<T, VVectorDimension>::operator-() const
6464
{
6565
Self result;
6666

67-
for (unsigned int i = 0; i < NVectorDimension; ++i)
67+
for (unsigned int i = 0; i < VVectorDimension; ++i)
6868
{
6969
result[i] = -(*this)[i];
7070
}
7171
return result;
7272
}
7373

74-
template <typename T, unsigned int NVectorDimension>
74+
template <typename T, unsigned int VVectorDimension>
7575
auto
76-
CovariantVector<T, NVectorDimension>::operator+(const Self & vec) const -> Self
76+
CovariantVector<T, VVectorDimension>::operator+(const Self & vec) const -> Self
7777
{
7878
Self result;
7979

80-
for (unsigned int i = 0; i < NVectorDimension; ++i)
80+
for (unsigned int i = 0; i < VVectorDimension; ++i)
8181
{
8282
result[i] = (*this)[i] + vec[i];
8383
}
8484
return result;
8585
}
8686

87-
template <typename T, unsigned int NVectorDimension>
87+
template <typename T, unsigned int VVectorDimension>
8888
auto
89-
CovariantVector<T, NVectorDimension>::operator-(const Self & vec) const -> Self
89+
CovariantVector<T, VVectorDimension>::operator-(const Self & vec) const -> Self
9090
{
9191
Self result;
9292

93-
for (unsigned int i = 0; i < NVectorDimension; ++i)
93+
for (unsigned int i = 0; i < VVectorDimension; ++i)
9494
{
9595
result[i] = (*this)[i] - vec[i];
9696
}
9797
return result;
9898
}
9999

100-
template <typename T, unsigned int NVectorDimension>
101-
typename CovariantVector<T, NVectorDimension>::ValueType CovariantVector<T, NVectorDimension>::operator*(
100+
template <typename T, unsigned int VVectorDimension>
101+
typename CovariantVector<T, VVectorDimension>::ValueType CovariantVector<T, VVectorDimension>::operator*(
102102
const Self & other) const
103103
{
104104
typename NumericTraits<T>::AccumulateType value = NumericTraits<T>::ZeroValue();
105-
for (unsigned int i = 0; i < NVectorDimension; ++i)
105+
for (unsigned int i = 0; i < VVectorDimension; ++i)
106106
{
107107
value += (*this)[i] * other[i];
108108
}
109109
return static_cast<ValueType>(value);
110110
}
111111

112-
template <typename T, unsigned int NVectorDimension>
113-
typename CovariantVector<T, NVectorDimension>::ValueType CovariantVector<T, NVectorDimension>::operator*(
114-
const Vector<T, NVectorDimension> & other) const
112+
template <typename T, unsigned int VVectorDimension>
113+
typename CovariantVector<T, VVectorDimension>::ValueType CovariantVector<T, VVectorDimension>::operator*(
114+
const Vector<T, VVectorDimension> & other) const
115115
{
116116
typename NumericTraits<T>::AccumulateType value = NumericTraits<T>::ZeroValue();
117-
for (unsigned int i = 0; i < NVectorDimension; ++i)
117+
for (unsigned int i = 0; i < VVectorDimension; ++i)
118118
{
119119
value += (*this)[i] * other[i];
120120
}
121121
return value;
122122
}
123123

124-
template <typename T, unsigned int NVectorDimension>
124+
template <typename T, unsigned int VVectorDimension>
125125
auto
126-
CovariantVector<T, NVectorDimension>::GetSquaredNorm() const -> RealValueType
126+
CovariantVector<T, VVectorDimension>::GetSquaredNorm() const -> RealValueType
127127
{
128128
RealValueType sum = NumericTraits<RealValueType>::ZeroValue();
129129

130-
for (unsigned int i = 0; i < NVectorDimension; ++i)
130+
for (unsigned int i = 0; i < VVectorDimension; ++i)
131131
{
132132
const RealValueType value = (*this)[i];
133133
sum += value * value;
134134
}
135135
return sum;
136136
}
137137

138-
template <typename T, unsigned int NVectorDimension>
138+
template <typename T, unsigned int VVectorDimension>
139139
auto
140-
CovariantVector<T, NVectorDimension>::GetNorm() const -> RealValueType
140+
CovariantVector<T, VVectorDimension>::GetNorm() const -> RealValueType
141141
{
142142
return std::sqrt(this->GetSquaredNorm());
143143
}
144144

145-
template <typename T, unsigned int NVectorDimension>
145+
template <typename T, unsigned int VVectorDimension>
146146
auto
147-
CovariantVector<T, NVectorDimension>::Normalize() -> RealValueType
147+
CovariantVector<T, VVectorDimension>::Normalize() -> RealValueType
148148
{
149149
const RealValueType norm = this->GetNorm();
150150

151-
for (unsigned int i = 0; i < NVectorDimension; ++i)
151+
for (unsigned int i = 0; i < VVectorDimension; ++i)
152152
{
153153
(*this)[i] /= norm;
154154
}
155155

156156
return norm;
157157
}
158158

159-
template <typename T, unsigned int NVectorDimension>
159+
template <typename T, unsigned int VVectorDimension>
160160
void
161-
CovariantVector<T, NVectorDimension>::SetVnlVector(const vnl_vector<T> & v)
161+
CovariantVector<T, VVectorDimension>::SetVnlVector(const vnl_vector<T> & v)
162162
{
163163
for (unsigned int i = 0; i < v.size(); ++i)
164164
{
165165
(*this)[i] = v(i);
166166
}
167167
}
168168

169-
template <typename T, unsigned int NVectorDimension>
169+
template <typename T, unsigned int VVectorDimension>
170170
vnl_vector_ref<T>
171-
CovariantVector<T, NVectorDimension>::GetVnlVector()
171+
CovariantVector<T, VVectorDimension>::GetVnlVector()
172172
{
173-
return vnl_vector_ref<T>(NVectorDimension, this->GetDataPointer());
173+
return vnl_vector_ref<T>(VVectorDimension, this->GetDataPointer());
174174
}
175175

176-
template <typename T, unsigned int NVectorDimension>
176+
template <typename T, unsigned int VVectorDimension>
177177
vnl_vector<T>
178-
CovariantVector<T, NVectorDimension>::GetVnlVector() const
178+
CovariantVector<T, VVectorDimension>::GetVnlVector() const
179179
{
180180
// Return a vector_ref<>. This will be automatically converted to a
181181
// vnl_vector<>. We have to use a const_cast<> which would normally
182182
// be prohibited in a const method, but it is safe to do here
183183
// because the cast to vnl_vector<> will ultimately copy the data.
184-
return vnl_vector_ref<T>(NVectorDimension, const_cast<T *>(this->GetDataPointer()));
184+
return vnl_vector_ref<T>(VVectorDimension, const_cast<T *>(this->GetDataPointer()));
185185
}
186186

187187
} // end namespace itk

Modules/Core/Common/include/itkImage.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,15 @@ class ITK_TEMPLATE_EXPORT Image : public ImageBase<VImageDimension>
173173
*
174174
* \deprecated Use RebindImageType instead
175175
*/
176-
template <typename UPixelType, unsigned int NUImageDimension = VImageDimension>
176+
template <typename UPixelType, unsigned int VUImageDimension = VImageDimension>
177177
struct Rebind
178178
{
179-
using Type = itk::Image<UPixelType, NUImageDimension>;
179+
using Type = itk::Image<UPixelType, VUImageDimension>;
180180
};
181181

182182

183-
template <typename UPixelType, unsigned int NUImageDimension = VImageDimension>
184-
using RebindImageType = itk::Image<UPixelType, NUImageDimension>;
183+
template <typename UPixelType, unsigned int VUImageDimension = VImageDimension>
184+
using RebindImageType = itk::Image<UPixelType, VUImageDimension>;
185185

186186

187187
/** Allocate the image memory. The size of the image must

0 commit comments

Comments
 (0)