IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9616


Ignore:
Timestamp:
Oct 17, 2006, 12:17:38 PM (20 years ago)
Author:
Paul Price
Message:

Documenting and cleaning up pmMaskBadPixels; removing old error files --- unneccesary.

Location:
trunk/psModules/src/detrend
Files:
4 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/Makefile.am

    r9434 r9616  
    1919pkginclude_HEADERS = \
    2020        pmFlatField.h \
    21         pmFlatFieldErrors.h \
    2221        pmFlatNormalize.h \
    2322        pmFringeStats.h \
    24         pmMaskBadPixelsErrors.h \
    2523        pmMaskBadPixels.h \
    2624        pmNonLinear.h \
     
    3129        psIOBuffer.h
    3230
    33 #       pmSubtractSky.c
    34 
    35 EXTRA_DIST = \
    36         pmFlatFieldErrors.dat \
    37         pmMaskBadPixelsErrors.dat
     31#       pmSubtractSky.h
    3832
    3933CLEANFILES = *~
  • trunk/psModules/src/detrend/pmMaskBadPixels.c

    r7479 r9616  
    1 /** @file  pmMaskBadPixels.c
    2  *
    3  *  @brief Given an input image, a bad pixel mask, a corresponding value in the bad pixel mask to mask, a
    4  *  saturation level, and a growing radius, mask in the input image those pixels in the bad pixel mask that
    5  *  match the value to mask.
    6  *
    7  *  Apply the supplied bad pixel mask readout (mask) to the given science readout (input).
    8  *  The science readout must already have a supplied mask element (use eg. pmReadoutSetMask)
    9  *  The supplied mask image must be of MASK type
    10  
    11  *  If maskVal is non-zero, all pixels in the mask have any of the same bits sets as maskVal
    12  *  shall have the corresponding bits raised.
    13  
    14  *  If maskVal is zero, any zero pixels in the mask be OR-ed with PM_MASK_BAD
    15  
    16  * Note that the input image and the mask need not be the same size, since the input image may
    17  * already have been trimmed (following overscan subtraction).  The function assumes the pixels
    18  * originate from the same detector and uses the values of col0,row0 in both the input and the
    19  * mask to match corresponding pixels.
    20  
    21  * In the event that the mask image is too small (i.e., pixels on the input image refer to
    22  * pixels outside the range of the mask image), the function shall generate an error.
    23  
    24  *  @author Ross Harman, MHPCC
    25  *  @author Eugene Magnier, IfA
    26  *
    27  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    28  *  @date $Date: 2006-06-10 02:59:23 $
    29  *
    30  *  Copyright 2004 IfA, University of Hawaii
    31  */
    32 
    331#if HAVE_CONFIG_H
    342#include <config.h>
     
    364
    375#include <stdio.h>
    38 #include <math.h>
    39 #include <strings.h>
     6#include <pslib.h>
    407
    418#include "pmFPAMaskWeight.h"
    429#include "pmMaskBadPixels.h"
    43 #include "pmMaskBadPixelsErrors.h"
    4410
    45 // apply an externally-supplied mask image to the current science image
    46 // this function
    47 bool pmMaskBadPixels(pmReadout *input, pmReadout *mask, psMaskType maskVal)
     11bool pmMaskBadPixels(pmReadout *input, const pmReadout *mask, psMaskType maskVal)
    4812{
    49 
    50     int xI;
    51     int xJ;
    52 
    5313    PS_ASSERT_PTR_NON_NULL(input, false);
    5414    PS_ASSERT_PTR_NON_NULL(input->mask, false);
    55     PS_ASSERT_IMAGE_TYPE(input->mask, PS_TYPE_MASK, NULL);
     15    PS_ASSERT_IMAGE_TYPE(input->mask, PS_TYPE_MASK, false);
    5616
    5717    PS_ASSERT_PTR_NON_NULL(mask, false);
    5818    PS_ASSERT_PTR_NON_NULL(mask->mask, false);
    59     PS_ASSERT_IMAGE_TYPE(mask->mask, PS_TYPE_MASK, NULL);
     19    PS_ASSERT_IMAGE_TYPE(mask->mask, PS_TYPE_MASK, false);
    6020
    6121    psImage *inMask = input->mask;
     
    6525    int colMax = inMask->col0 + inMask->numCols;
    6626
    67     if (exMask->row0 > inMask->row0) {
     27    if (exMask->row0 > inMask->row0 || exMask->col0 > inMask->col0 ||
     28            exMask->row0 + exMask->numRows < rowMax || exMask->col0 + exMask->numCols < colMax) {
    6829        psError( PS_ERR_BAD_PARAMETER_SIZE, true,
    69                  PS_ERRORTEXT_pmMaskBadPixels_SIZE_INPUT_IMAGE,
    70                  inMask->numRows, inMask->numCols, exMask->numRows, exMask->numCols);
    71         return false;
    72     }
    73     if (exMask->col0 > inMask->col0) {
    74         psError( PS_ERR_BAD_PARAMETER_SIZE, true,
    75                  PS_ERRORTEXT_pmMaskBadPixels_SIZE_INPUT_IMAGE,
    76                  inMask->numRows, inMask->numCols, exMask->numRows, exMask->numCols);
    77         return false;
    78     }
    79     if (exMask->row0 + exMask->numRows < rowMax) {
    80         psError( PS_ERR_BAD_PARAMETER_SIZE, true,
    81                  PS_ERRORTEXT_pmMaskBadPixels_SIZE_INPUT_IMAGE,
    82                  inMask->numRows, inMask->numCols, exMask->numRows, exMask->numCols);
    83         return false;
    84     }
    85     if (exMask->col0 + exMask->numCols < colMax) {
    86         psError( PS_ERR_BAD_PARAMETER_SIZE, true,
    87                  PS_ERRORTEXT_pmMaskBadPixels_SIZE_INPUT_IMAGE,
     30                 "Input image size exceeds that of mask image: (%d, %d) vs (%d, %d)",
    8831                 inMask->numRows, inMask->numCols, exMask->numRows, exMask->numCols);
    8932        return false;
     
    10346        // set raised pixels in exMask which are selected by maskVal
    10447        for (int j = 0; j < inMask->numRows; j++) {
    105             xJ = j - offRow;
     48            int xJ = j - offRow;
    10649            for (int i = 0; i < inMask->numCols; i++) {
    107                 xI = i - offCol;
     50                int xI = i - offCol;
    10851                inVal[j][i] |= (maskVal & exVal[xJ][xI]);
    10952            }
     
    11255        // set raised pixels in exMask which are selected by maskVal
    11356        for (int j = 0; j < inMask->numRows; j++) {
    114             xJ = j - offRow;
     57            int xJ = j - offRow;
    11558            for (int i = 0; i < inMask->numCols; i++) {
    116                 xI = i - offCol;
     59                int xI = i - offCol;
    11760                if (exVal[xJ][xI] == 0) {
    11861                    inVal[j][i] |= PM_MASK_BAD;
  • trunk/psModules/src/detrend/pmMaskBadPixels.h

    r7479 r9616  
    1 /** @file  pmMaskBadPixels.h
    2  *
    3  *  @brief Given an input image, a bad pixel mask, a corresponding value in the bad pixel mask to mask, a
    4  *  saturation level, and a growing radius, mask in the input image those pixels in the bad pixel mask that
    5  *  match the value to mask.
    6  *
    7  *  Given an input image, in, a bad pixel mask, a corresponding value in the bad pixel mask to mask in the
    8  *  input image, maskVal, a saturation level, and a growing radius, pmMaskBadPixels shall mask in the input
    9  *  image those pixels in the bad pixel mask that match the value to mask. Note that the input image, in, is
    10  *  modified in-place. All pixels in the mask which satisfy the maskVal shall have their corresponding pixels
    11  *  masked in the input image, in. All pixels which satisfy the growVal shall have their corresponding
    12  *  pixels, along with all pixels within the grow radius masked. Pixels which have flux greater than sat shall
    13  *  also be masked, but not grown. Note that the input image, in, and the mask need not be the same size,
    14  *  since the input image may already have been trimmed (following overscan subtraction), but the function
    15  *  shall use the offsets in the image (in->x0 and in->y0) to determine the appropriate offsets to obtain the
    16  *  correct pixel on the mask. In the event that the mask image is too small (i.e., pixels on the input image
    17  *  refer to pixels outside the range of the mask image), the function shall generate an error.
    18  *
    19  *  @author Ross Harman, MHPCC
    20  *
    21  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2006-06-10 02:59:23 $
    23  *
    24  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    25  */
     1/// @file pmMaskBadPixels.h
     2///
     3/// @brief Mask bad pixels
     4///
     5/// @ingroup Detrend
     6///
     7/// @author Ross Harman, MHPCC
     8/// @author Eugene Magnier, IfA
     9///
     10/// @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     11/// @date $Date: 2006-10-17 22:17:38 $
     12///
     13/// Copyright 2004 Institute for Astronomy, University of Hawaii
     14///
     15
    2616#ifndef PM_MASK_BAD_PIXELS_H
    2717#define PM_MASK_BAD_PIXELS_H
    2818
    29 #include "pslib.h"
     19#include <pslib.h>
    3020#include "pmFPA.h"
    3121
    32 /** Execute bad pixels module.
    33  *
    34  *
    35  *  @return  bool: True or false for success or failure
    36  */
    37 
    38 bool pmMaskBadPixels(pmReadout *input, pmReadout *mask, psMaskType maskVal);
     22/// Applies the bad pixel mask to the input
     23///
     24/// Pixels marked as bad within the mask are marked as bad within the input image's mask.  If maskVal is
     25/// non-zero, all pixels in the mask have any of the same bits sets as maskVal shall have the corresponding
     26/// bits raised.  If maskVal is zero, any zero pixels in the mask are OR-ed with PM_MASK_BAD.  Position
     27/// offsets (such as due to trimming) between the input and mask are applied so that the same pixels are
     28/// referred to.  The science readout must already have a supplied mask element (use eg. pmReadoutSetMask).
     29/// The supplied mask image must be of MASK type
     30bool pmMaskBadPixels(pmReadout *input,  ///< Input science image
     31                     const pmReadout *mask, ///< Mask image to apply
     32                     psMaskType maskVal ///< Mask value to apply
     33                    );
    3934
    4035#endif
Note: See TracChangeset for help on using the changeset viewer.