[Insight-users] Iterator method problem

Luis Ibanez luis.ibanez at kitware.com
Fri May 12 15:37:44 EDT 2006


Hi Kathy,

Please read the ITK Software Giude,


    http://www.itk.org/ItkSoftwareGuide.pdf


In particular the chapter on Image Iterators.

You define the initial position of the iterator by setting the Index
of the iterator region.

like


   ImageType::IndexType  start;
   ImageType::SizeType   size;

   start[0] = 34;
   start[0] = 25;

   size[0] = 100;
   size[1] = 200;

   ImageType::RegionType region;

   region.SetSize( size );
   region.SetIndex( start );

   IteratorType  itr( image, region );

   itr.GoToBegin();

   while( !itr.IsAtEnd() )
     {

     ++itr;
     }




Note that if you are iterating over two images you need
also *two* separate iterators.



   Regards,



       Luis


===============================
smythek at u.washington.edu wrote:
> Hi ITK,
> 
> I've created an ImageRegionIteratorWithIndex iterator called outputIt2 
> and want to iterate an entire image into one area of another image.  
> That means I need to set the iterator's starting position and region 
> size.  I set the size all right, but I can't set the starting position 
> to where I want it to start writing in the large image.  I've tried 
> outputIt2.SetPosition, outputIt2.SetIndex, and outputIt2.Begin, but all 
> of these methods are "not members" according to the error.  When I just 
> type outputIt2.  and wait for the tooltip to appear, none of these 
> methods appear.  So how does one set an iterator's starting position?
> 
> Kathy
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 




More information about the Insight-users mailing list