[Insight-users] Specifying boundary modes

Luis Ibanez luis.ibanez at kitware.com
Tue, 10 Feb 2004 14:20:43 -0500


Hi Benjamin,

Filters based on neighborhood operators use a boundary
condition class internally.

For the example that you mention, the MeanImageFilter,
http://www.itk.org/Insight/Doxygen/html/classitk_1_1MeanImageFilter.html
the boundary condition is the

ZeroFluxNeumannBoundaryCondition<InputImageType> nbc;


You will find this in


   Insight/Code/BasicFilters/
                 itkMeanImageFilter.txx

on lines 99 and 128.

Since the boundary condition is constructed one per
thread, probably the only option in this case will
be to add the boundary condition as a third template
parameter to this filter, so you could select the
boundary condition at the moment you instantiate the
filter type.


It will potentially look like

typedef itk::ZeroFluxNeumannBoundaryCondition<
                             ImageType > BoundaryType;

typedef itk::MeanImageFilter< ImageType,
                               ImageType,
                               BoundaryType > FilterType;


That will be fine for C++, but may raise some concerns
for python, tcl and java wrapping.


Other boundary conditions available in ITK are

http://www.itk.org/Insight/Doxygen/html/classitk_1_1ConstantBoundaryCondition.html
http://www.itk.org/Insight/Doxygen/html/classitk_1_1PeriodicBoundaryCondition.html
http://www.itk.org/Insight/Doxygen/html/classitk_1_1ZeroFluxNeumannBoundaryCondition.html

You could add new boundary conditions of your
choice by following these classes as examples.


You may want to experiment by adding the boundary
condition as a third template parameter of the
MeanImageFilter and see how this behaves. If you
find that useful, please let us know so we explore
the options of adding this to the toolkit.



    Thanks,


      Luis



-----------------------
Benjamin King wrote:

> Hello,
> 
> when I use a MeanImageFilter or another filter that operates on a 
> neighborhood, it has to use some boundary conditions like 'pad with 0', 
> 'mirror image', 'wrap image', 'repeat slice' or something like that. Can 
> I configure that or is the behavior wired into the specific filter?
> 
> cheers,
>    Benjamin
>