IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 30, 2009, 11:06:34 AM (17 years ago)
Author:
bills
Message:

add keywords to the headers indicating that an output image is
destreaked or a recovery image

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/magic/remove/src/streaksio.c

    r23965 r24283  
    334334
    335335void
     336addDestreakKeyword(psMetadata *header)
     337{
     338    psMetadataAddBool(header, PS_LIST_TAIL, "PSDESTRK", PS_META_REPLACE,
     339        "Have streaks been removed from image?", true);
     340}
     341
     342void
     343addRecoveryKeyword(psMetadata *header)
     344{
     345    psMetadataAddBool(header, PS_LIST_TAIL, "PSRECOVR", PS_META_REPLACE,
     346        "Does this image contain excised streak pixels?", true);
     347}
     348
     349void
    336350copyPHU(streakFiles *sfiles, bool remove)
    337351{
     
    344358        streaksExit("", PS_EXIT_DATA_ERROR);
    345359    }
    346 
    347     // TODO: add keyword indicating that streaks have been removed
     360    psMetadata *recHeader = NULL;
     361    if (remove && sfiles->recImage) {
     362       recHeader = psMetadataCopy(NULL, imageHeader);
     363       addRecoveryKeyword(recHeader);
     364    }
     365
     366    // add keyword indicating that streaks have been removed
     367    addDestreakKeyword(imageHeader);
     368
    348369    if (!psFitsWriteBlank(sfiles->outImage->fits, imageHeader, NULL)) {
    349370        psError(PS_ERR_IO, false, "failed to write primary header to %s",
     
    351372        streaksExit("", PS_EXIT_DATA_ERROR);
    352373    }
    353     // TODO: add keyword indicating that this is the recovery image
    354     if (remove && sfiles->recImage && !psFitsWriteBlank(sfiles->recImage->fits, imageHeader, NULL)) {
     374    if (recHeader && !psFitsWriteBlank(sfiles->recImage->fits, recHeader, NULL)) {
    355375        psError(PS_ERR_IO, false, "failed to write primary header to %s",
    356376            sfiles->recImage->resolved_name);
    357377        streaksExit("", PS_EXIT_DATA_ERROR);
    358378    }
     379    psFree(recHeader);
     380    recHeader = NULL;
    359381    psFree(imageHeader);
    360382
     
    367389            streaksExit("", 1);
    368390        }
    369         // TODO: add keyword indicating that streaks have been removed
     391        if (remove && sfiles->recMask) {
     392            recHeader = psMetadataCopy(NULL, maskHeader);
     393            // add keyword indicating that this is the recovery image
     394           addRecoveryKeyword(recHeader);
     395        }
     396        // add keyword indicating that streaks have been removed
     397        addDestreakKeyword(maskHeader);
    370398        if (!psFitsWriteBlank(sfiles->outMask->fits, maskHeader, NULL)) {
    371399            psError(PS_ERR_IO, false, "failed to write primary header to %s",
     
    373401            streaksExit("", PS_EXIT_DATA_ERROR);
    374402        }
    375         // TODO: add keyword indicating that this is the recovery image
    376         if (remove && sfiles->recMask && !psFitsWriteBlank(sfiles->recMask->fits, maskHeader, NULL)) {
     403        if (recHeader && !psFitsWriteBlank(sfiles->recMask->fits, recHeader, NULL)) {
    377404            psError(PS_ERR_IO, false, "failed to write primary header to %s",
    378405                sfiles->recMask->resolved_name);
    379406            streaksExit("", PS_EXIT_DATA_ERROR);
    380407        }
     408        psFree(recHeader);
     409        recHeader = NULL;
    381410        psFree(maskHeader);
    382411    }
     
    389418            streaksExit("", 1);
    390419        }
    391         // TODO: add keyword indicating that streaks have been removed
     420        if (remove && sfiles->recWeight) {
     421            recHeader = psMetadataCopy(NULL, weightHeader);
     422            // add keyword indicating that this is a recovery image
     423           addRecoveryKeyword(recHeader);
     424        }
     425
     426        // add keyword indicating that streaks have been removed
     427        addDestreakKeyword(weightHeader);
    392428        if (!psFitsWriteBlank(sfiles->outWeight->fits, weightHeader, NULL)) {
    393429            psError(PS_ERR_IO, false, "failed to write primary header to %s",
     
    395431            streaksExit("", PS_EXIT_DATA_ERROR);
    396432        }
    397         // TODO: add keyword indicating that this is a recovery image
    398         if (remove && sfiles->recWeight && !psFitsWriteBlank(sfiles->recWeight->fits, weightHeader, NULL)) {
     433        if (recHeader && !psFitsWriteBlank(sfiles->recWeight->fits, recHeader, NULL)) {
    399434            psError(PS_ERR_IO, false, "failed to write primary header to %s",
    400435                sfiles->recWeight->resolved_name);
     
    402437        }
    403438        psFree(weightHeader);
     439        psFree(recHeader);
    404440    }
    405441}
Note: See TracChangeset for help on using the changeset viewer.