IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 3, 2005, 11:43:17 AM (21 years ago)
Author:
gusciora
Message:

Worked on pmObjects.c and test functions. They should pass.

File:
1 edited

Legend:

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

    r4030 r4097  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-05-25 20:28:32 $
     7 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-06-03 21:43:03 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    298298XXX: In the output psArray elements, should we use the image row/column offsets?
    299299     Currently, we do not.
     300 
     301XXX: Merge with CVS 1.20.  This had the proper code for images with a single
     302row or column.
    300303*****************************************************************************/
    301304psArray *pmFindImagePeaks(const psImage *image,
     
    306309    if ((image->numRows == 1) || (image->numCols == 1)) {
    307310        psError(PS_ERR_UNKNOWN, true, "Currently, input image must have at least 2 rows and 2 columns.");
     311        return(NULL);
    308312    }
    309313    psVector *tmpRow = NULL;
     
    321325    for (psU32 i = 0 ; i < row1->n ; i++ ) {
    322326        col = row1->data.U32[i];
    323 
    324327        //
    325328        // Determine if pixel (0,0) is a peak.
     
    329332                    (image->data.F32[row][col] >  image->data.F32[row+1][col]) &&
    330333                    (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) {
     334
    331335                if (image->data.F32[row][col] > threshold) {
    332336                    list = MyListAddPeak(list, row, col, image->data.F32[row][col], PM_PEAK_EDGE);
     
    622626
    623627    // XXX EAM : I added this code to stay on the image. So did George
    624     psS32 SubImageStartRow  = PS_MAX (0, SubImageCenterRow - outerRadiusS32);
    625     psS32 SubImageEndRow    = PS_MIN (image->numRows - 1, SubImageCenterRow + outerRadiusS32);
    626     psS32 SubImageStartCol  = PS_MAX (0, SubImageCenterCol - outerRadiusS32);
    627     psS32 SubImageEndCol    = PS_MIN (image->numCols - 1, SubImageCenterCol + outerRadiusS32);
     628    psS32 SubImageStartRow  = PS_MAX(0, SubImageCenterRow - outerRadiusS32);
     629    psS32 SubImageEndRow    = PS_MIN(image->numRows - 1, SubImageCenterRow + outerRadiusS32);
     630    psS32 SubImageStartCol  = PS_MAX(0, SubImageCenterCol - outerRadiusS32);
     631    psS32 SubImageEndCol    = PS_MIN(image->numCols - 1, SubImageCenterCol + outerRadiusS32);
    628632    // AnulusWidth == number of pixels width in the annulus.  We add one since
    629633    // the pixels at the inner AND outher radius are included.
     
    670674    //                                      SubImageEndCol,
    671675    //                                      SubImageEndRow);
    672     psImage *subImage = NULL;
    673676    //    printf("pmSourceLocalSky: subimage width/length is (%d, %d)\n", subImage->numCols, subImage->numRows);
     677    psRegion tmpRegion = psRegionSet(SubImageStartCol,
     678                                     SubImageEndCol,
     679                                     SubImageStartRow,
     680                                     SubImageEndRow);
     681    psImage *subImage = psImageSubset((psImage *) image, tmpRegion);
     682
    674683    psImage *subImageMask = psImageAlloc(subImage->numCols,
    675684                                         subImage->numRows,
     
    13101319        psFree(source->models);
    13111320    }
     1321    if (!((model == PS_MODEL_GAUSS) ||
     1322            (model == PS_MODEL_PGAUSS) ||
     1323            (model == PS_MODEL_WAUSS) ||
     1324            (model == PS_MODEL_TWIST_GAUSS) ||
     1325            (model == PS_MODEL_SERSIC) ||
     1326            (model == PS_MODEL_SERSIC_CORE))) {
     1327        psError(PS_ERR_UNKNOWN, true, "Undefined psModelType");
     1328        return(false);
     1329    }
     1330
    13121331    source->models = pmModelAlloc(model);
    13131332
     
    18731892                      psVector *x)
    18741893{
     1894    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
     1895    PS_ASSERT_VECTOR_NON_NULL(x, NAN);
    18751896    psF32 X  = x->data.F32[0] - params->data.F32[2];
    18761897    psF32 Y  = x->data.F32[1] - params->data.F32[3];
     
    19071928                            psVector *x)
    19081929{
     1930    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
     1931    PS_ASSERT_VECTOR_NON_NULL(x, NAN);
    19091932    psF32 X  = x->data.F32[0] - params->data.F32[2];
    19101933    psF32 Y  = x->data.F32[1] - params->data.F32[3];
     
    19451968                      psVector *x)
    19461969{
     1970    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
     1971    PS_ASSERT_VECTOR_NON_NULL(x, NAN);
    19471972    psF32 X = x->data.F32[0] - params->data.F32[2];
    19481973    psF32 Y = x->data.F32[1] - params->data.F32[2];
     
    19912016                           psVector *x)
    19922017{
     2018    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
     2019    PS_ASSERT_VECTOR_NON_NULL(x, NAN);
    19932020    psF32 X = x->data.F32[0] - params->data.F32[2];
    19942021    psF32 Y = x->data.F32[1] - params->data.F32[3];
     
    20472074                     psVector *x)
    20482075{
     2076    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
     2077    PS_ASSERT_VECTOR_NON_NULL(x, NAN);
    20492078    psError(PS_ERR_UNKNOWN, true, "This function is not implemented yet.");
    20502079    return(0.0);
     
    20702099                         psVector *x)
    20712100{
     2101    PS_ASSERT_VECTOR_NON_NULL(params, NAN);
     2102    PS_ASSERT_VECTOR_NON_NULL(x, NAN);
    20722103    psError(PS_ERR_UNKNOWN, true, "This function is not implemented yet.");
    20732104    return(0.0);
Note: See TracChangeset for help on using the changeset viewer.