-
-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the index type of VectorContainer itk::SizeValueType
by default
#4856
base: master
Are you sure you want to change the base?
Make the index type of VectorContainer itk::SizeValueType
by default
#4856
Conversation
By default, assume `ElementIdentifier = SizeValueType`, for an `itk::VectorContainer<ElementType>`. Conceptually like: template <typename TElementIdentifier = SizeValueType, typename TElement> class VectorContainer;
The index type (`ElementIdentifier`) of `itk::VectorContainer` is already `itk::SizeValueType` by default.
The index type (`ElementIdentifier`) of `itk::VectorContainer` is already `itk::SizeValueType` by default, and `itk::IdentifierType` is just an alias of `itk::SizeValueType`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good.
itkLegacyMacro(ArrayType GetRadius() const) { return this->GetRadiusInObjectSpace(); } | ||
|
||
itkLegacyMacro(void SetRadiiInObjectSpace(ArrayType radii)) { this->SetRadiusInObjectSpace(radii); } | ||
itkLegacyMacro(void SetRadius(double radius)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This set of changes seems unrelated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Honestly I have no idea why clang-format decided to make those unrelated changes 🤷
@@ -96,7 +96,10 @@ class ITK_TEMPLATE_EXPORT MeshSpatialObject : public SpatialObject<TMesh::PointD | |||
|
|||
#if !defined(ITK_LEGACY_REMOVE) | |||
/** \deprecated Return the type of pixel used */ | |||
itkLegacyMacro(const char * GetPixelTypeName()) { return m_PixelType.c_str(); } | |||
itkLegacyMacro(const char * GetPixelTypeName()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated. Preferably group with the other into a separate commit.
@@ -85,7 +85,10 @@ class ITK_TEMPLATE_EXPORT TubeSpatialObject : public PointBasedSpatialObject<TDi | |||
|
|||
#if !defined(ITK_LEGACY_REMOVE) | |||
/** Compute the tangents and normals of the centerline of the tube. */ | |||
itkLegacyMacro(bool ComputeTangentAndNormals()) { return ComputeTangentsAndNormals(); } | |||
itkLegacyMacro(bool ComputeTangentAndNormals()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another unrelated change.
template <typename TElementIdentifier, typename TElement> | ||
template <typename T1, typename T2 = void> | ||
class ITK_TEMPLATE_EXPORT VectorContainer | ||
: public Object | ||
, private std::vector<TElement> | ||
, private std::vector<std::conditional_t<std::is_void_v<T2>, T1, T2>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this "trick" does not work as smoothly as I was hoping for.... The compiler still considers VectorContainer<ElementType>
and VectorContainer<SizeValueType, ElementType>
to be different types. Which disallows interchanging one with the other. (For example, assigning a pointer to another.) Not really convenient 🤔
For most use cases, it appears that the index type of
itk::VectorContainer
should just beitk::SizeValueType
(oritk::IdentifierType
, but that's just an alias ofitk::SizeValueType
).This pull request allows users to write
itk::VectorContainer<ElementType>
as a shorthand foritk::VectorContainer<itk::SizeValueType, ElementType>
.