IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2093 for trunk/psLib/src/image


Ignore:
Timestamp:
Oct 13, 2004, 1:34:58 PM (22 years ago)
Author:
desonia
Message:

added test for psImageRadialCut.

Location:
trunk/psLib/src/image
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/image/psImageErrors.dat

    r1983 r2093  
    3030psImage_LINE_NOT_IN_IMAGE              Specified line, (%f,%f)->(%f,%f), does not entirely lie in psImage's boundaries, [0:%d,0:%d].
    3131psImage_RADII_VECTOR_NULL              Specified radii vector can not be NULL.
    32 psImage_CENTER_NOT_IN_IMAGE            Specified center, (%d,%d), is outside of the psImage boundaries, [0:%d,0:%d].
     32psImage_CENTER_NOT_IN_IMAGE            Specified center, (%g,%g), is outside of the psImage boundaries, [0:%d,0:%d].
    3333psImage_RADII_VECTOR_TOOSMALL          Input radii vector size, %d, can not be less than 2.
    3434#
  • trunk/psLib/src/image/psImageErrors.h

    r1983 r2093  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-10-06 21:31:30 $
     9 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-13 23:34:57 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5252#define PS_ERRORTEXT_psImage_LINE_NOT_IN_IMAGE "Specified line, (%f,%f)->(%f,%f), does not entirely lie in psImage's boundaries, [0:%d,0:%d]."
    5353#define PS_ERRORTEXT_psImage_RADII_VECTOR_NULL "Specified radii vector can not be NULL."
    54 #define PS_ERRORTEXT_psImage_CENTER_NOT_IN_IMAGE "Specified center, (%d,%d), is outside of the psImage boundaries, [0:%d,0:%d]."
     54#define PS_ERRORTEXT_psImage_CENTER_NOT_IN_IMAGE "Specified center, (%g,%g), is outside of the psImage boundaries, [0:%d,0:%d]."
    5555#define PS_ERRORTEXT_psImage_RADII_VECTOR_TOOSMALL "Input radii vector size, %d, can not be less than 2."
    5656#define PS_ERRORTEXT_psImageFFT_IMAGE_TYPE_UNSUPPORTED "Input psImage type (%s) is not supported. Valid image types are psF32 and psC32."
  • trunk/psLib/src/image/psImageExtraction.c

    r2088 r2093  
    99 *  @author Robert DeSonia, MHPCC
    1010 *
    11  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-13 22:05:03 $
     11 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-13 23:34:57 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    656656        if (numRows != mask->numRows || numCols != mask->numCols) {
    657657            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRadialCut",
    658                        PS_ERR_BAD_PARAMETER_VALUE, true,
     658                       PS_ERR_BAD_PARAMETER_SIZE, true,
    659659                       PS_ERRORTEXT_psImage_IMAGE_MASK_SIZE,
    660660                       mask->numCols,mask->numRows,
    661661                       numCols, numRows);
    662662            psFree(out);
     663            return NULL;
    663664        }
    664665        if (mask->type.type != PS_TYPE_MASK) {
     
    670671                       typeStr, PS_TYPE_MASK_NAME);
    671672            psFree(out);
     673            return NULL;
    672674        }
    673675    }
     
    679681                   PS_ERRORTEXT_psImage_CENTER_NOT_IN_IMAGE,
    680682                   centerCol, centerRow,
    681                    numCols, numRows);
    682         psFree(out);
     683                   numCols-1, numRows-1);
     684        psFree(out);
     685        return NULL;
    683686    }
    684687
     
    693696    if (radii->n < 2) {
    694697        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRadialCut",
    695                    PS_ERR_BAD_PARAMETER_VALUE, true,
     698                   PS_ERR_BAD_PARAMETER_SIZE, true,
    696699                   PS_ERRORTEXT_psImage_RADII_VECTOR_TOOSMALL,
    697700                   radii->n);
     
    713716        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRadialCut",
    714717                   PS_ERR_BAD_PARAMETER_VALUE, false,
    715                    PS_ERRORTEXT_psImage_BAD_STAT);
     718                   PS_ERRORTEXT_psImage_BAD_STAT,
     719                   stats->options);
    716720        psFree(out);
    717721        return NULL;
     
    725729    psF64* outData = out->data.F64;
    726730
    727     // sort the radii by value
    728731    psVector* rSqVec = psVectorCopy(NULL, radii, PS_TYPE_F32);
    729     psVectorSort(rSqVec,rSqVec);
    730732    psF32* rSq = rSqVec->data.F32;
    731733
     
    751753    }
    752754
    753     // Square the data
     755    // Square the radii data
    754756    for (int d = 0; d <= numOut; d++) {
    755757        rSq[d] *= rSq[d];
     
    787789            dY = centerRow - (float)row - 0.5f;
    788790            dist = dX*dX+dY*dY;
    789             for (int r = 0; r < numOut;) {
    790                 if (rSq[r] < dist && dist < rSq[++r]) {
     791            for (int r = 0; r < numOut; r++) {
     792                if (rSq[r] < dist && dist < rSq[r+1]) {
    791793                    int n = buffer[r]->n;
    792794                    if (n == buffer[r]->nalloc) { // in case buffers already full, expand
     
    828830    psFree(buffer);
    829831    psFree(bufferMask);
    830 
     832    psFree(rSqVec);
    831833    return out;
    832834}
Note: See TracChangeset for help on using the changeset viewer.