Boost logo

Boost Users :

Subject: [Boost-users] multi_array and variants
From: Alle Meije Wink (a.m.wink_at_[hidden])
Date: 2010-11-08 11:20:41


Dear all,

This still seems to be a problem that every once in a while someone
tries to solve and then stops. It's my turn again...

I'm trying to make a wrapper template class for 1,2,...8-dimensional
images whose values can be char,short,...double to store brain image
statistics. I had a go at this before and followed the suggestions
described here

http://lists.boost.org/boost-users/2009/08/50732.php

What I now have is a class bisArray:
...
   template<typename T>
    class bisArray: public bisObject {
        typedef boost::variant
        < boost::multi_array_ref<T, 1>,
            boost::multi_array_ref<T, 2>,
            boost::multi_array_ref<T, 3>,
            boost::multi_array_ref<T, 4>,
            boost::multi_array_ref<T, 5>,
            boost::multi_array_ref<T, 6>,
            boost::multi_array_ref<T, 7>,
            boost::multi_array_ref<T, 8>,
            boost::multi_array_ref<T, 9>
> bisArray_t;
        bisArray_t _bisArray;
...

and a class bisImage, which has a bisArray as well as a pointer to the
data as read from file (1-dimensional structure):
...

    template<typename T>

    class bisImage: public bisObject {

    public:

        /** Constructor using existing array data
              Reformats array as bisImage
        */
        bisImage ( T* _data, size_t _dimensions, std::vector<size_t> _sizes ):
                data(_data), dimensions(_dimensions) {
            this.storage=bisArray<T>( _data, _dimensions, _sizes);
            this.dummy = T();
        }
...

When I try to initialise an image read from file using
...
   bisImage<unsigned char> newimage=bisImage<unsigned char> ((unsigned
char *)testimage->data, ndim, dims);
...

I get, as the first of many errors, this message
bisimage.hpp|33|error: no matching function for call to
‘canabis::bisArray<unsigned char>::bisArray()’|

That seems to suggest that I call an empty (default) constructor,
which I don't do *anywhere*
Has anyone ever tried to do something similar?

Or do you have any thought about what I am doing wrong here? Is it
multi_array complaining or variants?

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