[Insight-users] Iterator method problem

smythek at u.washington.edu smythek at u.washington.edu
Fri May 12 15:57:02 EDT 2006


Hi Luis,

The documentation doesn't explain this very well. I have two iterators; the first one works fine (since I start in the corner of the big image anyway).  For the second iterator, I have defined at START and SIZE but the output of the iterator STARTS at the correct start position but then continues moving right until it hits the region boundary and then does not return to the start position's next line, but rather back to the beginning of the region boundary, like so:

|                       |
|                       |
|        <start>->->->->|
|->->...                |
|        <end>          |
|                       |

when I want


|                       |
|                       |
|        <start>->->->->|
|        ->->...        |
|        ->->...   <end>|
|                       |

Kathy

> 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