<div dir="ltr"><div>Hello.</div><div><br></div><div>I've been having some troubles to understand the use of Size() and iterator when dealing with ImageToListSampleAdaptor.</div><div><br></div><div>Here's what I've been doing:</div>
<div><br></div><div>1) Read N images (usually N = 3) and store them in an itk::VectorImage container.</div><div><br></div><div>2) Set such itk::VectorImage as input for itk::ImageToListSampleAdaptor.</div><div><br></div><div>
3) Iterate over the list using a for loop (using the Size() method from the ListSample) and an iterator; in both cases, count how many times the loop was executed.</div><div><br></div><div>Here is my problem: when I iterate over the list using Size() I get a different value of iterations than when I use an iterator. For example, suppose I read three 3D (256 x 256 x 256) images. When I count the number of iterations using an iterator (say, ListSampleType::Iterator), I get 16777216 (which is precisely 256 times 256 times 256). However, when I count the number of iterations using a for loop (for(unsigned int = 0; i < ListSample->Size(); ++i)), I get 50331648 (which is precisely the result of 16777216 times 3). </div>
<div><br></div><div>My question is: shouldn't the number of iterations be the same (irregardless of whether I use an iterator or a for loop)?</div><div><br></div><div>The code I've been using is attached to this email. I would really appreciate it if someone could help me solve this "mystery" :-)</div>
<div><br></div><div>Best regards,</div><div>Paulo</div><div><br></div><br>
</div>