IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29544


Ignore:
Timestamp:
Oct 25, 2010, 2:46:07 PM (16 years ago)
Author:
eugene
Message:

merge changes from eam_branches/ipp-20100823

Location:
trunk/psModules/src/camera
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAMaskWeight.c

    r26893 r29544  
    476476}
    477477
    478 
    479 
     478// find any pixels which are not already masked (with maskTest) which are not valid and raise maskSet bits
     479bool pmReadoutMaskInvalid (const pmReadout *readout, psImageMaskType maskTest, psImageMaskType maskSet) {
     480
     481    if (!readout) return true;
     482
     483    psImage *image = readout->image;
     484    psImage *mask  = readout->mask;
     485    psImage *variance = readout->variance;
     486    for (int y = 0; y < image->numRows; y++) {
     487        for (int x = 0; x < image->numCols; x++) {
     488            if (mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskTest) continue;
     489            bool valid = false;
     490            valid = isfinite(image->data.F32[y][x]);
     491            if (valid && variance) {
     492                valid &= isfinite(variance->data.F32[y][x]);
     493            }
     494            if (valid) continue;
     495            mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= maskSet;
     496        }
     497    }
     498
     499    return true;
     500}
     501
     502// raise maskVal for any invalid pixels
    480503bool pmReadoutMaskNonfinite(pmReadout *readout, psImageMaskType maskVal)
    481504{
  • trunk/psModules/src/camera/pmFPAMaskWeight.h

    r26076 r29544  
    9999    );
    100100
     101// find any pixels which are not already masked (with maskTest) which are not valid and raise maskSet bits
     102bool pmReadoutMaskInvalid (const pmReadout *readout, psImageMaskType maskTest, psImageMaskType maskSet);
     103
    101104/// Apply a mask to the image and variance map
    102105///
  • trunk/psModules/src/camera/pmFPA_JPEG.c

    r23259 r29544  
    179179    psFree(stats);
    180180
     181    // default options are: no flip in X or Y, scale bar on bottom
     182    psImageJpegOptions *jpegOptions = psImageJpegOptionsAlloc();
     183
    181184    char *colormapName = psMetadataLookupStr(NULL, options, "COLORMAP"); // Name of colour map
    182185    if (!colormapName) {
    183186        colormapName = "-greyscale";
    184187    }
     188    psImageJpegColormapSet(jpegOptions, colormapName);
     189
     190    // set up the scale options
    185191    char *mode = psMetadataLookupStr(NULL, options, "SCALE.MODE"); // Mode for scaling image
    186192    if (!mode) {
     
    195201        fmax = +6.0;
    196202    }
    197 
    198     float min = 0, max = 0;             // Minimum and maximum for stretch
    199 
    200203    if (!strcasecmp(mode, "RANGE")) {
    201         min = mean + fmin*delta;
    202         max = mean + fmax*delta;
     204        jpegOptions->min = mean + fmin*delta;
     205        jpegOptions->max = mean + fmax*delta;
    203206    } else if (!strcasecmp(mode, "FRACTION")) {
    204         min = fmin*mean;
    205         max = fmax*mean;
     207        jpegOptions->min = fmin*mean;
     208        jpegOptions->max = fmax*mean;
    206209    } else if (!strcasecmp(mode, "VALUE")) {
    207         min = fmin;
    208         max = fmax;
     210        jpegOptions->min = fmin;
     211        jpegOptions->max = fmax;
    209212    } else {
    210213        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unrecognised scaling mode: %s", mode);
    211214        return false;
    212215    }
    213 
    214     if (!isfinite(min) || !isfinite(max)) {
     216    if (!isfinite(jpegOptions->min) || !isfinite(jpegOptions->max)) {
    215217        psLogMsg("psModules.jpeg", PS_LOG_WARN,
    216218                 "The stretch parameters are not both finite --- writing blank jpeg");
    217         min = 0;
    218         max = 1;
    219     }
    220 
    221     psImageJpegColormap *map = psImageJpegColormapSet(NULL, colormapName);
    222     if (!map) {
    223         map = psImageJpegColormapSet(NULL, "-greyscale");
    224     }
    225 
    226     if (!psImageJpeg(map, readout->image, file->filename, min, max)) {
     219        jpegOptions->min = 0;
     220        jpegOptions->max = 1;
     221    }
     222
     223    jpegOptions->showScale = PS_JPEG_SHOWSCALE_NONE;
     224    jpegOptions->xFlip = false;
     225    jpegOptions->yFlip = false;
     226   
     227    char *userOptions = psMetadataLookupStr(&status, options, "OPTIONS"); // Mode for scaling image
     228    if (userOptions) {
     229        // just use strstr for now
     230        if (strcasestr(userOptions, "+SB")) {
     231            jpegOptions->showScale = PS_JPEG_SHOWSCALE_BOTTOM;
     232        }
     233        if (strcasestr(userOptions, "-X")) {
     234            jpegOptions->xFlip = true;
     235        }
     236        if (strcasestr(userOptions, "-Y")) {
     237            jpegOptions->yFlip = true;
     238        }
     239    }
     240
     241    // NOTE: we can overlay the location of the stars from the readout by passing a bDrawBuffer to this function
     242
     243    if (!psImageJpeg(jpegOptions, readout->image, NULL, file->filename)) {
    227244        psError(PS_ERR_UNKNOWN, false, "Unable to write JPEG image");
    228         psFree(map);
    229         return false;
    230     }
    231 
    232     psFree(map);
    233     return true;
    234 }
     245        psFree(jpegOptions);
     246        return false;
     247    }
     248
     249    psFree(jpegOptions);
     250    return true;
     251}
Note: See TracChangeset for help on using the changeset viewer.