Hi,
changing from void to gsl_vector in the fitsio.h is not a good idea.
The fitsio lib uses the the same function for all datatypes. Therefore
you have to provide the correct datatype when calling the function
(using the ...,int datatype,... field). Your gsl_vector is of type
double, so you have to use the cfitsio typedef 'TDOUBLE' - which is
correct in your example. If the datatype within the fits-file is of
different type cfitsio will do a conversion for you. In order to reach
that level of re-usability fitsio does a type conversion from the
input void-array to the desired double/float/int/...-array.
However, the problem with your example is much simpler. Since you did
input the gslvector as a whole, fitsio just write (after casting to
double) the data to the beginning of the allocated memory which
happens to be misaligned from the data-array within the struct:
typedef struct
{
size_t size;
size_t stride;
double * data;
gsl_block * block;
int owner;
} gsl_vector;
So if you change the function call to
fits_read_subset( data , TDOUBLE , fpixel , lpixel , inc , &nulval ,
image->data , &anynul , &status );
it works! (I tested it.) You should be careful by plugging in
gsl-vector into fitsio-routines. If the gslvector has a stride or is a
view to another vector/matrix you can easily get into trouble.
Hope that helps...
Cheers
Benjamin