IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 20 years ago

Closed 17 years ago

#722 closed defect (fixed)

psFits ImageCube functions; Image and Table functions

Reported by: Paul Price Owned by: Paul Price
Priority: high Milestone:
Component: fits Version: 0.10.0
Severity: normal Keywords: PSLib
Cc: robert.desonia@…

Description

It's kind of annoying to have to get NAXIS3 and do multiple calls to
psFitsReadImage, etc, so I propose a new set of functions: psFitsReadImageCube,
psFitsWriteImageCube, psFitsUpdateImageCube, psFitsInsertImageCube. Instead of
working on a single 2D image, these functions will work on a psArray of images.

psArray *psFitsReadImageCube(const psFits *fits, psRegion region);
bool psFitsUpdateImageCube(psFits *fits, const psArray *input, int x0, int y0);
bool psFitsWriteImageCube(psFits *fits, psMetadata *header, const psArray
*input, const char *extname);
bool psFitsInsertImageCube(psFits *fits, psMetadata *header, const psArray
*input, const char *extname, bool after);

In the process of putting these together, I noticed differences between the
Image (or the ImageCube) functions and the Table functions, specifically in the
use of the extname.

bool psFitsWriteImageCube(psFits *fits, psMetadata *header, const psArray
*input, const char *extname);
bool psFitsWriteTable(psFits* fits, const psMetadata *header, const psArray*
table);

bool psFitsInsertImageCube(psFits *fits, psMetadata *header, const psArray
*input, const char *extname, bool after);
bool psFitsInsertTable(psFits *fits, const psMetadata *header, const psArray*
table, bool after);

I propose adding the extname to the Table functions, following the Image
functions. This would mean that it is the responsibility of pslib to update the
header with the EXTNAME.

Change History (4)

comment:1 by Paul Price, 20 years ago

Some code that might be helpful for psFitsWriteImageCube follows. It checks
that NAXIS3 is in the header and then makes repeated calls to psFitsWriteImage.

XXX Not sure I should have to do this check (push into psLib?)
if (hdu->header) {

bool mdok = true; Result of MD lookup
bool naxis3 = psMetadataLookupS32(&mdok, hdu->header, "NAXIS3");

Number of image planes

if ((!mdok && hdu->images->n > 1)
(mdok && naxis3 !=

hdu->images->n)) {

psMetadataItem *naxis3item = psMetadataLookup(hdu->header,

"NAXIS3"); Item with NAXIS3

naxis3item->data.S32 = hdu->images->n;

}

} else if (hdu->images->n > 1) {

hdu->header = psMetadataAlloc();
psMetadataAddS32(hdu->header, PS_LIST_HEAD, "NAXIS3",

PS_META_REPLACE, "Number of image planes",

hdu->images->n);

}
Now we can safely write the images out
for (int i = 0; i < hdu->images->n; i++) {

if (! psFitsWriteImage(fits, hdu->header, hdu->images->data[i], i,

hdu->extname)) {

psError(PS_ERR_IO, false, "Error writing image plane %d\n", i);
return false;

}

}

comment:2 by Paul Price, 20 years ago

Status: newassigned

Gene accepts these proposals; I am to write the code. I will work in the
rel10_ifa branch.

comment:3 by Paul Price, 20 years ago

bug_group: IPP-doc?PSLib?
Component: PSLib SDRSfits
Keywords: PSLib added; IPP-doc removed
Owner: changed from eugene to Paul Price
product: IPP-docPSLib
Status: assignednew
Version: unspecified0.10.0

comment:4 by eugene, 17 years ago

Resolution: fixed
Status: newclosed

these were finished a long time ago.

Note: See TracTickets for help on using tickets.