[ITK] Problem using Size() and iterator with ImageToListSampleAdaptor

Paulo Guilherme Freire pauloguilhermefreire at gmail.com
Wed Aug 13 14:26:28 EDT 2014


Hello, Matt.

Thank you very much for your reply and for providing a patch. I'll review
it as soon as I can.

Best regards,
Paulo


On 13 August 2014 14:36, Matt McCormick <matt.mccormick at kitware.com> wrote:

> Hi,
>
> Yes, it is a bug.  Thank you for discussing the issue on the list and
> for including a buildable example that clearly illustrates the issue.
>
> Please review [1] this patch [2].
>
> Thanks,
> Matt
>
> [1]
> http://insightsoftwareconsortium.github.io/ITKBarCamp-doc/CommunitySoftwareProcess/PerformAGerritReview/index.html
>
> [2] http://review.source.kitware.com/#/c/16663/
>
> On Wed, Aug 13, 2014 at 12:39 PM, Bradley Lowekamp
> <blowekamp at mail.nih.gov> wrote:
> > Hello,
> >
> > This sounds like a bug to me. Have you tried using an itk::Image of
> FixedArray to see if the same thins occurs?
> >
> > Brad
> >
> > On Aug 12, 2014, at 2:22 PM, Paulo Guilherme Freire <
> pauloguilhermefreire at gmail.com> wrote:
> >
> >> Hello.
> >>
> >> I've been having some troubles to understand the use of Size() and
> iterator when dealing with ImageToListSampleAdaptor.
> >>
> >> Here's what I've been doing:
> >>
> >> 1) Read N images (usually N = 3) and store them in an itk::VectorImage
> container.
> >>
> >> 2) Set such itk::VectorImage as input for itk::ImageToListSampleAdaptor.
> >>
> >> 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.
> >>
> >> 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).
> >>
> >> My question is: shouldn't the number of iterations be the same
> (irregardless of whether I use an iterator or a for loop)?
> >>
> >> The code I've been using is attached to this email. I would really
> appreciate it if someone could help me solve this "mystery" :-)
> >>
> >> Best regards,
> >> Paulo
> >>
> >>
> >>
> <CMakeLists.txt><bipUtils.h><CmdLine.h><ListSampleImages.cxx>_______________________________________________
> >> Community mailing list
> >> Community at itk.org
> >> http://public.kitware.com/mailman/listinfo/community
> >
> > _______________________________________________
> > Community mailing list
> > Community at itk.org
> > http://public.kitware.com/mailman/listinfo/community
>



-- 
Paulo Guilherme de Lima Freire
Bacharelado em Ciência da Computação 010
Universidade Federal de São Carlos - UFSCar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140813/cd858576/attachment-0002.html>


More information about the Community mailing list