IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 22, 2004, 9:58:57 AM (22 years ago)
Author:
harman
Message:

Added more tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/pmFlatField.c

    r1832 r1849  
    1818 *  @author Ross Harman, MHPCC
    1919 *
    20  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    21  *  @date $Date: 2004-09-20 20:36:46 $
     20 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     21 *  @date $Date: 2004-09-22 19:58:57 $
    2222 *
    2323 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131#include<math.h>
    3232
     33#include "pslib.h"
    3334#include "pmFlatField.h"
    3435#include "pmMaskBadPixels.h"
     
    5051    // Check for nulls
    5152    if (in == NULL) {
    52         psError(__func__, " : Line %d - Null not allowed for input readout", __LINE__);
    5353        return false;
    5454    } else if(flat==NULL) {
     
    7171
    7272    // Check input image and its mask are not larger than flat image
    73     if(inImage->numRows > flatImage->numRows) {
    74         psError(__func__, " : Line %d - Input image exceeds mask image in number of rows. (%d vs %d).",
    75                 __LINE__, inImage->numRows, flatImage->numRows);
     73    if(inImage->numRows>flatImage->numRows || inImage->numCols>flatImage->numCols) {
     74        psError(__func__, " : Line %d - Input image size exceeds that of flat image: (%d, %d) vs (%d, %d)",
     75                __LINE__, inImage->numRows, inImage->numCols, flatImage->numRows, flatImage->numCols);
    7676        return false;
    77     } else if(inImage->numCols > flatImage->numCols) {
    78         psError(__func__, " : Line %d - Input image exceeds mask image in number of columns. (%d vs %d).",
    79                 __LINE__, inImage->numCols, flatImage->numCols);
    80         return false;
    81     } else if(inMask->numRows > flatImage->numRows) {
    82         psError(__func__, " : Line %d - Input image mask exceeds mask image in number of rows. (%d vs %d).",
    83                 __LINE__, inImage->numRows, flatImage->numRows);
    84         return false;
    85     } else if(inMask->numCols > flatImage->numCols) {
    86         psError(__func__, " : Line %d - Input image mask exceeds mask image in number of columns. (%d vs %d).",
    87                 __LINE__, inImage->numCols, flatImage->numCols);
     77    } else if(inMask->numRows>flatImage->numRows || inMask->numCols > flatImage->numCols) {
     78        psError(__func__, " : Line %d - Input image mask size exceeds that of flat image: (%d, %d) vs (%d, %d)",
     79                __LINE__, inMask->numRows, inMask->numCols, flatImage->numRows, flatImage->numCols);
    8880        return false;
    8981    }
     
    9486
    9587    // Check that offsets are within image limits
    96     if(totOffRow > flatImage->numRows-1) {
    97         psError(__func__, " : Line %d - Initial row offset exceeds that of mask image. (%d vs %d).",
    98                 __LINE__, totOffRow, flatImage->numRows);
     88    if(totOffRow>=flatImage->numRows || totOffCol>=flatImage->numCols) {
     89        psError(__func__, " : Line %d - Total offset >= flat image size: (%d, %d) vs (%d, %d)",
     90                __LINE__, totOffRow, totOffCol, flatImage->numRows, flatImage->numCols);
    9991        return false;
    100     } else if(totOffCol > flatImage->numCols-1) {
    101         psError(__func__, " : Line %d - Initial column offset exceeds that of mask image. (%d vs %d).",
    102                 __LINE__, totOffCol, flatImage->numCols);
     92    } else if(totOffRow>=inImage->numRows || totOffCol>=inImage->numCols) {
     93        psError(__func__, " : Line %d - Total offset >= input image: (%d, %d) vs (%d, %d)",
     94                __LINE__, totOffRow, totOffCol, inImage->numRows, inImage->numCols);
    10395        return false;
    104     } else if(totOffRow > inImage->numRows-1) {
    105         psError(__func__, " : Line %d - Initial row offset exceeds that of input image. (%d vs %d).",
    106                 __LINE__, totOffRow, inImage->numRows);
    107         return false;
    108     } else if(totOffCol > inImage->numCols-1) {
    109         psError(__func__, " : Line %d - Initial column offset exceeds that of input image. (%d vs %d).",
    110                 __LINE__, totOffCol, inImage->numCols);
    111         return false;
    112     } else if(totOffRow > inMask->numRows-1) {
    113         psError(__func__, " : Line %d - Initial row offset exceeds that of input image mask. (%d vs %d).",
    114                 __LINE__, totOffRow, inMask->numRows);
    115         return false;
    116     } else if(totOffCol > inMask->numCols-1) {
    117         psError(__func__, " : Line %d - Initial column offset exceeds that of input image mask. (%d vs %d).",
    118                 __LINE__, totOffCol, inMask->numCols);
     96    } else if(totOffRow>=inMask->numRows || totOffCol>=inMask->numCols) {
     97        psError(__func__, " : Line %d - Total offset >= input image mask: (%d, %d) vs (%d, %d)",
     98                __LINE__, totOffRow, totOffCol, inMask->numRows, inMask->numCols);
    11999        return false;
    120100    }
     
    136116        return false;
    137117    } else if(inType != flatType) {
    138         psError(__func__, " : Line %d - Input and flat image types differ. (%d vs %d)", __LINE__, inType,
     118        psError(__func__, " : Line %d - Input and flat image types differ: (%d vs %d)", __LINE__, inType,
    139119                flatType);
    140120        return false;
     
    149129            if(flatImage->data.TYPE[j][i] <= 0.0) {                                                          \
    150130                /* Negative or zero flat pixels shall be masked in input image as  PM_MASK_FLAT */           \
    151                 inMask->data.PS_TYPE_MASK_DATA[j][i] = PM_MASK_FLAT;                                         \
     131                inMask->data.PS_TYPE_MASK_DATA[j][i] |= PM_MASK_FLAT;                                        \
    152132            }                                                                                                \
    153133        }                                                                                                    \
     
    178158    }
    179159
    180     printf("");
    181160    return true;
    182161}
Note: See TracChangeset for help on using the changeset viewer.