[ITK] [ITK-users] How do I create ITK images inside a loop?

Matt McCormick matt.mccormick at kitware.com
Fri Apr 17 16:06:22 EDT 2015


Hi Pol,

Yes, this should work fine.

The default constructor sets the pointer to NULL by default.

Matt

On Fri, Apr 17, 2015 at 9:59 AM, Pol Monsó Purtí <lluna.nova at gmail.com> wrote:
> Nevermind,
>
> std::vector< typename GradientImageType::Pointer > gradients(dims);
>
> for(unsigned int dim = 0; dim < dims; dim++) {
>
>     typename GradientImageType::Pointer gradient = GradientImageType::New();
>
>     gradient->SetRegions(roi);
>
>     gradient->Allocate();
>
>     gradients[dim] = gradient;
>
> }
>
>
> It will use the default constructor, thought.
>
> 2015-04-17 12:52 GMT+02:00 Pol Monsó Purtí <lluna.nova at gmail.com>:
>>
>> Hello all,
>>
>> How can I create n images inside a for loop? The smart pointer would go
>> out of scope. How could I use a container?
>>
>> Cheers,
>>
>> Pol
>
>
>
> _____________________________________
> 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
>
_____________________________________
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


More information about the Community mailing list