skip non-image HDUs at start of fits
some fits images have header units (HDUs) at the start with extra metadata in ... skip over these see https://github.com/jcupitt/libvips/issues/640
This commit is contained in:
parent
4094070ecb
commit
4f3364a2b0
@ -1,4 +1,5 @@
|
|||||||
15/4/17 started 8.6.0
|
15/4/17 started 8.6.0
|
||||||
|
- supports fits images with leading non-image HDUs, thanks benepo
|
||||||
|
|
||||||
7/4/17 started 8.5.3
|
7/4/17 started 8.5.3
|
||||||
- more link fixing in docs
|
- more link fixing in docs
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
* 26/1/17 aferrero2707
|
* 26/1/17 aferrero2707
|
||||||
* - use fits_open_diskfile(), not fits_open_file() ... we don't want the
|
* - use fits_open_diskfile(), not fits_open_file() ... we don't want the
|
||||||
* extended filename syntax
|
* extended filename syntax
|
||||||
|
* 15/4/17
|
||||||
|
* - skip HDUs with zero dimensions, thanks benepo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -221,10 +223,25 @@ vips_fits_get_header( VipsFits *fits, VipsImage *out )
|
|||||||
|
|
||||||
status = 0;
|
status = 0;
|
||||||
|
|
||||||
if( fits_get_img_paramll( fits->fptr,
|
/* Some FITS images have the first HDU for extra metadata ... skip
|
||||||
10, &bitpix, &fits->naxis, fits->naxes, &status ) ) {
|
* forward until we find a header unit we can load as an image.
|
||||||
vips_fits_error( status );
|
*/
|
||||||
return( -1 );
|
for(;;) {
|
||||||
|
if( fits_get_img_paramll( fits->fptr,
|
||||||
|
10, &bitpix, &fits->naxis, fits->naxes, &status ) ) {
|
||||||
|
vips_fits_error( status );
|
||||||
|
return( -1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( fits->naxis > 0 )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if( fits_movrel_hdu( fits->fptr, 1, NULL, &status ) ) {
|
||||||
|
vips_fits_error( status );
|
||||||
|
vips_error( "fits",
|
||||||
|
"%s", _( "no HDU found with naxes > 0" ) );
|
||||||
|
return( -1 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cfitsio does automatic conversion from the format stored in
|
/* cfitsio does automatic conversion from the format stored in
|
||||||
|
Loading…
Reference in New Issue
Block a user