src/pixabasic.c
PIXAA *
pixaaCreate(l_int32  n)
{
PIXAA  *pixaa;

    PROCNAME("pixaaCreate");

    if (n <= 0)
        n = INITIAL_PTR_ARRAYSIZE;

    if ((pixaa = (PIXAA *)CALLOC(1, sizeof(PIXAA))) == NULL)
        return (PIXAA *)ERROR_PTR("pixaa not made", procName, NULL);
    pixaa->n = 0;
    pixaa->nalloc = n;
    
    if ((pixaa->pixa = (PIXA **)CALLOC(n, sizeof(PIXA *))) == NULL)
        return (PIXAA *)ERROR_PTR("pixa ptrs not made", procName, NULL);
    pixaa->boxa = boxaCreate(n);

    return pixaa;
}
/*!
 *  pixaaCreate()
 *
 *      Input:  n  (initial number of pixa ptrs)
 *      Return: pixaa, or null on error
 *
 *  Notes:
 *      (1) A pixaa provides a 2-level hierarchy of images.
 *          A common use is for segmentation masks, which are
 *          inexpensive to store in png format.
 *      (2) For example, suppose you want a mask for each textline
 *          in a two-column page.  The textline masks for each column
 *          can be represented by a pixa, of which there are 2 in the pixaa.
 *          The boxes for the textline mask components within a column
 *          can have their origin referred to the column rather than the page.
 *          Then the boxa field can be used to represent the two box (regions)
 *          for the columns, and the (x,y) components of each box can
 *          be used to get the absolute position of the textlines on
 *          the page.
 */
pixaaCreate()
Input:  n  (initial number of pixa ptrs)
Return: pixaa, or null on error

(1) A pixaa provides a 2-level hierarchy of images.
A common use is for segmentation masks, which are
inexpensive to store in png format.
(2) For example, suppose you want a mask for each textline
in a two-column page.  The textline masks for each column
can be represented by a pixa, of which there are 2 in the pixaa.
The boxes for the textline mask components within a column
can have their origin referred to the column rather than the page.
Then the boxa field can be used to represent the two box (regions)
for the columns, and the (x,y) components of each box can
be used to get the absolute position of the textlines on
the page.
pixaaCreate () Input : n ( initial number of pixa ptrs ) Return : pixaa or null on error ( 1 ) A pixaa provides a 2 - level hierarchy of images . A common use is for segmentation masks which are inexpensive to store in png format . ( 2 ) For example suppose you want a mask for each textline in a two - column page . The textline masks for each column can be represented by a pixa of which there are 2 in the pixaa . The boxes for the textline mask components within a column can have their origin referred to the column rather than the page . Then the boxa field can be used to represent the two box ( regions ) for the columns and the ( x y ) components of each box can be used to get the absolute position of the textlines on the page .
PIXAA *
pixaaCreate(l_int32  n)
{
PIXAA  *pixaa;
    PROCNAME("pixaaCreate");
    if (n <= 0)
        n = INITIAL_PTR_ARRAYSIZE;
    if ((pixaa = (PIXAA *)CALLOC(1, sizeof(PIXAA))) == NULL)
        return (PIXAA *)ERROR_PTR("pixaa not made", procName, NULL);
    pixaa->n = 0;
    pixaa->nalloc = n;
    if ((pixaa->pixa = (PIXA **)CALLOC(n, sizeof(PIXA *))) == NULL)
        return (PIXAA *)ERROR_PTR("pixa ptrs not made", procName, NULL);
    pixaa->boxa = boxaCreate(n);
    return pixaa;
}
PIXAA * pixaaCreate ( l_int32 n ) { PIXAA * pixaa ; PROCNAME ( " " ) ; if ( n <= 0 ) n = INITIAL_PTR_ARRAYSIZE ; if ( ( pixaa = ( PIXAA * ) CALLOC ( 1 , sizeof ( PIXAA ) ) ) == NULL ) return ( PIXAA * ) ERROR_PTR ( " " , procName , NULL ) ; pixaa -> n = 0 ; pixaa -> nalloc = n ; if ( ( pixaa -> pixa = ( PIXA * * ) CALLOC ( n , sizeof ( PIXA * ) ) ) == NULL ) return ( PIXAA * ) ERROR_PTR ( " " , procName , NULL ) ; pixaa -> boxa = boxaCreate ( n ) ; return pixaa ; }
pixaaCreate()
      Input:  n  (initial number of pixa ptrs)
      Return: pixaa, or null on error
pixaaCreate () Input : n ( initial number of pixa ptrs ) Return : pixaa or null on error