|
Boost Users : |
Subject: Re: [Boost-users] extents
From: Alle Meije Wink (a.m.wink_at_[hidden])
Date: 2010-10-25 06:09:21
Hi,
Maybe sending such a vague email just before the weekend was not such
a good idea.
What I would like to know is: is it possible to store the extents of a
multi_array in a variable?
so instead of doing
ma = multi_array_ref < int, 3 > ( datapointer, extents[10][10][10] );
is it possible to
ex = extents[10][10][10];
ma = multi_array_ref <int, 3 > (datapointer, ex );
to be able to support different extents (dimensionalities)?
What would be the type of ex in this case?
Thanks,
Alle Meije Wink
On 22 October 2010 16:54, Alle Meije Wink <a.m.wink_at_[hidden]> wrote:
> Dear all,
>
> I am trying to load data from a file, where they are (obviously)
> stored as a 1D contiguous block, to a N-dimensional array.
>
> For the type of files I use N could be 1 through 8. I have code to for
> a 1..8-dimensional container (as a class template), but how to load in
> the data from the file?
>
> The multi_array_ref way to do it looked ideal, eg for a 3D float-image
> something like
> im = image_ref< float, 2 >( image->data, boost::extents[512][512] )
> might work.
>
> But to code the different dimensionalities in a neat way would mean to
> store the extents in a variable (or something), like
>
> boost_extents_type e;
> switch ndim { // ndim=dim[0]
> 1:
> int dim1=dim[1];
> e=boost::extents[dim1];
> break;
> 2:
> int dim1=dim[1],dim2=dim[2];
> e=boost::extents[dim1][dim2];
> //etc
> }
>
> Is something like this possible with extents?
>
> Many thanks,
> Alle Meije
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net