# A shape class for ShapedImageNeighborhoodRange and ShapedNeighborhoodIterator

**URL:** https://discourse.itk.org/t/a-shape-class-for-shapedimageneighborhoodrange-and-shapedneighborhooditerator/924
**Category:** Engineering
**Created:** [May 11, 2018, 4:03pm UTC](https://discourse.itk.org/t/a-shape-class-for-shapedimageneighborhoodrange-and-shapedneighborhooditerator/924 "2018-05-11T16:03:14Z")
**Posts on this page:** 3
**Page:** 2

<div class="post-metadata">

### Author: ![Niels\_Dekker](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/9d8465/32.png) [@Niels\_Dekker](https://discourse.itk.org/u/Niels_Dekker)
#### Post date: [October 7, 2018, 11:26am UTC](https://discourse.itk.org/t/a-shape-class-for-shapedimageneighborhoodrange-and-shapedneighborhooditerator/924/21 "2018-10-07T11:26:33Z")

</div>

@phcerdan Would it be OK to you if the identifiers [HyperrectangularImageNeighborhoodShape](https://itk.org/Doxygen/html/classitk_1_1Experimental_1_1HyperrectangularImageNeighborhoodShape.html) and [GenerateHyperrectangularImageNeighborhoodOffsets](https://itk.org/Doxygen/html/namespaceitk_1_1Experimental.html#acff402c520d4a2df3dd5372c27633250) would be renamed to `RectangularImageNeighborhoodShape` and `GenerateRectangularImageNeighborhoodOffsets`, respectively?

I remember you suggested the term _hyperrectangular_:

> [@itk::NeighborhoodRange: a new class for efficient modern C++ style iteration](https://discourse.itk.org/t/itk-neighborhoodrange-a-new-class-for-efficient-modern-c-style-iteration/833/11):
>
> NeighborhoodOffsets.h sounds good to me!. The name GenerateOffsetsForRectangularNeighborhood, might be misleading, because the offsets could be Cubic if Size is 3D. Or lines if Size\<1\>. I would recommend the more formal GenerateHyperRectangleOffsets, or GenerateNRectangleOffsets? GenerateNCrossOffsets(radius), for one pixel wide Greek cross (+), with the lengths of the cross taken from radius? I would put there: Generate3D26TopologyOffsets, equivalent to GenerateOffsetsForRectangularNeighb…

[Wikipedia](https://en.wikipedia.org/wiki/Hyperrectangle) explained to me that the term _hyperrectangle_ is a “generalization of a rectangle for higher dimensions”.

Personally I feel that the “hyper” adjective is not _really_ necessary, as the template argument `VImageDimension` already indicates that the rectangle may be generalized for higher dimensionalities.

Note that `itk::Image<TPixel, VImageDimension>` also supports dimensionalities higher than 2 (even though the ITK image class has not been named something like _itk::Hyperimage\<THyperpixel, VImageDimension\>_).

Note also that this shape class supports 1-D as well. Would that be a _hypo_ rectangular shape?

So please tell me, what do you think by now?

---

<div class="post-metadata">

### Author: ![phcerdan](https://discourse.itk.org/user_avatar/discourse.itk.org/phcerdan/32/286_2.png) [@phcerdan](https://discourse.itk.org/u/phcerdan)
#### Post date: [October 7, 2018, 3:52pm UTC](https://discourse.itk.org/t/a-shape-class-for-shapedimageneighborhoodrange-and-shapedneighborhooditerator/924/22 "2018-10-07T15:52:18Z")

</div>

Hi @Niels_Dekker, it would be definitively ok for me. NRectangle, or HyperRectangle might be more explicit, but as you mentioned, if the image dimension is a required template parameter, that can be inferred. I would just recommend to avoid the temptation of providing a default template parameter (= 2) for `ImageDimension` because the name (which I am sure is not in your plans).

---

<div class="post-metadata">

### Author: ![Niels\_Dekker](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/9d8465/32.png) [@Niels\_Dekker](https://discourse.itk.org/u/Niels_Dekker)
#### Post date: [October 7, 2018, 6:48pm UTC](https://discourse.itk.org/t/a-shape-class-for-shapedimageneighborhoodrange-and-shapedneighborhooditerator/924/23 "2018-10-07T18:48:28Z")

</div>

> [@phcerdan](#):
>
> Hi @Niels_Dekker, it would be definitively ok for me. NRectangle, or HyperRectangle might be more explicit, but as you mentioned, if the image dimension is a required template parameter, that can be inferred.

Thanks, @phcerdan! I realize it’s very much a subjective issue. And it’s not a _big_ issue to me. But anyway, please check my proposed patch: [STYLE: Replaced “Hyperrect…” by “Rect…” in class + function names](http://review.source.kitware.com/#/c/23787)

P.S. I swear, I did not add a default template parameter 😃

[Previous page](https://discourse.itk.org/t/a-shape-class-for-shapedimageneighborhoodrange-and-shapedneighborhooditerator/924.md?page=1)
