Opened 21 years ago
Closed 20 years ago
#578 closed defect (fixed)
Is psFitsHeaderFromImage really necessary?
| Reported by: | Owned by: | eugene | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | PSLib SDRS | Version: | unspecified |
| Severity: | normal | Keywords: | |
| Cc: | robert.desonia@… |
Description
psFitsHeaderFromImage creates header keywords like BITPIX, NAXES, NAXIS*, etc. from its input
psImage. psFitsWriteImage also creates those keywords cooresponding to its input psImage
dimensions (implicitly as it calls fits_create_img to create a new HDU).
I'm not sure why one would really need to psFitsHeaderFromImage if the keywords are set
automagically at HDU creation and changing them via a psFitsWriteHeader can easily invalidate the
HDU, as the HDU is not resized to fit the new values of the keywords in question.
Can you explain the purpose you saw in psFitsHeaderFromImage and how you see it used?
-rdd
Change History (6)
comment:1 by , 21 years ago
| Status: | new → assigned |
|---|
comment:2 by , 21 years ago
Well, I think the best way to handle things is for psFitsWriteImage should set the keywords like
BITPIX,NAXES,NAXIS*, etc. properly given the input psImage and ignore any settings in the input header.
There should be no need, therefore, for a psFitsHeaderFromImage, or psFitsHeaderValidate, as required
keywords are put in at write time and need not be in the psMetadata version of the header.
comment:3 by , 21 years ago
| Cc: | added |
|---|
That sounds good. I shall remove psFitsHeaderFromImage, psFitsHeaderFromTable.
psFitsHeaderValidate is intended to check the length of the keywords (FITS max
is 8 chars). Perhaps this is not required, since I noticed that long keywords
are added in using "HIERARCH" or something like that?
comment:4 by , 21 years ago
| Cc: | added |
|---|
Yes, CFITSIO supports the ESO HIERARCH convention, allowing long keyword names. Does this mean
that psFitsHeaderValidate can be removed as well?
-rdd
comment:6 by , 20 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
psFitsHeaderFromImage was done away with, following modification to
psFitsWriteHeader to do the Right Thing.

One really annoying problem I often run into when using FITS images is that I
read an image in, alter it (e.g., convert from int to float, trim off the
overscan --- something that would alter fundamental headers), and then I want to
write it out using the old headers. The problem is that the old headers contain
the old BITPIX, NAXIS[12], etc, so that cfitsio doesn't know what's true. The
idea behind psFitsHeaderFromImage was to fix the header based on the image. If
you can suggest changing psFitsWriteImage to get around the above problem, that
would be great, and we could drop psFitsHeaderFromImage (or we can rename it to
psFitsUpdateHeaderFromImage, perhaps?).