[Insight-developers] RE: ShapedNeighborhoodIterators

Miller, James V (Research) millerjv at crd . ge . com
Tue, 27 May 2003 15:42:31 -0400


Josh,

First problem encountered using the ShapedIterators. I cannot do a 

ConstShapedNeighbhorhoodIterator nIt;

I get a compiler error for operator=() saying that "A reference that is not
to 'const' cannot be bound to a non-lvalue".  This is with VC .NET.  

c:\projects\I2\Insight\Code\Common\itkConstShapedNeighborhoodIterator.h(232)
: error C2440: 'return' : cannot convert from
'itk::NeighborhoodIterator<TImage,TBoundaryCondition>::Self' to
'itk::ConstShapedNeighborhoodIterator<TImage,TBoundaryCondition>::Self &'
        with
        [
            TImage=InputImageType,
 
TBoundaryCondition=itk::ZeroFluxNeumannBoundaryCondition<InputImageType>
        ]
        and
        [
            TImage=InputImageType,
 
TBoundaryCondition=itk::ZeroFluxNeumannBoundaryCondition<InputImageType>
        ]
        A reference that is not to 'const' cannot be bound to a non-lvalue
 
c:\projects\I2\Insight\Code\Common\itkConstShapedNeighborhoodIterator.h(232)
: while compiling class-template member function
'itk::ConstShapedNeighborhoodIterator<TImage,TBoundaryCondition>::Self
&itk::ConstShapedNeighborhoodIterator<TImage,TBoundaryCondition>::operator
=(const
itk::ConstShapedNeighborhoodIterator<TImage,TBoundaryCondition>::Self &)'
        with
        [
            TImage=InputImageType,
 
TBoundaryCondition=itk::ZeroFluxNeumannBoundaryCondition<InputImageType>
        ]
 
c:\projects\I2\Insight\Code\BasicFilters\itkGrayscaleGeodesicErodeImageFilte
r.txx(289) : see reference to class template instantiation
'itk::ConstShapedNeighborhoodIterator<TImage,TBoundaryCondition>' being
compiled
        with
        [
            TImage=InputImageType,
 
TBoundaryCondition=itk::ZeroFluxNeumannBoundaryCondition<InputImageType>
        ]
        C:\Program Files\Microsoft Visual Studio
.NET\Vc7\include\xmemory(136) : while compiling class-template member
function 'void
itk::GrayscaleGeodesicErodeImageFilter<TInputImage,TOutputImage>::ThreadedGe
nerateData(const
itk::GrayscaleGeodesicErodeImageFilter<TInputImage,TOutputImage>::OutputImag
eRegionType &,int)'
        with
        [
            TInputImage=InputImageType,
            TOutputImage=OutputImageType
        ]
 
\projects\I2\Insight\Examples\Filtering\GrayscaleGeodesicErosion.cxx(116) :
see reference to class template instantiation
'itk::GrayscaleGeodesicErodeImageFilter<TInputImage,TOutputImage>' being
compiled
        with
        [
            TInputImage=InputImageType,
            TOutputImage=OutputImageType
        ]

-----Original Message-----
From: Joshua Cates [mailto:cates at sci . utah . edu]
Sent: Tuesday, May 27, 2003 12:24 PM
To: Miller, James V (Research)
Cc: Insight-developers (E-mail)
Subject: Re: ShapedNeighborhoodIterators


Hi Jim,

Yes, the best options are GetNext/Previous and the shaped iterator.  In 
theory the shaped iterator should be faster.  The trade-off is a more 
limited API for accessing and setting pixels, which could make your code a 
little uglier.

Currently you will have to manually activate the face connected neighbors
and the center pixel.  Probably we should set up an 
ActivateFaceConnectedNeighbors() method since this is likely a common 
case.

Let me know if you have problems/suggestions as so far I have not made 
very extensive use of the shaped iterators.

Josh.


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


On Tue, 27 May 2003, Miller, James V (Research) wrote:

> Josh,
>  
> What is the recommended way to access the face connected neighbors of a
> pixel using the NeighborhoodIterators? The options seem to be
> NeighborhoodIterator:GetNext()/GetPrevious() and setting up a
> ShapedNeighborhoodIterator.
>  
> The ShapedNeighborhoodIterator "should" be faster when moving the iterator
> since it only updates a few of the pointers.  But are there convenience
> methods for activating the face connected neighbors (and the center pixel)
> of an iterator? Or do I need to call ActivateOffset() manually for each
face
> connected pixel?
>  
> Jim
>  
>  
> 
> Jim Miller 
> _____________________________________
> Visualization & Computer Vision
> GE Research
> Bldg. KW, Room C218B
> P.O. Box 8, Schenectady NY 12301
> 
> millerjv at research . ge . com <mailto:millerjv at research . ge . com> 
> 
> james . miller at research . ge . com
> (518) 387-4005, Dial Comm: 8*833-4005, 
> Cell: (518) 505-7065, Fax: (518) 387-6981 
> 
>  
>