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
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
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
participants (1)
-
Alle Meije Wink