@phcerdan Thanks for your feedback. First of all, the change that I have in mind with WIP: Added class to create offsets for a hyperrectangular neighborhood shape keeps the interface of ShapedImageNeighborhoodRange
as it is. In my opinion, the neighborhood range class should definitely keep allowing users to specify the shape by passing a pointer to a contiguous sequence of itk::Offset
objects.
But I do think it could be useful for various shapes to offer all these three function: CalculateNumberOfOffsets()
, FillOffsets(offsets, numberOfOffsets)
, and GenerateOffsets()
. In that case, I think it would be nice to have these three functions grouped together in a class, specific for that shape.
The size of the neighborhood is not always not always known at compile time. Certainly not for GaussianDerivativeImageFunction
! (If you want to know the details: For this class, the neighborhood size depends on member variables m_Sigma and m_Extent.) As a rule of thumb, you might consider: use std::array<OffsetType, N>
when the size is known at compile time, otherwise use std::vector<OffsetType>
.
Good question! Yes, I would like CalculateNumberOfOffsets()
to be constexpr. Iām pretty sure itās possible in C++14. For C++11, Iād have to tryā¦ Please let me know if you already have it working, for the hyperrectangular case!
Could these also be implemented in a less āhard-codedā way? Possibly parameterized by their size?
Anyway, if there are no other shapes of interest to ITK users that could be implemented by the class design that I proposed at http://review.source.kitware.com/#/c/23389/ itās probably less useful than I thought