IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21183 for trunk/pswarp


Ignore:
Timestamp:
Jan 26, 2009, 8:40:07 PM (17 years ago)
Author:
eugene
Message:

incorporating changes from 16bit mask upgrades (eam_branch_20081230)

Location:
trunk/pswarp/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpLoop.c

    r21178 r21183  
    6767
    6868    // output mask bits
    69     psMaskType maskValue = psMetadataLookupU8(&status, recipe, "MASK.OUTPUT");
     69    psImageMaskType maskValue = psMetadataLookupImageMask(&status, recipe, "MASK.OUTPUT");
    7070    psAssert (status, "MASK.OUTPUT was not defined");
    7171
  • trunk/pswarp/src/pswarpPixelFraction.c

    r18558 r21183  
    2020    PS_ASSERT_IMAGE_NON_NULL(readout->mask, false);
    2121    PS_ASSERT_IMAGES_SIZE_EQUAL(readout->mask, readout->image, false);
    22     PS_ASSERT_IMAGE_TYPE(readout->mask, PS_TYPE_MASK, false);
     22    PS_ASSERT_IMAGE_TYPE(readout->mask, PS_TYPE_IMAGE_MASK, false);
    2323
    2424    if (stats) {
     
    4040
    4141    // output mask bits
    42     psMaskType maskValue = psMetadataLookupU8(&status, recipe, "MASK.OUTPUT");
     42    psImageMaskType maskValue = psMetadataLookupImageMask(&status, recipe, "MASK.OUTPUT");
    4343    psAssert (status, "MASK.OUTPUT was not defined");
    4444
     
    5555    for (int y = 0; y < numRows; y++) {
    5656        for (int x = 0; x < numCols; x++) {
    57             if (mask->data.PS_TYPE_MASK_DATA[y][x] & maskValue) {
     57            if (mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskValue) {
    5858                numBad++;
    5959            } else {
  • trunk/pswarp/src/pswarpSetMaskBits.c

    r18558 r21183  
    1010bool pswarpSetMaskBits (pmConfig *config) {
    1111
    12     psMaskType maskIn = 0x00;                   // mask for the input image
    13     psMaskType markIn = 0x00;                   // mark for the input image
    14     psMaskType maskOut = 0x00;                  // mask for the output image
    15     psMaskType markOut = 0x00;                  // mark for the output image
     12    psImageMaskType maskIn = 0x00;                      // mask for the input image
     13    psImageMaskType markIn = 0x00;                      // mark for the input image
     14    psImageMaskType maskOut = 0x00;                     // mask for the output image
    1615
    1716    // this function sets the required single-image mask bits
     
    2221
    2322    // mask for non-linear flat regions (default to DETECTOR if not defined)
    24     psMaskType badMask = pmConfigMaskGet("BAD.WARP", config);
     23    psImageMaskType badMask = pmConfigMaskGet("BAD.WARP", config);
    2524    if (!badMask) {
    2625        badMask = 0x01;
     
    3029
    3130    // mask for non-linear flat regions (default to DETECTOR if not defined)
    32     psMaskType poorMask = pmConfigMaskGet("POOR.WARP", config);
     31    psImageMaskType poorMask = pmConfigMaskGet("POOR.WARP", config);
    3332    if (!poorMask) {
    3433        poorMask = 0x02;
     
    3837
    3938    // search for an unset bit to use for MARK:
    40     markOut = 0x80;
     39    psImageMaskType markOut   = 0x00;
     40    psImageMaskType markTrial = 0x01;
    4141
    42     int nBits = sizeof(psMaskType) * 8;
     42    int nBits = sizeof(psImageMaskType) * 8;
    4343    for (int i = 0; !markOut && (i < nBits); i++) {
    44         if (maskOut & markOut) {
    45             markOut >>= 1;
    46         } else {
    47             markOut = markOut;
    48         }
     44        if (maskOut & markTrial) {
     45            markTrial <<= 1;
     46        } else {
     47            markOut = markTrial;
     48        }
    4949    }
    50 
    5150    if (!markOut) {
    52         psError (PS_ERR_UNKNOWN, true, "Unable to define the MARK bit mask: all bits taken!");
    53         return false;
     51        psError (PS_ERR_UNKNOWN, true, "Unable to define the MARK bit mask: all bits taken!");
     52        return false;
    5453    }
    5554
     
    6362    // set maskOut and markOut in the psphot recipe
    6463    // NOTE: psphot works on the output images, not input images, so set the MARK and MASK correctly here
    65     psMetadataAddU8 (warpRecipe, PS_LIST_TAIL, "MASK.INPUT",  PS_META_REPLACE, "user-defined mask", maskIn);
    66     psMetadataAddU8 (warpRecipe, PS_LIST_TAIL, "MARK.INPUT",  PS_META_REPLACE, "user-defined mask", markIn);
    67     psMetadataAddU8 (warpRecipe, PS_LIST_TAIL, "MASK.OUTPUT", PS_META_REPLACE, "user-defined mask", maskOut);
    68     psMetadataAddU8 (warpRecipe, PS_LIST_TAIL, "MARK.OUTPUT", PS_META_REPLACE, "user-defined mask", markOut);
     64    psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MASK.INPUT",  PS_META_REPLACE, "user-defined mask", maskIn);
     65    psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MARK.INPUT",  PS_META_REPLACE, "user-defined mask", markIn);
     66    psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MASK.OUTPUT", PS_META_REPLACE, "user-defined mask", maskOut);
     67    psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MARK.OUTPUT", PS_META_REPLACE, "user-defined mask", markOut);
    6968
    7069    // update the psphot recipe
     
    7776    // set maskOut and markOut in the psphot recipe
    7877    // NOTE: psphot works on the output images, not input images, so set the MARK and MASK correctly here
    79     psMetadataAddU8 (psphotRecipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "user-defined mask", markOut);
    80     psMetadataAddU8 (psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskOut);
     78    psMetadataAddImageMask (psphotRecipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "user-defined mask", markOut);
     79    psMetadataAddImageMask (psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskOut);
    8180
    8281    return true;
  • trunk/pswarp/src/pswarpTransformReadout.c

    r20334 r21183  
    2222
    2323    // output mask bits
    24     psMaskType maskIn   = psMetadataLookupU8(&mdok, recipe, "MASK.INPUT");
    25     psMaskType maskPoor = pmConfigMaskGet("POOR.WARP", config);
    26     psMaskType maskBad  = pmConfigMaskGet("BAD.WARP", config);
     24    psImageMaskType maskIn   = psMetadataLookupImageMask(&mdok, recipe, "MASK.INPUT");
     25    psImageMaskType maskPoor = pmConfigMaskGet("POOR.WARP", config);
     26    psImageMaskType maskBad  = pmConfigMaskGet("BAD.WARP", config);
    2727    psAssert(mdok, "MASK.INPUT was not defined");
    2828
     
    8080    }
    8181    if ((input->mask || maskPoor || maskBad) && !output->mask) {
    82         output->mask = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_MASK);
     82        output->mask = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_IMAGE_MASK);
    8383        psImageInit(output->mask, maskBad);
    8484    }
  • trunk/pswarp/src/pswarpTransformTile.c

    r19395 r21183  
    4949    psF32 **outImageData     = args->output->image->data.F32;
    5050    psF32 **outVarData       = (args->output->weight) ? args->output->weight->data.F32 : NULL;
    51     psMaskType **outMaskData = (args->output->mask)   ? args->output->mask->data.PS_TYPE_MASK_DATA : NULL;
    52     psMaskType **inMaskData  = (args->input->mask)    ? args->input->mask->data.PS_TYPE_MASK_DATA : NULL;
     51    psImageMaskType **outMaskData = (args->output->mask)   ? args->output->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL;
     52    psImageMaskType **inMaskData  = (args->input->mask)    ? args->input->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL;
    5353
    5454    pswarpMap *map = args->grid->maps[args->gridX][args->gridY]; // Map for this tile
     
    6767
    6868            // Only transform those pixels requested
    69             if (region && region->data.U8[y][x]) {
     69            if (region && region->data.PS_TYPE_IMAGE_MASK_DATA[y][x]) {
    7070                continue;
    7171            }
     
    8282            // psImagePixelInterpolate determines the value at pixel coordinate (x,y) in child coordinates
    8383            double imageValue, varValue; // Value of image and variance map
    84             psMaskType maskValue = inMaskData ? inMaskData[(int)yIn][(int)xIn] : 0; // Value of mask
     84            psImageMaskType maskValue = inMaskData ? inMaskData[(int)yIn][(int)xIn] : 0; // Value of mask
    8585            if (!psImageInterpolate(&imageValue, &varValue, &maskValue, xIn, yIn, args->interp)) {
    8686                psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image.");
Note: See TracChangeset for help on using the changeset viewer.