IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 20, 2009, 2:38:45 PM (17 years ago)
Author:
bills
Message:

get mask values from input mask file rather than
the recipe

File:
1 edited

Legend:

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

    r23911 r23936  
    968968
    969969void
    970 setMaskedToNAN(streakFiles *sfiles, psU8 maskMask, bool printCounts)
     970setMaskedToNAN(streakFiles *sfiles, psU32 maskMask, bool printCounts)
    971971{
    972972        int maskedPixels = 0;
     
    991991                // but I want to get the counts
    992992                double imageVal  = psImageGet(image, x, y);
    993                 psU8 maskVal;
     993                psU32 maskVal;
    994994                if (sfiles->stage == IPP_STAGE_RAW) {
    995995                    int xChip, yChip;
     
    10441044    }
    10451045}
     1046
     1047void
     1048strkGetMaskValues(streakFiles *sfiles, psU32 *maskStreak, psU32 *maskMask)
     1049{
     1050    if (sfiles->inMask->header) {
     1051        if (!pmConfigMaskReadHeader(sfiles->config, sfiles->inMask->header)) {
     1052            streaksExit("failed to read mask values from file", PS_EXIT_CONFIG_ERROR);
     1053        }
     1054    }
     1055
     1056    bool status;
     1057    psMetadata *masks = psMetadataLookupMetadata(&status, sfiles->config->recipes, "MASKS");
     1058    if (!status) {
     1059        psError(PM_ERR_CONFIG, false, "failed to lookup MASKS in recipes\n");
     1060        streaksExit("", PS_EXIT_CONFIG_ERROR);
     1061    }
     1062    *maskStreak = psMetadataLookupU32(&status, masks, "STREAK");
     1063    if (!status) {
     1064        psError(PM_ERR_CONFIG, false, "failed to lookup mask value for STREAK in recipes\n");
     1065        streaksExit("", PS_EXIT_CONFIG_ERROR);
     1066    }
     1067
     1068    // optionally setting pixels with any mask bits execpt CONV.POOR to NAN
     1069    // check old name first
     1070    psU32 convPoor = (double) psMetadataLookupU32(&status, masks, "POOR.WARP");
     1071    if (!status) {
     1072        convPoor = (double) psMetadataLookupU32(&status, masks, "CONV.POOR");
     1073        if (!status) {
     1074            psError(PM_ERR_CONFIG, false, "failed to lookup mask value for CONV.POOR in recipes\n");
     1075            streaksExit("", PS_EXIT_CONFIG_ERROR);
     1076        }
     1077    }
     1078    *maskMask = ~convPoor;
     1079}
Note: See TracChangeset for help on using the changeset viewer.