[Insight-users] FiniteDifferenceFunction

Joshua Cates cates@sci.utah.edu
Wed, 18 Dec 2002 11:50:14 -0700 (MST)


Hi Mark (and all users and developers)

The changes to the FiniteDifferenceFunction were due to changes made to 
the NeighborhoodIterator class.   Previously, there were two signatures 
for ComputeUpdate, one which took a SmartNeighborhoodIterator and one 
which took a NeighborhoodIterator.  SmartNeighborhoodIterators were 
designed to automatically handle boundary conditions, i.e. if an algorithm 
asked the iterator for a pixel value outside the image, the iterator would 
calculate an appropriate value to return.

All of this boundary handling functionality has now been moved to the
NeighborhoodIterator class, so there is usually no need for a second
function.  In almost all cases in the toolkit, the only difference in the
two ComputeUpdate methods was the type of the iterator used.  The change
was made to the neighborhood iterators in part to eliminate the
maintainence of this redundant code.

Note that the speed advantage of separate processing for boundary and
non-boundary regions is still present.  This is because a
NeighborhoodIterator will turn its bounds checking on or off depending on
the region over which it was initialized.  If you make sure to process
boundary and non-boundary regions using several different iterators, then
processing speed should not suffer.  If you initialize a single
neighborhood iterator over the entire image, then processing will be slow
because bounds checking will always take place.

The lack of a second ComputeUpdate method should only be a problem if your 
algorithm is truly different for pixels at the image boundary.  In this 
case, you can use the globalData parameter to pass the method a flag to 
indicate bounds or non bounds processing. 

Let me know if there are other problems or questions about this change.

Thanks,

Josh.

______________________________
 Josh Cates			
 School of Computer Science	
 University of Utah
 Email: cates@sci.utah.edu
 Phone: (801) 587-7697
 URL:   http://www.sci.utah.edu/~cates


On Wed, 18 Dec 2002, Mark Hastenteufel wrote:

> Hallo!
> 
> 
> I'm wondering about the changes made in the FinitieDifferenceFunction ,
> in itk 1.0 there are two ComputeUpdate methods
> 
>  virtual PixelType  ComputeUpdate (const NeighborhoodType &neighborhood,
> void *globalData, const FloatOffsetType &offset=m_ZeroOffset) const=0
>  virtual PixelType  ComputeUpdate (const BoundaryNeighborhoodType
> &neighborhood, void *globalData, const FloatOffsetType
> &offset=m_ZeroOffset) const=0
> 
> 
> in the current cvs checkout there is is just one ComputeUpdate method
> 
> virtual PixelType ComputeUpdate (const NeighborhoodType &neighborhood,
> void *globalData, const FloatOffsetType &offset=FloatOffsetType(0.0))
> const=0
> 
> 
> 
> What about the boundary handling in the current version?
> 
> 
> Thanks,
> 
> Mark
> 
> 
> 
> -- 
> Mark Hastenteufel
> Deutsches Krebsforschungszentrum         (German Cancer Research Center)
> Div. Medical and Biological Informatics H0100    Tel: (+49) 6221-42 2353
> Im Neuenheimer Feld 280                          Fax: (+49) 6221-42 2345
> D-69120 Heidelberg              e-mail            M.Hastenteufel@DKFZ.de
> Germany                         http://www.dkfz.de/mbi/people/markh.html
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>