Leptonica  1.82.0
Image processing and image analysis suite
numabasic.c File Reference
#include <string.h>
#include <math.h>
#include "allheaders.h"

Go to the source code of this file.

Functions

static l_int32 numaExtendArray (NUMA *na)
 
static l_int32 numaaExtendArray (NUMAA *naa)
 
NUMAnumaCreate (l_int32 n)
 
NUMAnumaCreateFromIArray (l_int32 *iarray, l_int32 size)
 
NUMAnumaCreateFromFArray (l_float32 *farray, l_int32 size, l_int32 copyflag)
 
NUMAnumaCreateFromString (const char *str)
 
void numaDestroy (NUMA **pna)
 
NUMAnumaCopy (NUMA *na)
 
NUMAnumaClone (NUMA *na)
 
l_ok numaEmpty (NUMA *na)
 
l_ok numaAddNumber (NUMA *na, l_float32 val)
 
l_ok numaInsertNumber (NUMA *na, l_int32 index, l_float32 val)
 
l_ok numaRemoveNumber (NUMA *na, l_int32 index)
 
l_ok numaReplaceNumber (NUMA *na, l_int32 index, l_float32 val)
 
l_int32 numaGetCount (NUMA *na)
 
l_ok numaSetCount (NUMA *na, l_int32 newcount)
 
l_ok numaGetFValue (NUMA *na, l_int32 index, l_float32 *pval)
 
l_ok numaGetIValue (NUMA *na, l_int32 index, l_int32 *pival)
 
l_ok numaSetValue (NUMA *na, l_int32 index, l_float32 val)
 
l_ok numaShiftValue (NUMA *na, l_int32 index, l_float32 diff)
 
l_int32 * numaGetIArray (NUMA *na)
 
l_float32 * numaGetFArray (NUMA *na, l_int32 copyflag)
 
l_int32 numaGetRefcount (NUMA *na)
 
l_ok numaChangeRefcount (NUMA *na, l_int32 delta)
 
l_ok numaGetParameters (NUMA *na, l_float32 *pstartx, l_float32 *pdelx)
 
l_ok numaSetParameters (NUMA *na, l_float32 startx, l_float32 delx)
 
l_ok numaCopyParameters (NUMA *nad, NUMA *nas)
 
SARRAYnumaConvertToSarray (NUMA *na, l_int32 size1, l_int32 size2, l_int32 addzeros, l_int32 type)
 
NUMAnumaRead (const char *filename)
 
NUMAnumaReadStream (FILE *fp)
 
NUMAnumaReadMem (const l_uint8 *data, size_t size)
 
l_ok numaWriteDebug (const char *filename, NUMA *na)
 
l_ok numaWrite (const char *filename, NUMA *na)
 
l_ok numaWriteStream (FILE *fp, NUMA *na)
 
l_ok numaWriteStderr (NUMA *na)
 
l_ok numaWriteMem (l_uint8 **pdata, size_t *psize, NUMA *na)
 
NUMAAnumaaCreate (l_int32 n)
 
NUMAAnumaaCreateFull (l_int32 nptr, l_int32 n)
 
l_ok numaaTruncate (NUMAA *naa)
 
void numaaDestroy (NUMAA **pnaa)
 
l_ok numaaAddNuma (NUMAA *naa, NUMA *na, l_int32 copyflag)
 
l_int32 numaaGetCount (NUMAA *naa)
 
l_int32 numaaGetNumaCount (NUMAA *naa, l_int32 index)
 
l_int32 numaaGetNumberCount (NUMAA *naa)
 
NUMA ** numaaGetPtrArray (NUMAA *naa)
 
NUMAnumaaGetNuma (NUMAA *naa, l_int32 index, l_int32 accessflag)
 
l_ok numaaReplaceNuma (NUMAA *naa, l_int32 index, NUMA *na)
 
l_ok numaaGetValue (NUMAA *naa, l_int32 i, l_int32 j, l_float32 *pfval, l_int32 *pival)
 
l_ok numaaAddNumber (NUMAA *naa, l_int32 index, l_float32 val)
 
NUMAAnumaaRead (const char *filename)
 
NUMAAnumaaReadStream (FILE *fp)
 
NUMAAnumaaReadMem (const l_uint8 *data, size_t size)
 
l_ok numaaWrite (const char *filename, NUMAA *naa)
 
l_ok numaaWriteStream (FILE *fp, NUMAA *naa)
 
l_ok numaaWriteMem (l_uint8 **pdata, size_t *psize, NUMAA *naa)
 

Variables

static const l_uint32 MaxFloatArraySize = 100000000
 
static const l_uint32 MaxPtrArraySize = 1000000
 
static const l_int32 InitialArraySize = 50
 

