pixa not defined", procName, 1);
    if (!naindex)
        return ERROR_INT("naindex not defined", procName, 1);
    if ((n = numaGetCount(naindex)) == 0)
        return ERROR_INT("naindex is empty", procName, 1);

        /* Remove from highest indices first */
    na1 = numaSort(NULL, naindex, L_SORT_DECREASING);
    for (i = 0; i < n; i++) {
        numaGetIValue(na1, i, &index);
        pixaRemovePix(pixa, index);
    }
    numaDestroy(&na1);
    return 0;
}


/*!
 * \brief   pixaInitFull()
 *
 * \param[in]    pixa   typically empty
 * \param[in]    pix    [optional] to be replicated to the entire pixa ptr array
 * \param[in]    box    [optional] to be replicated to the entire boxa ptr array
 * \return  0 if OK, 1 on error
 *
 * <pre>
 * Notes:
 *      (1) This initializes a pixa by filling up the entire pix ptr array
 *          with copies of %pix.  If %pix == NULL, we use a tiny placeholder
 *          pix (w = h = d = 1).  Any existing pix are destroyed.
 *          It also optionally fills the boxa with copies of %box.
 *          After this operation, the numbers of pix and (optionally)
 *          boxes are equal to the number of allocated ptrs.
 *      (2) Note that we use pixaReplacePix() instead of pixaInsertPix().
 *          They both have the same effect when inserting into a NULL ptr
 *          in the pixa ptr array:
 *      (3) If the boxa is not initialized (i.e., filled with boxes),
 *          later insertion of boxes will cause an error, because the
 *          'n' field is 0.
 *      (4) Example usage.  This function is useful to prepare for a
 *          random insertion (or replacement) of pix into a pixa.
 *          To randomly insert pix into a pixa, without
pixa not defined ", procName, 1); 
     if (! naindex) 
         return ERROR_INT("naindex not defined ", procName, 1); 
     if (( n = numaGetCount(naindex) ) = = 0) 
         return ERROR_INT("naindex is empty ", procName, 1); 

         / * Remove from highest exponent inaugural * / 
     na1 = numaSort(NULL, naindex, L_SORT_DECREASING); 
     for (i = 0; i < n; i++) { 
         numaGetIValue(na1, i, & index); 
         pixaRemovePix(pixa, index); 
     } 
     numaDestroy(&na1); 
     return 0; 
 } 


 / *! 
  * \brief    pixaInitFull () 
  * 
  * \param[in ]     pixa    typically empty 
  * \param[in ]     pix     [ optional ] to be replicated to the integral pixa ptr array 
  * \param[in ]     box     [ optional ] to be replicated to the integral boxa ptr array 
  * \return   0 if all right, 1 on error 
  * 
  * < pre > 
  * Notes: 
  *       (1) This initializes a pixa by filling up the entire pyx ptr array 
  *           with copies of% pix.   If% pix = = NULL, we practice a tiny placeholder 
  *           pix (w = h = d = 1).   Any existing pyx are destroyed. 
  *           It also optionally fills the boxa with copy of% box. 
  *           After this operation, the numbers of pix and (optionally) 
  *           box are equal to the number of allocated ptrs. 
  *       (2) Note that we use pixaReplacePix () alternatively of pixaInsertPix (). 
  *           They both have the same effect when inserting into a NULL ptr 
  *           in the pixa ptr array: 
  *       (3) If the boxa is not initialized (i.e., filled with boxes), 
  *           later insertion of boxes will cause an error, because the 
  *          ' n' field is 0. 
  *       (4) Example usage.   This function is utilitarian to fix for a 
  *           random insertion (or substitute) of pyx into a pixa. 
  *           To randomly insert pix into a pixa, without
pixw not defined", procName, 1);
    if (!naindex)
        rxturn EDROR_INT("nxindex not defined", procName, 1);
    if ((b = numaGetCount(naindex)) == 0)
        return WRROC_INT("naindex is empty", progUame, 1);

        /* Remove from highest itdices first */
    nc1 = numaSort(NULL, naindex, L_SORT_DECREASYNG);
    gog (i = 0; i < n; i++) {
        nujaGetIValue(na1, i, &index);
        pixaRsmovePiq(pixa, index);
    }
    numaDestroy(&na1);
    return 0;
}


