/// <summary> /// (1) This function is useful for selecting image files from a /// directory, where the integer %index is embedded into /// the file name. /// (2) This is typically done by generating the sarray using /// getNumberedPathnamesInDirectory(), so that the %index /// pathname would have the number %index in it.The size /// of the sarray should be the largest number(plus 1) appearing /// in the file names, respecting the constraints in the /// call to getNumberedPathnamesInDirectory(). /// (3) Consequently, for some indices into the sarray, there may /// be no pathnames in the directory containing that number. /// By convention, we place empty C strings("") in those /// locations in the sarray, and it is not an error if such /// a string is encountered and no pix is returned. /// Therefore, the caller must verify that a pix is returned. /// (4) See convertSegmentedPagesToPS() in src/psio1.c for an /// example of usage. /// </summary> /// <param name="sa">string array of full pathnames</param> /// <param name="index">index into pathname array</param> /// <returns>pix if OK; null if not found</returns> public static Pix pixReadIndexed(this Sarray sa, int index) { if (null == sa) { throw new ArgumentNullException("sa cannot be null."); } var pointer = Native.DllImports.pixReadIndexed((HandleRef)sa, index); if (IntPtr.Zero == pointer) { return(null); } else { return(new Pix(pointer)); } }
public static Pixa recogAddDigitPadTemplates(this L_Recog recog, Sarray sa) { throw new NotImplementedException(); }
public static Pixa showExtractNumbers(this Pix pixs, Sarray sa, Boxaa baa, Numaa naa, out Pix ppixdb) { throw new NotImplementedException(); }
// Greedy character splitting public static int recogCorrelationBestRow(this L_Recog recog, Pix pixs, out Boxa pboxa, out Numa pnascore, out Numa pnaindex, out Sarray psachar, int debug) { throw new NotImplementedException(); }
public static int sarrayGetRefcount(this Sarray sa) { return(Native.DllImports.sarrayGetRefcount((HandleRef)sa)); }
public static IntPtr sarrayGetArray(this Sarray sa, out int pnalloc, out int pn) { throw new NotImplementedException(); }
public static int sarrayReplaceString(this Sarray sa, int index, string newstr, AccessAndStorageFlags copyflag) { return(Native.DllImports.sarrayReplaceString((HandleRef)sa, index, newstr, (int)copyflag)); }
// Add/Remove string public static int sarrayAddString(this Sarray sa, string str, AccessAndStorageFlags copyflag) { return(Native.DllImports.sarrayAddString((HandleRef)sa, str, (int)copyflag)); }
// Split string on separator list public static int sarraySplitString(this Sarray sa, string str, string separators) { throw new NotImplementedException(); }
// Convert word sarray to(formatted) line sarray public static Sarray sarrayConvertWordsToLines(this Sarray sa, int linesize) { throw new NotImplementedException(); }
// Pad an sarray to be the same size as another sarray public static int sarrayPadToSameSize(this Sarray sa1, Sarray sa2, string padstring) { throw new NotImplementedException(); }
public static int sarrayAppendRange(this Sarray sa1, Sarray sa2, int start, int end) { throw new NotImplementedException(); }
// Join 2 sarrays public static int sarrayJoin(this Sarray sa1, Sarray sa2) { throw new NotImplementedException(); }
public static IntPtr sarrayToStringRange(this Sarray sa, int first, int nstrings, int addnlflag) { throw new NotImplementedException(); }
// Conversion back to string public static IntPtr sarrayToString(this Sarray sa, int addnlflag) { throw new NotImplementedException(); }
public static Sarray convertSortedToNumberedPathnames(this Sarray sa, int numpre, int numpost, int maxnum) { throw new NotImplementedException(); }
public static Sarray sarrayClone(this Sarray sa) { throw new NotImplementedException(); }
// Filter sarray public static Sarray sarraySelectBySubstring(this Sarray sain, string substr) { throw new NotImplementedException(); }
public static IntPtr sarrayRemoveString(this Sarray sa, int index) { throw new NotImplementedException(); }
public static Sarray sarraySelectByRange(this Sarray sain, int first, int last) { throw new NotImplementedException(); }
public static int sarrayClear(this Sarray sa) { throw new NotImplementedException(); }
public static int sarrayParseRange(this Sarray sa, int start, out int pactualstart, out int pend, out int pnewstart, string substr, int loc) { throw new NotImplementedException(); }
public static string sarrayGetString(this Sarray sa, int index, AccessAndStorageFlags copyflag) { var pointer = Native.DllImports.sarrayGetString((HandleRef)sa, index, (int)copyflag); return(Marshal.PtrToStringAnsi(pointer)); }
public static int sarrayWrite(string filename, Sarray sa) { return(Native.DllImports.sarrayWrite(filename, (HandleRef)sa)); }
public static int sarrayChangeRefcount(this Sarray sa, int delta) { throw new NotImplementedException(); }
public static int sarrayWriteStream(IntPtr fp, Sarray sa) { throw new NotImplementedException(); }
public static int rchaExtract(this L_Rcha rcha, out Numa pnaindex, out Numa pnascore, out Sarray psatext, out Numa pnasample, out Numa pnaxloc, out Numa pnayloc, out Numa pnawidth) { throw new NotImplementedException(); }
public static int sarrayWriteMem(out IntPtr pdata, IntPtr psize, Sarray sa) { throw new NotImplementedException(); }
public static PixaComp pixacompCreateFromSA(this Sarray sa, int comptype) { throw new NotImplementedException(); }
public static int sarrayAppend(string filename, Sarray sa) { throw new NotImplementedException(); }