Detailed Description


     Numa creation, destruction, copy, clone, etc.
         NUMA        *numaCreate()
         NUMA        *numaCreateFromIArray()
         NUMA        *numaCreateFromFArray()
         NUMA        *numaCreateFromString()
         void        *numaDestroy()
         NUMA        *numaCopy()
         NUMA        *numaClone()
         l_int32      numaEmpty()

     Add/remove number (float or integer)
         l_int32      numaAddNumber()
         static l_int32  numaExtendArray()
         l_int32      numaInsertNumber()
         l_int32      numaRemoveNumber()
         l_int32      numaReplaceNumber()

     Numa accessors
         l_int32      numaGetCount()
         l_int32      numaSetCount()
         l_int32      numaGetIValue()
         l_int32      numaGetFValue()
         l_int32      numaSetValue()
         l_int32      numaShiftValue()
         l_int32     *numaGetIArray()
         l_float32   *numaGetFArray()
         l_int32      numaGetRefcount()
         l_int32      numaChangeRefcount()
         l_int32      numaGetParameters()
         l_int32      numaSetParameters()
         l_int32      numaCopyParameters()

     Convert to string array
         SARRAY      *numaConvertToSarray()

     Serialize numa for I/O
         NUMA        *numaRead()
         NUMA        *numaReadStream()
         NUMA        *numaReadMem()
         l_int32      numaWriteDebug()
         l_int32      numaWrite()
         l_int32      numaWriteStream()
         l_int32      numaWriteStderr()
         l_int32      numaWriteMem()

     Numaa creation, destruction, truncation
         NUMAA       *numaaCreate()
         NUMAA       *numaaCreateFull()
         NUMAA       *numaaTruncate()
         void        *numaaDestroy()

     Add Numa to Numaa
         l_int32      numaaAddNuma()
         static l_int32   numaaExtendArray()

     Numaa accessors
         l_int32      numaaGetCount()
         l_int32      numaaGetNumaCount()
         l_int32      numaaGetNumberCount()
         NUMA       **numaaGetPtrArray()
         NUMA        *numaaGetNuma()
         NUMA        *numaaReplaceNuma()
         l_int32      numaaGetValue()
         l_int32      numaaAddNumber()

     Serialize numaa for I/O
         NUMAA       *numaaRead()
         NUMAA       *numaaReadStream()
         NUMAA       *numaaReadMem()
         l_int32      numaaWrite()
         l_int32      numaaWriteStream()
         l_int32      numaaWriteMem()

   (1) The Numa is a struct holding an array of floats.  It can also
       be used to store l_int32 values, with some loss of precision
       for floats larger than about 10 million.  Use the L_Dna instead
       if integers larger than a few million need to be stored.

   (2) Always use the accessors in this file, never the fields directly.

   (3) Storing and retrieving numbers:

      * to append a new number to the array, use numaAddNumber().  If
        the number is an int, it will will automatically be converted
        to l_float32 and stored.

      * to reset a value stored in the array, use numaSetValue().

      * to increment or decrement a value stored in the array,
        use numaShiftValue().

      * to obtain a value from the array, use either numaGetIValue()
        or numaGetFValue(), depending on whether you are retrieving
        an integer or a float.  This avoids doing an explicit cast,
        such as
          (a) return a l_float32 and cast it to an l_int32
          (b) cast the return directly to (l_float32 *) to
              satisfy the function prototype, as in
                numaGetFValue(na, index, (l_float32 *)&ival);   [ugly!]

   (4) int <--> float conversions:

       Tradition dictates that type conversions go automatically from
       l_int32 --> l_float32, even though it is possible to lose
       precision for large integers, whereas you must cast (l_int32)
       to go from l_float32 --> l_int32 because you're truncating
       to the integer value.

   (5) As with other arrays in leptonica, the numa has both an allocated
       size and a count of the stored numbers.  When you add a number, it
       goes on the end of the array, and causes a realloc if the array
       is already filled.  However, in situations where you want to
       add numbers randomly into an array, such as when you build a
       histogram, you must set the count of stored numbers in advance.
       This is done with numaSetCount().  If you set a count larger
       than the allocated array, it does a realloc to the size requested.

   (6) In situations where the data in a numa correspond to a function
       y(x), the values can be either at equal spacings in x or at
       arbitrary spacings.  For the former, we can represent all x values
       by two parameters: startx (corresponding to y[0]) and delx
       for the change in x for adjacent values y[i] and y[i+1].
       startx and delx are initialized to 0.0 and 1.0, rsp.
       For arbitrary spacings, we use a second numa, and the two
       numas are typically denoted nay and nax.

   (7) The numa is also the basic struct used for histograms.  Every numa
       has startx and delx fields, initialized to 0.0 and 1.0, that can
       be used to represent the "x" value for the location of the
       first bin and the bin width, respectively.  Accessors are the
       numa*Parameters() functions.  All functions that make numa
       histograms must set these fields properly, and many functions
       that use numa histograms rely on the correctness of these values.

Definition in file numabasic.c.

Function Documentation

◆ numaaAddNuma()

l_ok numaaAddNuma ( NUMAA naa,
NUMA na,
l_int32  copyflag 
)

◆ numaaAddNumber()

l_ok numaaAddNumber ( NUMAA naa,
l_int32  index,
l_float32  val 
)

numaaAddNumber()

Parameters
[in]naa
[in]indexof numa within numaa
[in]valfloat or int to be added; stored as a float
Returns
0 if OK, 1 on error
Notes:
     (1) Adds to an existing numa only.

Definition at line 1852 of file numabasic.c.

References L_CLONE, numaAddNumber(), numaaGetCount(), numaaGetNuma(), and numaDestroy().

Referenced by boxaSort2d(), and recogTrainingFinished().

◆ numaaCreate()

NUMAA* numaaCreate ( l_int32  n)

numaaCreate()

Parameters
[in]nsize of numa ptr array to be alloc'd 0 for default
Returns
naa, or NULL on error

Definition at line 1407 of file numabasic.c.

Referenced by boxaExtractSortedPattern(), boxaFindNearestBoxes(), boxaSort2d(), ccbaGenerateStepChains(), ccbaReadStream(), l_uncompressGrayHistograms(), numaaCreateFull(), pixGetGrayHistogramTiled(), ptraConcatenatePdfToData(), and recogExtractNumbers().

◆ numaaCreateFull()

NUMAA* numaaCreateFull ( l_int32  nptr,
l_int32  n 
)

numaaCreateFull()

Parameters
[in]nptrsize of numa ptr array to be alloc'd
[in]nsize of individual numa arrays to be allocated to 0 for default
Returns
naa, or NULL on error
Notes:
     (1) This allocates numaa and fills the array with allocated numas.
         In use, after calling this function, use
             numaaAddNumber(naa, index, val);
         to add val to the index-th numa in naa.

Definition at line 1445 of file numabasic.c.

References L_INSERT, numaaAddNuma(), numaaCreate(), and numaCreate().

Referenced by recogTrainingFinished().

◆ numaAddNumber()

l_ok numaAddNumber ( NUMA na,
l_float32  val 
)

numaAddNumber()

Parameters
[in]na
[in]valfloat or int to be added; stored as a float
Returns
0 if OK, 1 on error

Definition at line 478 of file numabasic.c.

References Numa::array, Numa::n, Numa::nalloc, numaExtendArray(), and numaGetCount().

