Is there an example of how to use a PeriodicBoundaryCondition anywhere?
I had hoped it was as simple as changing the definition of my NeighborhoodIterator to ConstNeighborhoodIterator<TImage, PeriodicBoundaryCondition<TImage, TImage>>;, however, this is causing a segmentation fault at line 57 of itkPeriodicBoundaryCondition.h, and the call to GetImagePointer is hitting a null pointer (which makes no sense to me). If I remove the template parameter so the default constant flux boundary condition is used, the code runs fine.
Thanks for finding the bug. How detailed should code reviews like this be? The change looks good to me, but would you prefer that I check out that gerrit branch and confirm my own program works?
The only comment I really have is that it would be good to add an example to the docs for PeriodicBoundaryCondition, as I don’t think it’s intuitive to have to use OverrideBoundaryCondition. I’m happy for the above code to be used if necessary. What’s the best way to get that added to the docs?
It represents the default boundary condition that the neighborhood iterator is constructed ( and can be reset to ), and not the only boundary condition that can be used. The boundary condition can set at runtime via the OverrideBoundaryCondition method to another boundary type. This makes the class have a rather ugly mix of runtime, and compile time specification of the boundary condition. We MUST consider both of these use cases!