IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23936


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

Location:
trunk/magic/remove/src
Files:
3 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}
  • trunk/magic/remove/src/streaksio.h

    r23487 r23936  
    1616void copyFitsOptions(sFile *out, sFile *rec, sFile *in);
    1717void setupImageRefs(sFile *out, sFile *recoveryOut, sFile *in, int extnum, bool exciseAll);
     18void strkGetMaskValues(streakFiles *sfiles, psU32 *maskStreak, psU32 *maskMask);
    1819
    1920void writeImage(sFile *sfile, psString extname, int extnum);
     
    2526
    2627bool isExciseValue(double, double);
    27 void setMaskedToNAN(streakFiles *sfiles, psU8 maskMask, bool printCounts);
     28void setMaskedToNAN(streakFiles *sfiles, psU32 maskMask, bool printCounts);
    2829
    2930bool replicateOutputs(streakFiles *sf);
  • trunk/magic/remove/src/streaksremove.c

    r23911 r23936  
    2323    }
    2424
    25     psMetadata *masks = psMetadataLookupMetadata(&status, config->recipes, "MASKS");
    26     if (!status) {
    27         psError(PM_ERR_CONFIG, false, "failed to lookup MASKS in recipes\n");
    28         streaksExit("", PS_EXIT_CONFIG_ERROR);
    29     }
    30     double maskStreak = (double) psMetadataLookupU16(&status, masks, "STREAK");
    31     if (!status) {
    32         psError(PM_ERR_CONFIG, false, "failed to lookup mask value for STREAK in recipes\n");
    33         streaksExit("", PS_EXIT_CONFIG_ERROR);
    34     }
    35 
    36     // optionally setting pixels with any mask bits execpt POOR.WARP to NAN
    37     psU16 poorWarp = (double) psMetadataLookupU16(&status, masks, "CONV.POOR");
    38     if (!status) {
    39         psError(PM_ERR_CONFIG, false, "failed to lookup mask value for POOR.WARP in recipes\n");
    40         streaksExit("", PS_EXIT_CONFIG_ERROR);
    41     }
    42     psU16 maskMask = ~poorWarp;
     25    psU32 maskStreak = 0;
     26    psU32 maskMask = 0;
    4327
    4428    psString streaksFileName = psMetadataLookupStr(NULL, config->arguments, "STREAKS");
     
    11498        }
    11599
     100        // now that we've read the input files, lookup the mask values
     101        if (maskStreak == 0) {
     102            strkGetMaskValues(sfiles, &maskStreak, &maskMask);
     103        }
     104
    116105        totalPixels += sfiles->inImage->numRows * sfiles->inImage->numCols;
    117106
     
    131120                    psTimerStart("EXCISE_NON_WARPED");
    132121
     122                    // set non-warped pixels and variance to NAN, mask to maskStreak (since the pixel
     123                    // is excised as part of the destreaking process)
    133124                    exciseNonWarpedPixels(sfiles, maskStreak);
    134125
     
    648639            }
    649640        }
     641        // XXX: check this
    650642        // Assumption: there are no mask and weight images for video cells
    651643        return;
Note: See TracChangeset for help on using the changeset viewer.