Referenced by addColorizedGrayToCmap(), bmfGetWordWidths(), boxaaFlattenToBoxa(), boxaBinSort(), boxaExtractAsNuma(), boxaExtractSortedPattern(), boxaFindNearestBoxes(), boxaGetSizes(), boxaMakeAreaIndicator(), boxaMakeSizeIndicator(), boxaMakeWHRatioIndicator(), boxaMedianDimensions(), boxaPlotSides(), boxaPlotSizes(), boxaReconcileSizeByMedian(), boxaSimilar(), boxaSizeConsistency(), boxaSort2d(), ccbaGenerateStepChains(), ccbaReadStream(), compareTilesByHisto(), dewarpaListPages(), dewarpFindVertDisparity(), dewarpIsLineCoverageValid(), dewarpLinearLSF(), dewarpQuadraticLSF(), evalColorfillData(), genConstrainedNumaInRange(), grayHistogramsToEMD(), grayInterHistogramStats(), l_dnaConvertToNuma(), l_uncompressGrayHistograms(), mergeLookup(), numaaAddNumber(), numaClipToInterval(), numaConvertToInt(), numaCopy(), numaCreateFromFArray(), numaCreateFromIArray(), numaCrossingsByPeaks(), numaCrossingsByThreshold(), numaDifferentiateInterval(), numaDiscretizeHistoInBins(), numaDiscretizeSortedInBins(), numaFindExtrema(), numaFindPeaks(), numaGammaTRC(), numaGetCrossingDistances(), numaGetMedianDevFromMedian(), numaGetPartialSums(), numaGetPeakCentroids(), numaGetSortIndex(), numaGetUniformBinSizes(), numaInterpolateArbxInterval(), numaInterpolateEqxInterval(), numaJoin(), numaLocatePeakRanges(), numaLowPassIntervals(), numaMakeDelta(), numaMakeHistogramAuto(), numaMakeRankFromHistogram(), numaMakeSequence(), numaMakeThresholdIndicator(), numaNormalizeHistogram(), numaQuantizeCrossingsByWindow(), numaRandomPermutation(), numaRebinHistogram(), numaReverse(), numaSelectCrossingThreshold(), numaSortByIndex(), numaSplitDistribution(), numaSubsample(), numaThresholdEdges(), numaTransform(), numaUniformSampling(), numaWindowedMedian(), parseStringForNumbers(), pixaaFlattenToPixa(), pixaaGetCount(), pixaBinSort(), pixaComparePhotoRegionsByHisto(), pixaDisplayTiledInRows(), pixaFindAreaFraction(), pixaFindDimensions(), pixaFindPerimSizeRatio(), pixaFindPerimToAreaRatio(), pixaFindStrokeWidth(), pixaFindWidthHeightProduct(), pixaFindWidthHeightRatio(), pixaMakeSizeIndicator(), pixaSelectByNumConnComp(), pixcmapGetRankIntensity(), ptaConvertToNuma(), ptaGetCubicLSF(), ptaGetLinearLSF(), ptaGetQuadraticLSF(), ptaGetQuarticLSF(), ptaGetSortIndex(), ptaNoisyLinearLSF(), ptaNoisyQuadraticLSF(), ptaSort2d(), ptraConcatenatePdfToData(), recogAddMissingClassStrings(), recogAverageSamples(), recogExtractNumbers(), recogFilterPixaBySize(), recogMakeBootDigitTemplates(), recogShowMatchesInRange(), recogTransferRchToDid(), selaCreateFromFile(), transferRchToRcha(), and wshedSaveBasin().

◆ numaaDestroy()

void numaaDestroy ( NUMAA **  pnaa)

numaaDestroy()

Parameters
[in,out]pnaato be destroyed and nulled, if it exists
Returns
void

Definition at line 1510 of file numabasic.c.

References Numaa::n, Numaa::numa, and numaDestroy().

Referenced by boxaSort2d(), ccbaGenerateStepChains(), ccbDestroy(), l_colorfillDestroy(), pixGetWordsInTextlines(), recogDestroy(), recogExtractNumbers(), and recogTrainingFinished().

◆ numaaExtendArray()

static l_int32 numaaExtendArray ( NUMAA naa)
static

numaaExtendArray()

Parameters
[in]naa
Returns
0 if OK, 1 on error
Notes:
     (1) The max number of numa ptrs is 1M.

Definition at line 1597 of file numabasic.c.

References Numaa::nalloc.

Referenced by numaaAddNuma().

◆ numaaGetCount()

◆ numaaGetNuma()

NUMA* numaaGetNuma ( NUMAA naa,
l_int32  index,
l_int32  accessflag 
)

◆ numaaGetNumaCount()

l_int32 numaaGetNumaCount ( NUMAA naa,
l_int32  index 
)

numaaGetNumaCount()

Parameters
[in]naa
[in]indexof numa in naa
Returns
count of numbers in the referenced numa, or 0 on error.

Definition at line 1649 of file numabasic.c.

References Numaa::n, Numaa::numa, and numaGetCount().

Referenced by grayInterHistogramStats(), and l_compressGrayHistograms().

◆ numaaGetNumberCount()

l_int32 numaaGetNumberCount ( NUMAA naa)

numaaGetNumberCount()

Parameters
[in]naa
Returns
count total number of numbers in the numaa, or 0 if no numbers or on error

Definition at line 1670 of file numabasic.c.

References L_CLONE, numaaGetCount(), numaaGetNuma(), numaDestroy(), and numaGetCount().

Referenced by boxaSort2dByIndex(), grayHistogramsToEMD(), and pixaSort2dByIndex().

◆ numaaGetPtrArray()

NUMA** numaaGetPtrArray ( NUMAA naa)

numaaGetPtrArray()

Parameters
[in]naa
Returns
the internal array of ptrs to Numa, or NULL on error
Notes:
     (1) This function is convenient for doing direct manipulation on
         a fixed size array of Numas.  To do this, it sets the count
         to the full size of the allocated array of Numa ptrs.
         The originating Numaa owns this array: DO NOT free it!
     (2) Intended usage:
           Numaa *naa = numaaCreate(n);
           Numa **array = numaaGetPtrArray(naa);
            ...  [manipulate Numas directly on the array]
           numaaDestroy(&naa);
     (3) Cautions:
          ~ Do not free this array; it is owned by tne Numaa.
          ~ Do not call any functions on the Numaa, other than
            numaaDestroy() when you're finished with the array.
            Adding a Numa will force a resize, destroying the ptr array.
          ~ Do not address the array outside its allocated size.
            With the bare array, there are no protections.  If the
            allocated size is n, array[n] is an error.

Definition at line 1719 of file numabasic.c.

References Numaa::n, Numaa::nalloc, and Numaa::numa.

Referenced by numaaFlattenToNuma().

◆ numaaGetValue()

l_ok numaaGetValue ( NUMAA naa,
l_int32  i,
l_int32  j,
l_float32 *  pfval,
l_int32 *  pival 
)

numaaGetValue()

Parameters
[in]naa
[in]iindex of numa within numaa
[in]jindex into numa
[out]pfval[optional] float value
[out]pival[optional] int value
Returns
0 if OK, 1 on error

Definition at line 1809 of file numabasic.c.

References Numa::array, Numa::n, Numaa::numa, and numaaGetCount().

◆ numaaRead()

NUMAA* numaaRead ( const char *  filename)

numaaRead()

Parameters
[in]filename
Returns
naa, or NULL on error

Definition at line 1884 of file numabasic.c.

References fopenReadStream(), and numaaReadStream().

◆ numaaReadMem()

NUMAA* numaaReadMem ( const l_uint8 *  data,
size_t  size 
)

numaaReadMem()

Parameters
[in]datanumaa serialization; in ascii
[in]sizeof data; can use strlen to get it
Returns
naa, or NULL on error

Definition at line 1961 of file numabasic.c.

References fopenReadFromMemory(), and numaaReadStream().

◆ numaaReadStream()

NUMAA* numaaReadStream ( FILE *  fp)

numaaReadStream()

Parameters
[in]fpfile stream
Returns
naa, or NULL on error

Definition at line 1911 of file numabasic.c.

References NUMA_VERSION_NUMBER.

Referenced by numaaRead(), and numaaReadMem().

◆ numaaReplaceNuma()

l_ok numaaReplaceNuma ( NUMAA naa,
l_int32  index,
NUMA na 
)

numaaReplaceNuma()

