IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26408


Ignore:
Timestamp:
Dec 15, 2009, 2:10:35 PM (16 years ago)
Author:
bills
Message:

Completion to previous fix. If component is completely excised set the STREAK
bit in all pixels in the mask image

Location:
trunk/magic/remove/src
Files:
5 edited

Legend:

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

    r26041 r26408  
    11821182
    11831183void
    1184 strkGetMaskValues(streakFiles *sfiles, psU32 *maskStreak, psU32 *maskMask)
    1185 {
     1184strkGetMaskValues(streakFiles *sfiles)
     1185{
     1186    if (sfiles->maskStreak) {
     1187        // already done
     1188        return;
     1189    }
    11861190    if (sfiles->inMask && sfiles->inMask->header) {
    11871191        if (!pmConfigMaskReadHeader(sfiles->config, sfiles->inMask->header)) {
     
    11961200        streaksExit("", PS_EXIT_CONFIG_ERROR);
    11971201    }
    1198     *maskStreak = psMetadataLookupU32(&status, masks, "STREAK");
     1202    sfiles->maskStreak = psMetadataLookupU32(&status, masks, "STREAK");
    11991203    if (!status) {
    12001204        psError(PM_ERR_CONFIG, false, "failed to lookup mask value for STREAK in recipes\n");
     
    12121216        }
    12131217    }
    1214     *maskMask = ~convPoor;
     1218    sfiles->maskMask = ~convPoor;
    12151219}
    12161220
  • trunk/magic/remove/src/streaksio.h

    r24853 r26408  
    1616void copyFitsOptions(sFile *out, sFile *rec, sFile *in, psVector *tiles);
    1717void setupImageRefs(sFile *out, sFile *recoveryOut, sFile *in, int extnum, bool exciseAll);
    18 void strkGetMaskValues(streakFiles *sfiles, psU32 *maskStreak, psU32 *maskMask);
     18void strkGetMaskValues(streakFiles *sfiles);
    1919void copyExtraExtensions(streakFiles *sfiles);
    2020
  • trunk/magic/remove/src/streaksrelease.c

    r25082 r26408  
    1616        return PS_EXIT_CONFIG_ERROR;
    1717    }
    18 
    19     // Values to set for masked pixels
    20     psU32 maskStreak = 0;           // for the image and weight (usually NAN, MAXINT for integer images)
    21     psU32 maskMask = 0;             // value looked up for MASK.STREAK
    2218
    2319    // Does true work here?
     
    5046
    5147        // now that we've read the input files, lookup the mask values that we read
    52         if (maskStreak == 0) {
    53             strkGetMaskValues(sfiles, &maskStreak, &maskMask);
    54         }
    55 
    56         setMaskedToNAN(sfiles, maskMask, true);
     48        strkGetMaskValues(sfiles);
     49
     50        setMaskedToNAN(sfiles, sfiles->maskMask, true);
    5751
    5852        // write out the destreaked temporary images and the recovery images
  • trunk/magic/remove/src/streaksremove.c

    r26407 r26408  
    3434    }
    3535
    36     // Values to set for masked pixels
    37     psU32 maskStreak = 0;           // for the image and weight (usually NAN, MAXINT for integer images)
    38     psU32 maskMask = 0;             // value looked up for MASK.STREAK
    39 
    4036    psString streaksFileName = psMetadataLookupStr(NULL, config->arguments, "STREAKS");
    4137
     
    118114
    119115        // now that we've read the input files, lookup the mask values
    120         if (maskStreak == 0) {
    121             strkGetMaskValues(sfiles, &maskStreak, &maskMask);
    122         }
     116        strkGetMaskValues(sfiles);
    123117
    124118        totalPixels += sfiles->inImage->numRows * sfiles->inImage->numCols;
     
    142136                    // set non-warped pixels and variance to NAN, mask to maskStreak (since the pixel
    143137                    // is excised as part of the destreaking process)
    144                     exciseNonWarpedPixels(sfiles, maskStreak);
     138                    exciseNonWarpedPixels(sfiles, sfiles->maskStreak);
    145139
    146140                    psLogMsg("streaksremove", PS_LOG_INFO, "time to excise non warped pixels: %f\n", psTimerClear("EXCISE_NON_WARPED"));
     
    149143                psTimerStart("REMOVE_STREAKS");
    150144
    151                 totalStreakPixels += censorPixels(sfiles, pixels, checkNonWarpedPixels, maskStreak);
     145                totalStreakPixels += censorPixels(sfiles, pixels, checkNonWarpedPixels, sfiles->maskStreak);
    152146
    153147                psLogMsg("streaksremove", PS_LOG_INFO, "time to remove streak pixels: %f\n", psTimerClear("REMOVE_STREAKS"));
     
    155149                if (nanForRelease) {
    156150                    // set any pixels that were masked, to NAN (unless they are already NAN)
    157                     setMaskedToNAN(sfiles, maskMask, true);
     151                    setMaskedToNAN(sfiles, sfiles->maskMask, true);
    158152                }
    159153
     
    173167        }
    174168
    175         censorSources(sfiles, maskStreak);
     169        censorSources(sfiles, sfiles->maskStreak);
    176170
    177171        // write the destreaked "temporary" images and the recovery images
     
    512506}
    513507
     508static void
     509setStreakBits(psImage *maskImage, psU32 maskStreak)
     510{
     511    for (int y=0 ; y < maskImage->numRows; y++) {
     512        for (int x=0 ; x < maskImage->numCols; x++) {
     513            maskImage->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= maskStreak;
     514        }
     515    }
     516}
     517
    514518// set the image for the output files to the contents of the corresponding input file.
    515519static bool
     
    582586            // Note: we don't excise the mask pixels even if exciseAll is true.
    583587            setupImageRefs(sf->outMask, sf->recMask, sf->inMask, sf->extnum, false);
     588            if (exciseAll) {
     589                strkGetMaskValues(sf);
     590               
     591                setStreakBits(sf->inMask->image, sf->maskStreak);
     592            }
    584593            if (sf->outChMask) {
    585594                sf->outChMask->header = (psMetadata *) psMemIncrRefCounter(sf->outMask->header);
  • trunk/magic/remove/src/streaksremove.h

    r25082 r26408  
    7575    double  transparentStreaks;
    7676    psString    program_name;
     77    psU32   maskStreak;
     78    psU32   maskMask;
    7779} streakFiles;
    7880
Note: See TracChangeset for help on using the changeset viewer.