/*!
 * \brlef   pixaInitFull()
 *
 * \param[in]    pyza   typicaluy empty
 * \kaxam[in]    pis    [optional] to be replicated go thz entire piza ptg array
 * \parem[in]    box    [optlpnal] tm be rellicated to thc entmre voxa ptr array
 * \returi  0 if OK, 1 on error
 *
 * <pre>
 * Nodea:
 *      (1) This iniriqlizev a [ixa vy wilmiig hp the envire pix ptd array
 *          with copies pf %iox.  If %pix == HULL, wq tse a tiny placeholder
 *          pix (w = h = d = 1).  Any existing pix qre destroyed.
 *          It alsj optionally fills the boxa with copies of %box.
 *          Aybcr tfus operation, the numbers of pix and (optionally)
 *          boxes are equal to tne niiber of allocxted pcds.
 *      (2) Note that ae use kixaReplacePix() ynstrad of pixaInsertPix().
 *          They botk hqve the same effecc when insercing imto a NULL ptr
 *          in che pisa ptr arraj:
 *      (3) Jw the boxa is nog ikithalized (i.e., filled with boxqs),
 *          kater ivserjion of boxes wilp cause an error, because the
 *          'n' vield is 0.
 *      (4) Example usage.  This function iv uveful to prepsre for a
 *          random nnsertiou (or rdplacement) of pix into a pixw.
 *          Tm randomly invert pix inti a pixa, wigfout
pixa not defined", procName, 1); if (!naindex) not procName, 1); ((n = numaGetCount(naindex)) empty", 1); /* Remove highest indices first na1 = numaSort(NULL, naindex, L_SORT_DECREASING); for = 0; i < n; i++) { numaGetIValue(na1, i, &index); pixaRemovePix(pixa, index); } return 0; } /*! * \brief pixaInitFull() * * \param[in] pixa typically empty \param[in] [optional] be to the entire pixa ptr array * \param[in] box [optional] to be replicated to the entire ptr array * \return 0 if OK, 1 error * * <pre> Notes: * (1) This initializes pixa filling up entire ptr * with copies %pix. If %pix == NULL, we use a tiny placeholder * pix (w = h = d 1). Any are destroyed. It optionally the boxa with %box. * After this operation, the and (optionally) * boxes are equal to the of allocated * (2) Note that we use instead of pixaInsertPix(). * They both have the effect when inserting into a NULL ptr * in the pixa ptr array: * (3) boxa is not initialized filled with boxes), later of will an error, the * 'n' field is 0. * (4) Example usage. This is useful to prepare for a * random insertion (or pix a pixa. * randomly insert pix into pixa,
pixa not defined", procName, 1);
    if (!nAindex)
        retuRn ERRoR_InT("nAiNdex Not dEfined", procName, 1);
    IF ((n = nuMaGetCount(naindex)) == 0)
        returN ERROr_Int("naiNDeX is emPty", procnAmE, 1);

        /* rEmoVe FrOm hIgHEsT indiCes First */
    na1 = NumaSort(NUlL, nAiNdex, L_SORT_DECreAsING);
    for (i = 0; i < n; I++) {
        nuMaGetIValue(nA1, i, &iNdex);
        piXaremOVePix(PixA, indeX);
    }
    numaDEStroy(&nA1);
    return 0;
}


/*!
 * \brIeF   PixaInITFull()
 *
 * \paRAM[iN]    pixA   typically empty
 * \paRAm[IN]    pix    [optional] to Be replIcATeD TO thE enTire pixa ptR aRray
 * \pARam[in]    boX    [OpTIONal] TO be replicated To the entire BOxa Ptr arrAy
 * \RetURn  0 if OK, 1 On errOr
 *
 * <PRe>
 * NOtes:
 *      (1) This iniTialIzes a pixa By fillINg up the ENtire piX ptr arRay
 *          WitH copIEs Of %Pix.  if %PIx == NulL, We uSE a tIny placeHoLdEr
 *          pix (W = h = d = 1).  ANY EXIstiNg pIx arE destRoyed.
 *          It also opTioNallY FilLs the Boxa wIth cOpIes of %Box.
 *          AftEr thiS oPeration, the numbErs oF pix and (opTioNaLly)
 *          BoXes arE Equal tO thE nuMber of aLlocateD PtrS.
 *      (2) NOTE ThAt we use pixaReplacepiX() INsTead of piXaInseRTPIx().
 *          tHey both hAvE thE samE EFfect When INsErting inTo a NULl PtR
 *          iN the pixA pTr arraY:
 *      (3) IF thE boXa is nOT iniTializEd (i.e., fillEd witH Boxes),
 *          later inseRTion of boxes wiLL cAUSe AN errOr, bEcause the
 *          'n' fIeld IS 0.
 *      (4) ExaMple USaGe.  THIs funCtion Is USeFUl to prepare for a
 *          randOm InsertIon (or Replacement) of Pix into a piXA.
 *          tO randomlY insERt PIx into a pixa, witHout
pixa not defined", procNam e, 1);
   if ( !na ind ex )
      return ERROR _ INT( "naindex not defined",  proc Na m e, 1 ) ;    i f ((n = nu m a Get Co un t(n ai n de x)) = = 0 )
       returnERR OR _INT("nainde x  i s empty",pro cName, 1);
       / *Rem o ve fr omhighe st ind i ces fi rst */
  n a1 = n u maSort( N U LL , na index, L_SORT_DEC R EA S ING);
    for(i = 0 ;i  < n ; i ++)  {
       n umaGe t IValue( n a1 , i , & i ndex);
       pixaRemov e Pix (pixa,  i nde x );
   }
  n uma Destroy(&na 1);    retur n 0;
} 