Parameters
[in]naa
[in]indexto the index-th numa
[in]nainsert and replace any existing one
Returns
0 if OK, 1 on error
Notes:
     (1) Any existing numa is destroyed, and the input one
         is inserted in its place.
     (2) If the index is invalid, return 1 (error)

Definition at line 1776 of file numabasic.c.

References Numaa::numa, numaaGetCount(), and numaDestroy().

Referenced by boxaSort2d().

◆ numaaTruncate()

l_ok numaaTruncate ( NUMAA naa)

numaaTruncate()

Parameters
[in]naa
Returns
0 if OK, 1 on error
Notes:
     (1) This identifies the largest index containing a numa that
         has any numbers within it, destroys all numa beyond that
         index, and resets the count.

Definition at line 1476 of file numabasic.c.

References L_CLONE, Numaa::n, Numaa::numa, numaaGetCount(), numaaGetNuma(), numaDestroy(), and numaGetCount().

Referenced by recogTrainingFinished().

◆ numaaWrite()

l_ok numaaWrite ( const char *  filename,
NUMAA naa 
)

numaaWrite()

Parameters
[in]filename
[in]naa
Returns
0 if OK, 1 on error

Definition at line 1989 of file numabasic.c.

References fopenWriteStream(), and numaaWriteStream().

◆ numaaWriteMem()

l_ok numaaWriteMem ( l_uint8 **  pdata,
size_t *  psize,
NUMAA naa 
)

numaaWriteMem()

Parameters
[out]pdatadata of serialized numaa; ascii
[out]psizesize of returned data
[in]naa
Returns
0 if OK, 1 on error
Notes:
     (1) Serializes a numaa in memory and puts the result in a buffer.

Definition at line 2062 of file numabasic.c.

References fopenWriteWinTempfile(), l_binaryReadStream(), and numaaWriteStream().

◆ numaaWriteStream()

l_ok numaaWriteStream ( FILE *  fp,
NUMAA naa 
)

numaaWriteStream()

Parameters
[in]fpfile stream
[in]naa
Returns
0 if OK, 1 on error

Definition at line 2020 of file numabasic.c.

References L_CLONE, NUMA_VERSION_NUMBER, numaaGetCount(), numaaGetNuma(), numaDestroy(), and numaWriteStream().

Referenced by numaaWrite(), and numaaWriteMem().

◆ numaChangeRefcount()

l_ok numaChangeRefcount ( NUMA na,
l_int32  delta 
)

numaChangeRefCount()

Parameters
[in]na
[in]deltachange to be applied
Returns
0 if OK, 1 on error

Definition at line 942 of file numabasic.c.

References Numa::refcount.

Referenced by numaClone(), and numaDestroy().

◆ numaClone()

NUMA* numaClone ( NUMA na)

numaClone()

Parameters
[in]na
Returns
ptr to same numa, or NULL on error

Definition at line 428 of file numabasic.c.

References numaChangeRefcount().

Referenced by numaaAddNuma(), numaaGetNuma(), numaInterpolateArbxInterval(), rchaExtract(), and wshedBasins().

◆ numaConvertToSarray()

SARRAY* numaConvertToSarray ( NUMA na,
l_int32  size1,
l_int32  size2,
l_int32  addzeros,
l_int32  type 
)

numaConvertToSarray()

Parameters
[in]na
[in]size1size of conversion field
[in]size2for float conversion: size of field to the right of the decimal point
[in]addzerosfor integer conversion: to add lead zeros
[in]typeL_INTEGER_VALUE, L_FLOAT_VALUE
Returns
a sarray of the float values converted to strings representing either integer or float values; or NULL on error.
Notes:
     (1) For integer conversion, size2 is ignored.
         For float conversion, addzeroes is ignored.

Definition at line 1054 of file numabasic.c.

References L_COPY, L_FLOAT_VALUE, L_INTEGER_VALUE, numaGetCount(), numaGetFValue(), numaGetIValue(), sarrayAddString(), and sarrayCreate().

◆ numaCopy()

◆ numaCopyParameters()

l_ok numaCopyParameters ( NUMA nad,
NUMA nas 
)

numaCopyParameters()

Parameters
[in]naddestination Numa
[in]nassource Numa
Returns
0 if OK, 1 on error

Definition at line 1016 of file numabasic.c.

References numaGetParameters(), and numaSetParameters().

Referenced by numaConvertToInt(), numaDilate(), numaErode(), numaNormalizeHistogram(), and numaTransform().

◆ numaCreate()

NUMA* numaCreate ( l_int32  n)

numaCreate()

Parameters
[in]nsize of number array to be alloc'd 0 for default
Returns
na, or NULL on error

Definition at line 194 of file numabasic.c.

Referenced by addColorizedGrayToCmap(), bmfGetWordWidths(), boxaaFlattenToBoxa(), boxaBinSort(), boxaExtractAsNuma(), boxaExtractSortedPattern(), boxaFindNearestBoxes(), boxaGetSizes(), boxaMakeAreaIndicator(), boxaMakeSizeIndicator(), boxaMakeWHRatioIndicator(), boxaMedianDimensions(), boxaPlotSides(), boxaPlotSizes(), boxaReconcileSizeByMedian(), boxaSimilar(), boxaSizeConsistency(), boxaSort2d(), ccbaGenerateStepChains(), ccbaReadStream(), compareTilesByHisto(), dewarpaListPages(), dewarpFindVertDisparity(), dewarpIsLineCoverageValid(), dewarpLinearLSF(), dewarpQuadraticLSF(), evalColorfillData(), genConstrainedNumaInRange(), grayHistogramsToEMD(), grayInterHistogramStats(), l_dnaConvertToNuma(), l_uncompressGrayHistograms(), mergeLookup(), numaaCompareImagesByBoxes(), numaaCreateFull(), numaaFlattenToNuma(), numaClipToInterval(), numaConvertToInt(), numaCopy(), numaCreateFromFArray(), numaCreateFromIArray(), numaCrossingsByPeaks(), numaCrossingsByThreshold(), numaDifferentiateInterval(), numaDiscretizeHistoInBins(), numaDiscretizeSortedInBins(), numaEvalSyncError(), numaFindExtrema(), numaFindPeaks(), numaGammaTRC(), numaGetBinSortIndex(), numaGetCrossingDistances(), numaGetMedianDevFromMedian(), numaGetPartialSums(), numaGetPeakCentroids(), numaGetPeakWidthLUT(), numaGetSortIndex(), numaGetUniformBinSizes(), numaInterpolateArbxInterval(), numaInterpolateEqxInterval(), numaLocatePeakRanges(), numaLowPassIntervals(), numaMakeDelta(), numaMakeHistogramAuto(), numaMakeHistogramClipped(), numaMakeRankFromHistogram(), numaMakeSequence(), numaMakeThresholdIndicator(), numaNormalizeHistogram(), numaQuantizeCrossingsByWindow(), numaRandomPermutation(), numaRebinHistogram(), numaReverse(), numaSelectCrossingThreshold(), numaSortByIndex(), numaSplitDistribution(), numaSubsample(), numaThresholdEdges(), numaTransform(), numaUniformSampling(), numaWindowedMedian(), parseStringForNumbers(), pixaaFlattenToPixa(), pixaaGetCount(), pixaBinSort(), pixaComparePhotoRegionsByHisto(), pixaCountPixels(), pixaDisplayTiledInRows(), pixaFindAreaFraction(), pixaFindDimensions(), pixaFindPerimSizeRatio(), pixaFindPerimToAreaRatio(), pixaFindStrokeWidth(), pixaFindWidthHeightProduct(), pixaFindWidthHeightRatio(), pixaMakeSizeIndicator(), pixaSelectByNumConnComp(), pixcmapGetRankIntensity(), pixCompareRankDifference(), pixCompareTilesByHisto(), ptaConvertToNuma(), ptaGetArrays(), ptaGetCubicLSF(), ptaGetLinearLSF(), ptaGetQuadraticLSF(), ptaGetQuarticLSF(), ptaGetSortIndex(), ptaNoisyLinearLSF(), ptaNoisyQuadraticLSF(), ptaSort2d(), ptraConcatenatePdfToData(), rchaCreate(), recogAddMissingClassStrings(), recogAverageSamples(), recogExtractNumbers(), recogFilterPixaBySize(), recogMakeBootDigitTemplates(), recogShowMatchesInRange(), and selaCreateFromFile().

