load fits images to equiv. data type
so we have better support for bzero / bscale
This commit is contained in:
parent
3a48ff9cc1
commit
a0b8bac8f2
@ -23,6 +23,9 @@
|
|||||||
* - redo as a set of fns ready for wrapping in a new-style class
|
* - redo as a set of fns ready for wrapping in a new-style class
|
||||||
* 23/6/13
|
* 23/6/13
|
||||||
* - fix ushort save with values >32k, thanks weaverwb
|
* - fix ushort save with values >32k, thanks weaverwb
|
||||||
|
* 4/1/17
|
||||||
|
* - load to equivalent data type, not raw image data type ... improves
|
||||||
|
* support for BSCALE / BZERO settings
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -119,7 +122,7 @@ typedef struct {
|
|||||||
VipsPel *buffer;
|
VipsPel *buffer;
|
||||||
} VipsFits;
|
} VipsFits;
|
||||||
|
|
||||||
const char *vips__fits_suffs[] = { ".fits", NULL };
|
const char *vips__fits_suffs[] = { ".fits", ".fit", NULL };
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vips_fits_error( int status )
|
vips_fits_error( int status )
|
||||||
@ -219,10 +222,21 @@ vips_fits_get_header( VipsFits *fits, VipsImage *out )
|
|||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* cfitsio does automatic conversion from the format stored in
|
||||||
|
* the file to the equivalent type after scale/offset. We need
|
||||||
|
* to allocate a vips image of the equivalent type, not the original
|
||||||
|
* type.
|
||||||
|
*/
|
||||||
|
if( fits_get_img_equivtype( fits->fptr, &bitpix, &status ) ) {
|
||||||
|
vips_fits_error( status );
|
||||||
|
return( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef VIPS_DEBUG
|
#ifdef VIPS_DEBUG
|
||||||
VIPS_DEBUG_MSG( "naxis = %d\n", fits->naxis );
|
VIPS_DEBUG_MSG( "naxis = %d\n", fits->naxis );
|
||||||
for( i = 0; i < fits->naxis; i++ )
|
for( i = 0; i < fits->naxis; i++ )
|
||||||
VIPS_DEBUG_MSG( "%d) %lld\n", i, fits->naxes[i] );
|
VIPS_DEBUG_MSG( "%d) %lld\n", i, fits->naxes[i] );
|
||||||
|
VIPS_DEBUG_MSG( "fits2vips: bitpix = %d\n", bitpix );
|
||||||
#endif /*VIPS_DEBUG*/
|
#endif /*VIPS_DEBUG*/
|
||||||
|
|
||||||
height = 1;
|
height = 1;
|
||||||
@ -266,8 +280,8 @@ vips_fits_get_header( VipsFits *fits, VipsImage *out )
|
|||||||
if( fits->band_select != -1 )
|
if( fits->band_select != -1 )
|
||||||
bands = 1;
|
bands = 1;
|
||||||
|
|
||||||
/* Get image format. We want the 'raw' format of the image, our caller
|
/* Get image format. This is the equivalent format, or the format
|
||||||
* can convert using the meta info if they want.
|
* stored in the file.
|
||||||
*/
|
*/
|
||||||
for( i = 0; i < VIPS_NUMBER( fits2vips_formats ); i++ )
|
for( i = 0; i < VIPS_NUMBER( fits2vips_formats ); i++ )
|
||||||
if( fits2vips_formats[i][0] == bitpix )
|
if( fits2vips_formats[i][0] == bitpix )
|
||||||
|
Loading…
Reference in New Issue
Block a user