src/numafunc1.c
NUMA *
numaRemoveBorder(NUMA      *nas,
                 l_int32    left,
                 l_int32    right)
{
l_int32     i, n, len;
l_float32   startx, delx;
l_float32  *fas, *fad;
NUMA       *nad;

    PROCNAME("numaRemoveBorder");

    if (!nas)
        return (NUMA *)ERROR_PTR("nas not defined", procName, NULL);
    if (left < 0) left = 0;
    if (right < 0) right = 0;
    if (left == 0 && right == 0)
        return numaCopy(nas);

    n = numaGetCount(nas);
    if ((len = n - left - right) < 0)
        return (NUMA *)ERROR_PTR("len < 0 after removal", procName, NULL);
    nad = numaMakeConstant(0, len);
    numaGetXParameters(nas, &startx, &delx);
    numaSetXParameters(nad, startx + delx * left, delx);
    fas = numaGetFArray(nas, L_NOCOPY);
    fad = numaGetFArray(nad, L_NOCOPY);
    for (i = 0; i < len; i++)
        fad[i] = fas[left + i];

    return nad;
}
/*!
 *  numaRemoveBorder()
 *
 *      Input:  nas
 *              left, right (number of elements to remove from each side)
 *      Return: nad (with removed elements at left and right), or null on error
 */
numaRemoveBorder()
Input:  nas
left, right (number of elements to remove from each side)
Return: nad (with removed elements at left and right), or null on error
numaRemoveBorder () Input : nas left right ( number of elements to remove from each side ) Return : nad ( with removed elements at left and right ) or null on error
NUMA *
numaRemoveBorder(NUMA      *nas,
                 l_int32    left,
                 l_int32    right)
{
l_int32     i, n, len;
l_float32   startx, delx;
l_float32  *fas, *fad;
NUMA       *nad;
    PROCNAME("numaRemoveBorder");
    if (!nas)
        return (NUMA *)ERROR_PTR("nas not defined", procName, NULL);
    if (left < 0) left = 0;
    if (right < 0) right = 0;
    if (left == 0 && right == 0)
        return numaCopy(nas);
    n = numaGetCount(nas);
    if ((len = n - left - right) < 0)
        return (NUMA *)ERROR_PTR("len < 0 after removal", procName, NULL);
    nad = numaMakeConstant(0, len);
    numaGetXParameters(nas, &startx, &delx);
    numaSetXParameters(nad, startx + delx * left, delx);
    fas = numaGetFArray(nas, L_NOCOPY);
    fad = numaGetFArray(nad, L_NOCOPY);
    for (i = 0; i < len; i++)
        fad[i] = fas[left + i];
    return nad;
}
NUMA * numaRemoveBorder ( NUMA * nas , l_int32 left , l_int32 right ) { l_int32 i , n , len ; l_float32 startx , delx ; l_float32 * fas , * fad ; NUMA * nad ; PROCNAME ( " " ) ; if ( ! nas ) return ( NUMA * ) ERROR_PTR ( " " , procName , NULL ) ; if ( left < 0 ) left = 0 ; if ( right < 0 ) right = 0 ; if ( left == 0 && right == 0 ) return numaCopy ( nas ) ; n = numaGetCount ( nas ) ; if ( ( len = n - left - right ) < 0 ) return ( NUMA * ) ERROR_PTR ( " " , procName , NULL ) ; nad = numaMakeConstant ( 0 , len ) ; numaGetXParameters ( nas , & startx , & delx ) ; numaSetXParameters ( nad , startx + delx * left , delx ) ; fas = numaGetFArray ( nas , L_NOCOPY ) ; fad = numaGetFArray ( nad , L_NOCOPY ) ; for ( i = 0 ; i < len ; i ++ ) fad [ i ] = fas [ left + i ] ; return nad ; }
numaRemoveBorder()
      Input:  nas
              left, right (number of elements to remove from each side)
      Return: nad (with removed elements at left and right), or null on error
numaRemoveBorder () Input : nas left right ( number of elements to remove from each side ) Return : nad ( with removed elements at left and right ) or null on error