◆ numaCreateFromFArray()

NUMA* numaCreateFromFArray ( l_float32 *  farray,
l_int32  size,
l_int32  copyflag 
)

numaCreateFromFArray()

Parameters
[in]farrayfloat array
[in]sizeof the array
[in]copyflagL_INSERT or L_COPY
Returns
na, or NULL on error
Notes:
     (1) With L_INSERT, ownership of the input array is transferred
         to the returned numa, and all size elements are considered
         to be valid.

Definition at line 271 of file numabasic.c.

References Numa::array, L_COPY, L_INSERT, Numa::n, numaAddNumber(), and numaCreate().

◆ numaCreateFromIArray()

NUMA* numaCreateFromIArray ( l_int32 *  iarray,
l_int32  size 
)

numaCreateFromIArray()

Parameters
[in]iarrayinteger array
[in]sizeof the array
Returns
na, or NULL on error
Notes:
     (1) We can't insert this int array into the numa, because a numa
         takes a float array.  So this just copies the data from the
         input array into the numa.  The input array continues to be
         owned by the caller.

Definition at line 234 of file numabasic.c.

References numaAddNumber(), and numaCreate().

Referenced by numaPseudorandomSequence().

◆ numaCreateFromString()

NUMA* numaCreateFromString ( const char *  str)

numaCreateFromString()

Parameters
[in]strstring of comma-separated numbers
Returns
na, or NULL on error
Notes:
     (1) The numbers can be ints or floats; they will be interpreted
         and stored as floats.  To use them as integers (e.g., for
         indexing into arrays), use numaGetIValue(...).

Definition at line 315 of file numabasic.c.

References sarrayCreate().

Referenced by pixaSelectWithString().

◆ numaDestroy()

void numaDestroy ( NUMA **  pna)

numaDestroy()

Parameters
[in,out]pnanuma to be destroyed and nulled if it exists
Returns
void
Notes:
     (1) Decrements the ref count and, if 0, destroys the numa.
     (2) Always nulls the input ptr.

Definition at line 366 of file numabasic.c.

References Numa::array, numaChangeRefcount(), and numaGetRefcount().

Referenced by addColorizedGrayToCmap(), bmfGetLineStrings(), boxaBinSort(), boxaEqual(), boxaGetRankVals(), boxaHandleOverlaps(), boxaMedianDimensions(), boxaPermutePseudorandom(), boxaReconcileSizeByMedian(), boxaSelectByArea(), boxaSelectBySize(), boxaSelectByWHRatio(), boxaSizeConsistency(), boxaSizeVariation(), boxaSort2d(), boxaSort2dByIndex(), dewarpaDestroy(), dewarpaInsertRefModels(), dewarpaListPages(), dewarpDestroy(), dewarpFindVertDisparity(), dewarpIsLineCoverageValid(), dewarpLinearLSF(), dewarpMinimize(), dewarpQuadraticLSF(), evalColorfillData(), fileSplitLinesUniform(), gplotDestroy(), grayHistogramsToEMD(), grayInterHistogramStats(), kernelCreateFromString(), l_compressGrayHistograms(), mergeLookup(), numaaAddNuma(), numaaAddNumber(), numaaCompareImagesByBoxes(), numaaDestroy(), numaaGetNumberCount(), numaaReplaceNuma(), numaaTruncate(), numaaWriteStream(), numaBinSort(), numaClose(), numaCountReversals(), numaCrossingsByPeaks(), numaDifferentiateInterval(), numaDiscretizeHistoInBins(), numaDiscretizeSortedInBins(), numaEarthMoverDistance(), numaEvalSyncError(), numaFindPeaks(), numaGetCrossingDistances(), numaGetMeanAbsval(), numaGetMedianDevFromMedian(), numaGetMode(), numaGetRankBinValues(), numaGetRankValue(), numaGetStatsUsingHistogram(), numaIntegrateInterval(), numaInterpolateArbxInterval(), numaInvertMap(), numaMakeRankFromHistogram(), numaMakeThresholdIndicator(), numaOpen(), numaQuantizeCrossingsByWidth(), numaQuantizeCrossingsByWindow(), numaRandomPermutation(), numaSelectCrossingThreshold(), numaSortPair(), numaWindowedMean(), numaWindowedMeanSquare(), numaWindowedMedian(), numaWindowedStats(), pixaBinSort(), pixaConstrainedSelect(), pixaDisplayTiledByIndex(), pixaDisplayTiledInRows(), pixaEqual(), pixaModifyStrokeWidth(), pixaRemoveSelected(), pixaSelectByArea(), pixaSelectByAreaFraction(), pixaSelectByNumConnComp(), pixaSelectByPerimSizeRatio(), pixaSelectByPerimToAreaRatio(), pixaSelectBySize(), pixaSelectByWidthHeightRatio(), pixaSelectToPdf(), pixaSelectWithString(), pixaSort2dByIndex(), pixcmapContrastTRC(), pixcmapGammaTRC(), pixcmapGetRankIntensity(), pixCompareRankDifference(), pixDisplayPtaa(), pixGetDifferenceStats(), pixGetTextBaseline(), pixGetWordBoxesInTextlines(), pixSplitDistributionFgBg(), pixThresholdGrayArb(), ptaGetSortIndex(), ptaNoisyLinearLSF(), ptaNoisyQuadraticLSF(), ptaSort(), ptaSort2d(), rchaDestroy(), recogAddMissingClassStrings(), recogAverageSamples(), recogDestroy(), recogDestroyDid(), recogExtractNumbers(), recogIsPaddingNeeded(), recogShowContent(), sarrayConcatUniformly(), selaCreateFromFile(), showExtractNumbers(), wshedDestroy(), and wshedRenderFill().

