IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 26, 2005, 12:35:54 PM (21 years ago)
Author:
drobbin
Message:

Implemented, updated, fixed, debugged the CountPixelMask fxns and tests

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

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/mathtypes/psImage.h

    r5101 r5137  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.71 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-09-23 00:04:36 $
     13 *  @version $Revision: 1.72 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-09-26 22:35:53 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    109109;
    110110
    111 
    112111/** Checks the type of a particular pointer.
    113112 *
  • trunk/psLib/src/mathtypes/psVector.c

    r5114 r5137  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2005-09-24 00:17:44 $
     11*  @version $Revision: 1.57 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2005-09-26 22:35:53 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    948948}
    949949
     950// count number of pixels with given mask value
     951long psVectorCountPixelMask (psVector *mask,
     952                             psMaskType value)
     953{
     954    long Npixels = 0;
     955    if (mask == NULL) {
     956        psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psVector_NULL);
     957        Npixels = -1;
     958        return Npixels;
     959    }
     960
     961    psElemType type;
     962    type = mask->type.type;
     963
     964    switch (type) {
     965    case PS_TYPE_U8:
     966        for (long i = 0; i < mask->n; i++) {
     967            if (mask->data.U8[i] & value) {
     968                Npixels ++;
     969            }
     970        }
     971        break;
     972    case PS_TYPE_S8:
     973    case PS_TYPE_S16:
     974    case PS_TYPE_S32:
     975    case PS_TYPE_S64:
     976    case PS_TYPE_U16:
     977    case PS_TYPE_U32:
     978    case PS_TYPE_U64:
     979    case PS_TYPE_F32:
     980    case PS_TYPE_F64:
     981    case PS_TYPE_C32:
     982    case PS_TYPE_C64:
     983    default:
     984        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     985                PS_ERRORTEXT_psVector_UNSUPPORTED_TYPE, type);
     986        return -1;
     987    }
     988    return (Npixels);
     989}
     990
  • trunk/psLib/src/mathtypes/psVector.h

    r5114 r5137  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-09-24 00:17:44 $
     13 *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-09-26 22:35:53 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    247247);
    248248
     249/** Returns the number of pixels in the vector which satisfy any of the mask bits.
     250 *
     251 *  An error (eg, invalid vector) results in a return value of -1.  The vector must be U8.
     252 *
     253 *  @return long:       the number of pixels counted
     254 */
     255long psVectorCountPixelMask(
     256    psVector *mask,                    ///< input vector to count
     257    psMaskType value                   ///< the mask value to satisfy
     258);
     259
    249260/// @}
    250261
Note: See TracChangeset for help on using the changeset viewer.