[Insight-developers] ConstShapedNeighborhoodIterator inheritance

Joshua Cates cates at sci.utah.edu
Mon Oct 10 12:24:35 EDT 2005


Hi,

The problem is that the ShapedNeighborhoodIterator does not maintain a 
pointer to a center pixel, so in the general case it is dangerous to 
expose this method.  If you need to access the center pixel, you can 
include it in the neighborhood mask when you construct the iterator.  Of 
course, that requires that your application know which of the locations 
in the neighborhood is the center pixel.

Josh.

Gaetan Lehmann wrote:
> On Mon, 10 Oct 2005 00:39:37 +0200, Joshua Cates <cates at sci.utah.edu>  
> wrote:
> 
>> Hi Gaetan,
>>
>> Superclass members are private where they don't make sense in the  
>> context of a neighborhood of arbitrary shape.  There is no guarantee,  
>> for example, that a ShapedNeighborhood has a center pixel.
> 
> 
> Are you sure it don't make sense to access the value of the center 
> pixel,  even if it is not in the neighborhood ?
> There is lots of case where it make sense: Every time you need to look 
> at  the neighbors values to set the center pixel value, or everytime you 
> need  to compare the center pixel value and the neighbor value to set 
> the values  of the neighbors.
> I have already used 5 iterators (!) only for the flooding part of a  
> morphological watershed, if the Set/GetCenterPixel() methods are not  
> available, I'll have to use 2 more iterators...
> 
> Gaetan
> 
>>
>> Josh.
>>
>>
>> On Oct 9, 2005, at 2:10 PM, Gaetan Lehmann wrote:
>>
>>>
>>> Hi,
>>>
>>> ConstShapedNeighborhoodIterator is a subclass of 
>>> NeighborhoodIterator.  Sadely,
>>> all members of the superclass are private:
>>>
>>> class ITK_EXPORT ConstShapedNeighborhoodIterator
>>>   :  private NeighborhoodIterator<TImage, TBoundaryCondition>
>>>
>>> It prevent usage of Set/GetCenterPixel() methods, which  is really  
>>> annoying.
>>> Is there a good reason to do that ?
>>> Is it possible to switch to a public inheritance ?
>>>
>>> class ITK_EXPORT ConstShapedNeighborhoodIterator
>>>   :  public NeighborhoodIterator<TImage, TBoundaryCondition>
>>>
>>> Thanks,
>>>
>>> Gaetan
>>> _______________________________________________
>>> Insight-developers mailing list
>>> Insight-developers at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-developers
>>
>>
> 
> 
> 


More information about the Insight-developers mailing list