◆ numaEmpty()

l_ok numaEmpty ( NUMA na)

numaEmpty()

Parameters
[in]na
Returns
0 if OK; 1 on error
Notes:
     (1) This does not change the allocation of the array.
         It just clears the number of stored numbers, so that
         the array appears to be empty.

Definition at line 454 of file numabasic.c.

References Numa::n.

◆ numaExtendArray()

static l_int32 numaExtendArray ( NUMA na)
static

numaExtendArray()

Parameters
[in]na
Returns
0 if OK, 1 on error
Notes:
     (1) The max number of floats is 100M.

Definition at line 511 of file numabasic.c.

References Numa::nalloc.

Referenced by numaAddNumber(), and numaInsertNumber().

◆ numaGetCount()

l_int32 numaGetCount ( NUMA na)

numaGetCount()

Parameters
[in]na
Returns
count, or 0 if no numbers or on error

Definition at line 658 of file numabasic.c.

References Numa::n.

Referenced by bmfGetLineStrings(), boxaSelectWithIndicator(), boxaSort2dByIndex(), dewarpaInfo(), dewarpaModelStats(), dewarpaWriteStream(), kernelCreateFromString(), l_showIndicatorSplitValues(), makeGrayQuantTableArb(), makePlotPtaFromNumaGen(), mergeLookup(), numaaCompareImagesByBoxes(), numaAddBorder(), numaAddNumber(), numaAddSpecifiedBorder(), numaAddToNumber(), numaaGetNumaCount(), numaaGetNumberCount(), numaArithOp(), numaaTruncate(), numaBinSort(), numaChooseSortType(), numaClipToInterval(), numaConvertToDna(), numaConvertToInt(), numaConvertToPta1(), numaConvertToPta2(), numaConvertToSarray(), numaCountNonzeroRuns(), numaCountReversals(), numaCrossingsByPeaks(), numaCrossingsByThreshold(), numaDifferentiateInterval(), numaDilate(), numaDiscretizeHistoInBins(), numaDiscretizeSortedInBins(), numaEarthMoverDistance(), numaErode(), numaEvalHaarSum(), numaEvalSyncError(), numaFindExtrema(), numaFindLocForThreshold(), numaFindPeaks(), numaFindSortedLoc(), numaFitMax(), numaGetBinnedMedian(), numaGetBinSortIndex(), numaGetCountRelativeToZero(), numaGetCrossingDistances(), numaGetEdgeValues(), numaGetFArray(), numaGetHistogramStatsOnInterval(), numaGetIArray(), numaGetMax(), numaGetMean(), numaGetMeanAbsval(), numaGetMeanDevFromMedian(), numaGetMedian(), numaGetMedianDevFromMedian(), numaGetMin(), numaGetMode(), numaGetNonzeroRange(), numaGetPartialSums(), numaGetPeakCentroids(), numaGetPeakWidthLUT(), numaGetRankBinValues(), numaGetRankValue(), numaGetSortIndex(), numaGetSpanValues(), numaGetStatsUsingHistogram(), numaGetSum(), numaGetSumOnInterval(), numaHasOnlyIntegers(), numaHistogramGetRankFromVal(), numaHistogramGetValFromRank(), numaInsertNumber(), numaIntegrateInterval(), numaInterpolateArbxInterval(), numaInterpolateArbxVal(), numaInterpolateEqxInterval(), numaInterpolateEqxVal(), numaInvert(), numaInvertMap(), numaIsSorted(), numaJoin(), numaLocatePeakRanges(), numaLogicalOp(), numaLowPassIntervals(), numaMakeAbsval(), numaMakeDelta(), numaMakeHistogramAuto(), numaMakeHistogramClipped(), numaMakeRankFromHistogram(), numaMakeThresholdIndicator(), numaNormalizeHistogram(), numaQuantizeCrossingsByWidth(), numaQuantizeCrossingsByWindow(), numaRandomPermutation(), numaRebinHistogram(), numaRemoveBorder(), numaRemoveNumber(), numaReplaceNumber(), numaReverse(), numaSelectCrossingThreshold(), numaSimilar(), numaSimpleStats(), numaSort(), numaSortAutoSelect(), numaSortByIndex(), numaSortIndexAutoSelect(), numaSplitDistribution(), numaSubsample(), numaThresholdEdges(), numaTransform(), numaUniformSampling(), numaWindowedMean(), numaWindowedMeanSquare(), numaWindowedMedian(), numaWindowedStats(), numaWindowedVariance(), numaWriteStderr(), numaWriteStream(), pixaaScaleToSizeVar(), pixaConstrainedSelect(), pixAddWithIndicator(), pixaDisplayTiledByIndex(), pixaDisplayTiledInRows(), pixaExtendByScaling(), pixaRemoveSelected(), pixaSelectWithIndicator(), pixaSelectWithString(), pixaSort2dByIndex(), pixDisplayOutliers(), pixGetTextBaseline(), pixRemoveWithIndicator(), pixThresholdGrayArb(), ptaaSortByIndex(), ptaCreateFromNuma(), ptaSort2d(), ptaSortByIndex(), recogExtractNumbers(), recogRescoreDidResult(), recogShowPath(), selaCreateFromFile(), showExtractNumbers(), substituteObjectNumbers(), and writeCustomTiffTags().

◆ numaGetFArray()

l_float32* numaGetFArray ( NUMA na,
l_int32  copyflag 
)

numaGetFArray()

Parameters
[in]na
[in]copyflagL_NOCOPY or L_COPY
Returns
either the bare internal array or a copy of it, or NULL on error
Notes:
     (1) If copyflag == L_COPY, it makes a copy which the caller
         is responsible for freeing.  Otherwise, it operates
         directly on the bare array of the numa.
     (2) Very important: for L_NOCOPY, any writes to the array
         will be in the numa.  Do not write beyond the size of
         the count field, because it will not be accessible
         from the numa!  If necessary, be sure to set the count
         field to a larger number (such as the alloc size)
         BEFORE calling this function.  Creating with numaMakeConstant()
         is another way to insure full initialization.

Definition at line 892 of file numabasic.c.

References Numa::array, L_NOCOPY, and numaGetCount().

Referenced by grayInterHistogramStats(), numaAddBorder(), numaAddSpecifiedBorder(), numaDifferentiateInterval(), numaDilate(), numaEarthMoverDistance(), numaErode(), numaFindLocForThreshold(), numaGetMode(), numaGetPeakWidthLUT(), numaGetSortIndex(), numaIntegrateInterval(), numaInterpolateArbxInterval(), numaInterpolateArbxVal(), numaInterpolateEqxVal(), numaRemoveBorder(), numaUniformSampling(), numaWindowedMean(), numaWindowedMeanSquare(), numaWindowedVariance(), pixCompareRankDifference(), and pixGetDifferenceStats().

