[Insight-users] neighborhood of a neighborhood

Joshua Cates cates at sci . utah . edu
Wed, 27 Aug 2003 15:38:25 -0600 (MDT)


Using Jim's code you could grab smallRegion with

outer_iter.GetBoundingBoxAsImageRegion();
  
Josh.

On Wed, 27 Aug 2003, Joshua Cates wrote:

> Depending on how large your larger neighborhood is, you might not want to
> pay the overhead of maintaining the outer neighborhood iterator.  In that 
> case just use a regular iterator to keep track of the index and redefine 
> smallRegion at each outer iteration.
> 
> Josh.
> 
> On Wed, 27 Aug 2003, Miller, James V (Research) wrote:
> 
> > This may be the same as Josh suggested:
> > 
> > The key here is that an iterator walks a prescribed region. So use two 
> > neighborhood iterators.  The first walks the full region of interest and 
> > has a large radius.  As the first iteration moves, you define a region off
> > this iterator (convert its location and radius to an start index and size 
> > for a region, start index = location - radius, size = 2*radius+1).  Define
> > a second iterator that walks this newly defined region.
> > 
> >     outer_iter = NeighborhoodIteratorType(largeRadius,
> >                                       this->GetInput(), largeRegion);
> >     while ( !outer_iter.IsAtEnd() )
> >       {
> >       // these next two lines probably won't compile, but you get the idea.
> >       smallRegion.SetIndex( outer_iter.GetLocation() - 2 * largeRadius );
> >       smallRegion.SetSize( 2 * largeRadius + 1 );
> > 
> > 	inner_iter = NeighborhoodIterator(smallRadius, this->GetInput(),
> > smallRegion);	 
> > 
> >       while ( !inner_iter.IsAtEnd() )
> >         {
> > 	  // do something
> > 
> >         ++inner_iter;
> >         }	    
> > 
> >       ++outer_iter;
> >       }
> > 
> > 
> > > -----Original Message-----
> > > From: Joshua Cates [mailto:cates at sci . utah . edu]
> > > Sent: Wednesday, August 27, 2003 1:21 PM
> > > To: John M. Galeotti
> > > Cc: insight-developers at itk . org; insight-users at itk . org
> > > Subject: Re: [Insight-users] neighborhood of a neighborhood
> > > 
> > > 
> > > Hi John
> > > 
> > > One way to do this would be to define a region R and a neighborhood 
> > > iterator N on R.  You would have to "manually" iterate R through the 
> > > image by incrementing its Index and modifying the Size.  You 
> > > could grab 
> > > the Index from a regular iterator moving through the image.
> > > 
> > > Josh.
> > > 
> > > On Tue, 26 Aug 2003, John M. Galeotti wrote:
> > > 
> > > > Is it possible to iterate a small neighborhood through a large 
> > > > neighborhood which is itself iterating through a much larger image?
> > > > 
> > > > John Galeotti
> > > > jgaleotti at cmu . edu
> > > > 
> > > > _______________________________________________
> > > > Insight-users mailing list
> > > > Insight-users at itk . org
> > > > http://www . itk . org/mailman/listinfo/insight-users
> > > > 
> > > 
> > > _______________________________________________
> > > Insight-users mailing list
> > > Insight-users at itk . org
> > > http://www . itk . org/mailman/listinfo/insight-users
> > > 
> > 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>