[Insight-users] itk::Array

kumar MaKumartr@netscape.net
Wed, 29 Jan 2003 16:42:09 -0100


Hi Luis
Thanks for the comments,

I am forced to use itk::Array due to its advantages of dynamic construction
The memory allocation part is fine and I follow the same

But what is puzzling me is when the memory allocation is done
dont  the array values get initialized to some value, say zero

Or is it that one  has to do  initialize the array values for each array 
one creates

Thanks and Regards
Kumar


Luis Ibanez wrote:

>
>
> Hi Kumar,
>
>
> itk::Array is a dynamic array.
> It derives from the vnl_vector<>.
>
> This class requires initialization for
> its size and memory allocation.
>
> If you have a constant number of elements
> you may want to consider using itk::FixedArray
> instead.
>
> itk::Array can be initialized by giving a size
> argument to the constructor, like
>
>        itk::Array<double>   A( 100 );
>
> or by assignment from another array, like
>
>        itk::Array<double>   B;
>
>        B = A;
>
> This is as far as memory allocation goes.
> Now, for initializing the array values, you
> may use the Fill() method.  Like
>
>
>       B.Fill(  0.0  );
>
> or more generic-programming-like:
>
>
>   B.Fill( itk::NumericTraits<double>::Zero );
>
>
>
> Please let us know if you have further questions,
>
>
> Thanks
>
>
> Luis
>
>
>
>