◆ numaGetFValue()

l_ok numaGetFValue ( NUMA na,
l_int32  index,
l_float32 *  pval 
)

numaGetFValue()

Parameters
[in]na
[in]indexinto numa
[out]pvalfloat value; set to 0.0 on error
Returns
0 if OK; 1 on error
Notes:
     (1) Caller may need to check the function return value to
         decide if a 0.0 in the returned ival is valid.

Definition at line 719 of file numabasic.c.

References Numa::array, and Numa::n.

Referenced by kernelCreateFromString(), makePlotPtaFromNumaGen(), numaClipToInterval(), numaConvertToDna(), numaConvertToPta1(), numaConvertToPta2(), numaConvertToSarray(), numaCountReversals(), numaCrossingsByPeaks(), numaCrossingsByThreshold(), numaDiscretizeSortedInBins(), numaEvalHaarSum(), numaEvalSyncError(), numaFindExtrema(), numaFindPeaks(), numaFindSortedLoc(), numaFitMax(), numaGetCountRelativeToZero(), numaGetCrossingDistances(), numaGetHistogramStatsOnInterval(), numaGetMax(), numaGetMeanDevFromMedian(), numaGetMedianDevFromMedian(), numaGetMin(), numaGetNonzeroRange(), numaGetPartialSums(), numaGetPeakCentroids(), numaGetRankValue(), numaGetStatsUsingHistogram(), numaGetSum(), numaGetSumOnInterval(), numaHasOnlyIntegers(), numaHistogramGetRankFromVal(), numaHistogramGetValFromRank(), numaInterpolateArbxVal(), numaIsSorted(), numaJoin(), numaLocatePeakRanges(), numaLowPassIntervals(), numaMakeDelta(), numaMakeHistogramAuto(), numaMakeHistogramClipped(), numaMakeRankFromHistogram(), numaMakeThresholdIndicator(), numaNormalizeHistogram(), numaQuantizeCrossingsByWindow(), numaRandomPermutation(), numaReverse(), numaSimilar(), numaSimpleStats(), numaSortByIndex(), numaSplitDistribution(), numaSubsample(), numaThresholdEdges(), numaTransform(), pixaModifyStrokeWidth(), pixDisplayOutliers(), ptaCreateFromNuma(), ptaNoisyLinearLSF(), ptaNoisyQuadraticLSF(), ptaSort2d(), recogExtractNumbers(), recogShowMatchesInRange(), recogShowPath(), and showExtractNumbers().

◆ numaGetIArray()

l_int32* numaGetIArray ( NUMA na)

numaGetIArray()

Parameters
[in]na
Returns
a copy of the bare internal array, integerized by rounding, or NULL on error
Notes:
     (1) A copy of the array is always made, because we need to
         generate an integer array from the bare float array.
         The caller is responsible for freeing the array.
     (2) The array size is determined by the number of stored numbers,
         not by the size of the allocated array in the Numa.
     (3) This function is provided to simplify calculations
         using the bare internal array, rather than continually
         calling accessors on the numa.  It is typically used
         on an array of size 256.

Definition at line 847 of file numabasic.c.

References numaGetCount(), and numaGetIValue().

Referenced by numaCountReversals(), numaFillCmapFromHisto(), recogMakeDecodingArray(), recogRunViterbi(), and substituteObjectNumbers().

◆ numaGetIValue()

l_ok numaGetIValue ( NUMA na,
l_int32  index,
l_int32 *  pival 
)

numaGetIValue()

Parameters
[in]na
[in]indexinto numa
[out]pivalinteger value; set to 0 on error
Returns
0 if OK; 1 on error
Notes:
     (1) Caller may need to check the function return value to
         decide if a 0 in the returned ival is valid.

Definition at line 754 of file numabasic.c.

References Numa::array, and Numa::n.

Referenced by bmfGetLineStrings(), boxaExtractSortedPattern(), boxaHandleOverlaps(), boxaReconcilePairWidth(), boxaReconcileSizeByMedian(), boxaSelectWithIndicator(), boxaSizeVariation(), boxaSort2d(), boxaSort2dByIndex(), boxaSortByIndex(), boxaWindowedMedian(), dewarpaInfo(), dewarpaInsertRefModels(), dewarpaModelStats(), dewarpaWriteStream(), dewarpIsLineCoverageValid(), fileSplitLinesUniform(), l_compressGrayHistograms(), makeGrayQuantTableArb(), mergeLookup(), numaaCompareImagesByBoxes(), numaConvertToInt(), numaConvertToSarray(), numaCountNonzeroRuns(), numaCrossingsByPeaks(), numaDiscretizeHistoInBins(), numaDiscretizeSortedInBins(), numaEvalSyncError(), numaGetEdgeValues(), numaGetIArray(), numaGetPeakCentroids(), numaGetPeakWidthLUT(), numaGetSpanValues(), numaInvert(), numaInvertMap(), numaMakeHistogramAuto(), numaMakeHistogramClipped(), numaQuantizeCrossingsByWindow(), numaRandomPermutation(), numaRebinHistogram(), numaSelectCrossingThreshold(), numaSortByIndex(), pixaAddTextNumber(), pixaaScaleToSizeVar(), pixaComparePhotoRegionsByHisto(), pixaConstrainedSelect(), pixAddWithIndicator(), pixaDisplayTiledByIndex(), pixaDisplayTiledInRows(), pixaEqual(), pixaRemoveSelected(), pixaSelectWithIndicator(), pixaSelectWithString(), pixaSort2dByIndex(), pixaSortByIndex(), pixcmapContrastTRC(), pixcmapGammaTRC(), pixcmapGetRankIntensity(), pixDisplayPtaa(), pixGetTextBaseline(), pixRemoveWithIndicator(), ptaaSortByIndex(), ptaSort2d(), ptaSortByIndex(), recogAddMissingClassStrings(), recogIsPaddingNeeded(), recogShowContent(), recogShowMatchesInRange(), recogShowPath(), sarrayConcatUniformly(), sarraySortByIndex(), selaCreateFromFile(), writeCustomTiffTags(), wshedGetHeight(), and wshedRenderFill().

◆ numaGetParameters()

◆ numaGetRefcount()

l_int32 numaGetRefcount ( NUMA na)

numaGetRefCount()

Parameters
[in]na
Returns
refcount, or UNDEF on error

Definition at line 924 of file numabasic.c.

References Numa::refcount.

Referenced by numaDestroy().

◆ numaInsertNumber()

l_ok numaInsertNumber ( NUMA na,
l_int32  index,
l_float32  val 
)

numaInsertNumber()

