[ITK-users] [ITK] storing images in a list
Tim Allman
dr.tim.allman at gmail.com
Fri Jul 10 18:10:28 EDT 2015
By mistake I sent this to Emily personally and not to the list. So, list, here it is.
------------------------------------------------------------------------------------------------------
Emily,
You have not yet added anything to the list so the list is empty and the iterator begin() is the same as end(). There is nothing yet in the list for begin() to point to so you are trying to insert an image using an invalid iterator. If you were to do something like
lmImages.push_back(image);
I’m sure it would work.
--------------------------
Tim Allman Ph.D.
35 Margaret St.,
Guelph Ont.,
N1E 5R6
Canada
519-837-0276
On Jul 10, 2015, at 2:16 PM, Timothee Evain <tevain at telecom-paristech.fr> wrote:
> Hello Emily,
>
> With your example and a small png image, there nothing wrong for me, I'm able to compile and run without problems...
>
> Are you sure this is the crashing part ? Are you sure you've updated the reader ?
>
> Tim
>
>
>
> ----- Mail original -----
> De: "Emily M Hammond" <emily-hammond at uiowa.edu>
> À: "insight users" <insight-users at itk.org>
> Envoyé: Vendredi 10 Juillet 2015 17:52:25
> Objet: [ITK] [ITK-users] storing images in a list
>
> Hello,
>
> I am trying to store images in a list. Here is my code thus far.
>
> std::list< LabelImageType::Pointer > lmImages;
> std::list< LabelImageType::Pointer >::iterator it2 = lmImages.begin();
> LabelImageType::Pointer image = reader->GetOutput();
> std::cout << image << std::endl;
> lmImages.insert(it2, image);
>
> This code builds and complies, but I keep getting runtime errors when I try to insert image into the list.
>
> Is there something inherent to image that prevents this from happening or is there a better way to do this?
>
> Thanks!
> Emily Hammond
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150710/dfb8f6c6/attachment.html>
More information about the Insight-users
mailing list