IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 20, 2009, 5:56:03 PM (17 years ago)
Author:
eugene
Message:

add ability to handle CTEMASK mode (combine like a flat; mask pixels below a minimum value; output a mask image)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppMerge/src/ppMergeLoop.c

    r23410 r23463  
    118118      case PPMERGE_TYPE_BIAS:
    119119      case PPMERGE_TYPE_DARK:
     120      case PPMERGE_TYPE_CTEMASK:
    120121        break;
    121122      default:
     
    208209            // call the init functions
    209210            switch (type) {
     211              case PPMERGE_TYPE_CTEMASK:
    210212              case PPMERGE_TYPE_BIAS:
    211213              case PPMERGE_TYPE_FLAT:
     
    252254                // Start a job
    253255                switch (type) {
     256                  case PPMERGE_TYPE_CTEMASK:
    254257                  case PPMERGE_TYPE_BIAS:
    255258                  case PPMERGE_TYPE_FLAT:
     
    408411            }
    409412
     413            // calculate CTEMASK after stats so stats reflect median image
     414            if (type == PPMERGE_TYPE_CTEMASK && outRO) {
     415                // need to apply range cuts on the output image
     416                psAssert (outRO->mask, "mask is not defined");
     417                psAssert (outRO->mask->numCols == outRO->image->numCols, "mismatch between image and mask");
     418                psAssert (outRO->mask->numRows == outRO->image->numRows, "mismatch between image and mask");
     419
     420                // CTEMASK parameters
     421                float cteMin = psMetadataLookupF32(NULL, arguments, "CTE.MIN"); // Number of fringe points
     422
     423                char *cteMaskName = psMetadataLookupStr (&mdok, config->arguments, "MASK.SET.VALUE");
     424                psImageMaskType cteMaskValue = pmConfigMaskGet(cteMaskName, config);
     425
     426                psF32 **outputImage = outRO->image->data.F32;
     427                psImageMaskType **outputMask = outRO->mask->data.PS_TYPE_IMAGE_MASK_DATA;
     428                for (int iy = 0; iy < outRO->image->numRows; iy++) {
     429                    for (int ix = 0; ix < outRO->image->numCols; ix++) {
     430                        if (outputImage[iy][ix] < cteMin) {
     431                            outputMask[iy][ix] |= cteMaskValue;
     432                        }
     433                    }
     434                }
     435            }
     436
    410437            psFree(outRO);
    411438            cellNum++;
Note: See TracChangeset for help on using the changeset viewer.