Parameters
[in]na
[in]indexlocation in na to insert new value
[in]valfloat32 or integer to be added
Returns
0 if OK, 1 on error
Notes:
     (1) This shifts na[i] --> na[i + 1] for all i >= index,
         and then inserts val as na[index].
     (2) It should not be used repeatedly on large arrays,
         because the function is O(n).

Definition at line 553 of file numabasic.c.

References Numa::array, Numa::n, Numa::nalloc, numaExtendArray(), and numaGetCount().

Referenced by numaAddSorted().

◆ numaRead()

NUMA* numaRead ( const char *  filename)

numaRead()

Parameters
[in]filename
Returns
na, or NULL on error

Definition at line 1110 of file numabasic.c.

References fopenReadStream(), and numaReadStream().

◆ numaReadMem()

NUMA* numaReadMem ( const l_uint8 *  data,
size_t  size 
)

numaReadMem()

Parameters
[in]datanuma serialization; in ascii
[in]sizeof data; can use strlen to get it
Returns
na, or NULL on error

Definition at line 1187 of file numabasic.c.

References fopenReadFromMemory(), and numaReadStream().

◆ numaReadStream()

NUMA* numaReadStream ( FILE *  fp)

numaReadStream()

Parameters
[in]fpfile stream
Returns
numa, or NULL on error

Definition at line 1137 of file numabasic.c.

References NUMA_VERSION_NUMBER.

Referenced by numaRead(), and numaReadMem().

◆ numaRemoveNumber()

l_ok numaRemoveNumber ( NUMA na,
l_int32  index 
)

numaRemoveNumber()

Parameters
[in]na
[in]indexelement to be removed
Returns
0 if OK, 1 on error
Notes:
     (1) This shifts na[i] --> na[i - 1] for all i > index.
     (2) It should not be used repeatedly on large arrays,
         because the function is O(n).

Definition at line 596 of file numabasic.c.

References Numa::array, Numa::n, and numaGetCount().

◆ numaReplaceNumber()

l_ok numaReplaceNumber ( NUMA na,
l_int32  index,
l_float32  val 
)

numaReplaceNumber()

Parameters
[in]na
[in]indexelement to be replaced
[in]valnew value to replace old one
Returns
0 if OK, 1 on error

Definition at line 627 of file numabasic.c.

References Numa::array, and numaGetCount().

Referenced by boxaEqual(), dewarpaInsertRefModels(), numaInvertMap(), and ptraConcatenatePdfToData().

◆ numaSetCount()

l_ok numaSetCount ( NUMA na,
l_int32  newcount 
)

numaSetCount()

Parameters
[in]na
[in]newcount
Returns
0 if OK, 1 on error
Notes:
     (1) If newcount <= na->nalloc, this resets na->n.
         Using newcount = 0 is equivalent to numaEmpty().
     (2) If newcount > na->nalloc, this causes a realloc
         to a size na->nalloc = newcount.
     (3) All the previously unused values in na are set to 0.0.

Definition at line 685 of file numabasic.c.

References Numa::array, Numa::n, Numa::nalloc, and reallocNew().

Referenced by numaEvalSyncError(), numaGetPeakWidthLUT(), numaMakeHistogramAuto(), numaMakeHistogramClipped(), and pixCompareRankDifference().

◆ numaSetParameters()

l_ok numaSetParameters ( NUMA na,
l_float32  startx,
l_float32  delx 
)

numaSetParameters()

Parameters
[in]na
[in]startxx value corresponding to na[0]
[in]delxdifference in x values for the situation where the elements of na correspond to the evaluation of a function at equal intervals of size delx
Returns
0 if OK, 1 on error

Definition at line 993 of file numabasic.c.

References Numa::delx, and Numa::startx.

Referenced by numaAddBorder(), numaClipToInterval(), numaCopyParameters(), numaInterpolateEqxInterval(), numaMakeHistogramAuto(), numaMakeHistogramClipped(), numaRebinHistogram(), numaRemoveBorder(), and numaUniformSampling().

◆ numaSetValue()

◆ numaShiftValue()

l_ok numaShiftValue ( NUMA na,
l_int32  index,
l_float32  diff 
)

numaShiftValue()

Parameters
[in]na
[in]indexto element to change relative to the current value
[in]diffincrement if diff > 0 or decrement if diff < 0
Returns
0 if OK; 1 on error

Definition at line 811 of file numabasic.c.

References Numa::array, and Numa::n.

◆ numaWrite()

l_ok numaWrite ( const char *  filename,
NUMA na 
)

numaWrite()

Parameters
[in]filename
[in]na
Returns
0 if OK, 1 on error

Definition at line 1246 of file numabasic.c.

References fopenWriteStream(), and numaWriteStream().

Referenced by numaWriteDebug().

◆ numaWriteDebug()

l_ok numaWriteDebug ( const char *  filename,
NUMA na 
)

numaWriteDebug()

Parameters
[in]filename
[in]na
Returns
0 if OK; 1 on error
Notes:
     (1) Debug version, intended for use in the library when writing
         to files in a temp directory with names that are compiled in.
         This is used instead of numaWrite() for all such library calls.
     (2) The global variable LeptDebugOK defaults to 0, and can be set
         or cleared by the function setLeptDebugOK().

Definition at line 1224 of file numabasic.c.

References numaWrite().

◆ numaWriteMem()

l_ok numaWriteMem ( l_uint8 **  pdata,
size_t *  psize,
NUMA na 
)

numaWriteMem()

Parameters
[out]pdatadata of serialized numa; ascii
[out]psizesize of returned data
[in]na
Returns
0 if OK, 1 on error
Notes:
     (1) Serializes a numa in memory and puts the result in a buffer.

Definition at line 1353 of file numabasic.c.

References fopenWriteWinTempfile(), l_binaryReadStream(), and numaWriteStream().

◆ numaWriteStderr()

l_ok numaWriteStderr ( NUMA na)

numaWriteStderr()

Parameters
[in]na
Returns
0 if OK, 1 on error

Definition at line 1313 of file numabasic.c.

References Numa::array, lept_stderr(), NUMA_VERSION_NUMBER, numaGetCount(), and numaGetParameters().

Referenced by evalColorfillData(), numaSelectCrossingThreshold(), and numaWriteStream().

◆ numaWriteStream()

l_ok numaWriteStream ( FILE *  fp,
NUMA na 
)

numaWriteStream()

Parameters
[in]fpfile stream; use NULL to write to stderr
[in]na
Returns
0 if OK, 1 on error

Definition at line 1277 of file numabasic.c.

References Numa::array, NUMA_VERSION_NUMBER, numaGetCount(), numaGetParameters(), and numaWriteStderr().

Referenced by numaaWriteStream(), numaWrite(), and numaWriteMem().

Variable Documentation

◆ InitialArraySize

const l_int32 InitialArraySize = 50
static

n'importe quoi

Definition at line 178 of file numabasic.c.