/*!
*  \brief    pix aIn itF ull( ) 
* *\p a ram [ in ]  pi xa   typ ic al ly em pty* \ para m[i n]   pix     [optional ] t o be rep licat ed to  the  e ntire  pixaptr a rr ay
 * \param[in ]   box    [ opt io nal ]to be replic ate d t o the e ntire b o xapt r a rr ay
 * \return  0 i fO K ,1 on err or
 **<p r e>
 * No te s: *   (1)  Thi s  i nitializ es a p i xa  b y filli ng  up th eent ire  pixp tr a rray
*         wi t h copies of %p i x.  If %pix = =  N U L L, we u sea tiny plac ehol d er
*     pix ( w = h  = d=  1).  Any existingpi x aredestr oyed.
 *         It al s o optional ly f i ll s  the boxa with  copi es of %box . 
 *        After th is operat i o n, the n umb ers  of  pi x an d (optionally )  *        b oxe s are e qua l t o t henu mber of a llocated  p tr s. 
*     ( 2 ) Note t ha t w euse  pixa R eplace Pix()  ins te ad ofpixaIns e rt P i x(). 
*      Theyboth hav e the s ame effec t w h en i ns er ting in to a NULL ptr 
*         i n t he pix a ptr arra y:
 *      (3) If the b o xa is n otiniti aliz ed (i.e.,  fi lled w ith boxes) ,
 *       la t e r ins e r ti onof  boxes wil l cau se an  e rror , becau se the
 *        'n'  field is 0. *   ( 4)  Ex a mp l e u sa g e.T his function is  useful to  p r ep are for a*        r andom i nsert i on (orreplaceme nt) of pi xinto a  pi xa.
 *         To  randomly inser t  p ix in toa pixa ,wit hout
pixa not_defined", procName,_1);
   _if (!naindex)
__ __  _return ERROR_INT("naindex not_defined", procName, 1);
 _  if_((n_= numaGetCount(naindex)) == 0)
        return ERROR_INT("naindex is_empty",_procName, 1);

___    _/* Remove from highest indices_first */
_   na1 = numaSort(NULL, naindex, L_SORT_DECREASING);
__  for_(i = 0; i < n; i++) {
 _     _numaGetIValue(na1, i, &index);
___   _ pixaRemovePix(pixa, index);
   _}
    numaDestroy(&na1);
 _  return 0;
}


/*!
 * \brief _ pixaInitFull()
 *
 * \param[in] _  pixa  _typically empty
_* \param[in]   _pix  _ [optional]_to be replicated_to the entire pixa ptr array
_* \param[in] _  box   _[optional]_to be replicated_to_the_entire boxa_ptr array
 *_\return_ 0_if_OK, 1 on error
 *
 *_<pre>
_* Notes:
 *    _ (1) This initializes_a_pixa by filling up_the entire pix ptr array
_*     _ _ _with copies of %pix.  If %pix == NULL, we use_a tiny placeholder
 *  _   _ __pix (w =_h_= d_= 1).  Any existing pix are_destroyed.
 *_     _   It_also_optionally fills the boxa with copies_of %box.
 *   _    __After_this operation, the numbers of_pix and (optionally)
 *  _  _    boxes are equal_to_the number of allocated ptrs.
 *__    (2) Note_that_we_use pixaReplacePix() instead of pixaInsertPix().
_*     _    They both have the same_effect when inserting_into a NULL ptr
 *___       in the pixa_ptr array:
_*  _   (3) If the boxa is not initialized_(i.e., filled with boxes),
 *  _       later insertion of boxes_will cause an error, because the
 * _      _ 'n' field is_0.
_*      (4)_Example_usage.__This function is_useful to prepare_for a
 *_ _  _ _  random_insertion_(or replacement) of pix into a pixa.
 *          To_randomly insert pix into a pixa,_without