IO namespace

File, image, video, CSV and acquisition input/output helpers.

Symbols in this namespace: 71

SymbolKindCategoryDescription
IO.ABS_PATHFunctionFile and path functionsReturns the absolute version of a path.
IO.APPEND_TEXTFunctionFile and path functionsAppends UTF-8 text to a file and returns TRUE on success.
IO.BASE_NAMEFunctionFile and path functionsFile name without the final extension.
IO.CAMERA_GETFunctionFile / media IO statementsReads an OpenCV VideoCapture property and assigns the numeric value.
IO.CAMERA_GETFunctionFile and path functionsReads an OpenCV VideoCapture property and assigns the numeric value.
IO.CAMERA_IS_OPENFunctionFile and path functionsReturns TRUE when the selected camera index is currently open inside the script runtime.
IO.CAMERA_PROP_IDFunctionFile and path functionsReturns the numeric OpenCV CAP_PROP id for a known friendly property name, or -1 if unknown.
IO.CAMERA_PROPSFunctionFile / media IO statementsReturns a diagnostic table with columns: name, OpenCV property id, current value, writable flag.
IO.CAMERA_PROPSFunctionFile and path functionsReturns a diagnostic table with columns: name, OpenCV property id, current value, writable flag.
IO.CAMERA_RELEASECommandFile / media IO statementsReleases an opened camera handle. Use this when a script has finished acquiring frames.
IO.CAMERA_SETCommandFile / media IO statementsSets an OpenCV VideoCapture property. Property can be a friendly name such as FPS, WIDTH, HEIGHT, EXPOSURE or GAIN, quoted or bare.
IO.CANONICAL_PATHFunctionFile and path functionsReturns the canonical existing path with symlinks resolved when possible.
IO.CAPTURE_FRAMECommandFile / media IO statementsCaptures one BGR frame from a camera. The camera is opened lazily and kept open for following captures until IO.CAMERA_RELEASE is called.
IO.CLEAR_ERRORFunctionFile and path functionsClears the stored non-fatal runtime error and returns TRUE.
IO.COPY_FILEFunctionFile and path functionsCopies a file and returns TRUE on success.
IO.CSV_COLSFunctionFile and path functionsReturns the number of columns in a CSV/text table.
IO.CSV_COLUMNFunctionFile and path functionsReturns one selected CSV column as newline-separated text. The selector may be a header name or a zero-based index.
IO.CSV_COLUMN_ARRAYFunctionFile and path functionsLoads a selected CSV column into a script array. Pass numeric=TRUE to force numeric conversion.
IO.CSV_FIELDFunctionFile and path functionsReturns one CSV cell as text. The field selector may be a header name or a zero-based column index.
IO.CSV_HEADERSFunctionFile and path functionsReturns available CSV field names as newline-separated text. If no header exists, synthetic Column N names are returned.
IO.CSV_INFOFunctionFile and path functionsAnalyzes and loads a CSV/text table using auto-detected delimiter and header by default, then returns a diagnostic text summary.
IO.CSV_NUMBERFunctionFile and path functionsReturns one CSV cell parsed as a flexible number, supporting decimal comma and decimal point.
IO.CSV_ROWSFunctionFile and path functionsReturns the number of data rows in a CSV/text table.
IO.CSV_TABLE_ARRAYFunctionFile and path functionsLoads the whole CSV data table into a two-dimensional script array.
IO.CURRENT_DIRFunctionFile and path functionsReturns the current working directory.
IO.DIR_EXISTSFunctionFile and path functionsTRUE if a path exists and is a directory.
IO.DIR_LISTFunctionFile and path functionsReturns a newline-separated directory listing.
IO.DIR_NAMEFunctionFile and path functionsParent directory component of a path.
IO.EXTFunctionFile and path functionsFinal file extension without the dot.
IO.FCLOSEFunctionFile and path functionsCloses a file handle and returns TRUE on success.
IO.FEOFFunctionFile and path functionsReturns TRUE when the file handle is invalid or at end-of-file.
IO.FFLUSHFunctionFile and path functionsFlushes pending writes on an open file handle.
IO.FILE_EXISTSFunctionFile and path functionsTRUE if a path exists and is a file.
IO.FILE_NAMEFunctionFile and path functionsFinal file or directory name component.
IO.FILE_SIZEFunctionFile and path functionsSize in bytes, or -1 when unavailable.
IO.FOPENFunctionFile and path functionsOpens a file and returns a numeric runtime handle. Modes follow fopen-style strings such as r, w, a, rb, wb, r+, w+.
IO.FPRINTFFunctionFile and path functionsWrites formatted text to an open file handle using simple %s, %d, %f, %g placeholders.
IO.FREADFunctionFile and path functionsReads a byte block from an open file handle and returns it as text.
IO.FREADLINEFunctionFile and path functionsReads one text line from an open file handle without the trailing newline.
IO.FSCANFFunctionFile and path functionsReads the next whitespace-separated token, optionally converting it using %s, %d, %f or %g.
IO.FSEEKFunctionFile and path functionsMoves the current file position. Origin can be SET, CUR or END.
IO.FTELLFunctionFile and path functionsReturns the current byte position of an open file handle.
IO.FWRITEFunctionFile and path functionsWrites text/raw UTF-8 bytes to an open file handle and returns the number of bytes written.
IO.HOME_DIRFunctionFile and path functionsReturns the user's home directory.
IO.IS_ABSOLUTEFunctionFile and path functionsTRUE if the path is absolute.
IO.LAST_ERRORFunctionFile and path functionsReturns the last non-fatal runtime error text, currently set by IO.TRY_LOAD and IO.TRY_LOAD_WITH_META.
IO.LAST_ERROR_LINEFunctionFile and path functionsReturns the source line associated with IO.LAST_ERROR(), or -1 when unavailable.
IO.LOADCommandFile / media IO statementsLoads an image, a FITS image/stack, a TIFF/TIFF stack, or a video; videos, multipage TIFF files and multi-HDU FITS files become in-memory stacks.
IO.LOAD_WITH_METAFunctionFile / media IO statementsLoads an image/stack and applies the optional path.cvbmeta sidecar when present.
IO.LOAD_WITH_METAFunctionFile and path functionsLoads an image/stack and applies the optional path.cvbmeta sidecar when present.
IO.META_PATHFunctionFile and path functionsReturns the metadata sidecar path used by IO.SAVE_WITH_META.
IO.MKDIRFunctionFile and path functionsCreates a single directory level and returns TRUE on success.
IO.MKPATHFunctionFile and path functionsCreates a directory tree and returns TRUE on success.
IO.MOVE_FILEFunctionFile and path functionsMoves or renames a file and returns TRUE on success.
IO.PATH_EXISTSFunctionFile and path functionsTRUE if a path exists.
IO.PATH_JOINFunctionFile and path functionsJoins a base path and a child component.
IO.READ_CSV_ARRAYFunctionFile and path functionsReads a CSV written by IO.WRITE_CSV_ARRAY, preserving 1D/2D shape when the #CVB_ARRAY header is present.
IO.READ_TEXTFunctionFile and path functionsReads a text file as UTF-8, returning an empty string on failure.
IO.REMOVE_DIRFunctionFile and path functionsRemoves an empty directory and returns TRUE on success.
IO.REMOVE_DIR_TREEFunctionFile and path functionsRemoves a directory tree recursively and returns TRUE on success.
IO.REMOVE_FILEFunctionFile and path functionsDeletes a file and returns TRUE on success.
IO.SAVECommandFile / media IO statementsSaves a single image to common image formats, or saves a stack to multipage TIFF when the target extension is .tif/.tiff.
IO.SAVE_WITH_METACommandFile / media IO statementsSaves an image or stack and writes a path.cvbmeta sidecar containing ROI state and user metadata.
IO.TEMP_DIRFunctionFile and path functionsReturns the system temporary directory.
IO.TRY_LOADFunctionFile / media IO statementsLoads an image/stack/video without stopping the script on failure. On failure the destination becomes NULL and IO.LAST_ERROR() contains the reason.
IO.TRY_LOADFunctionFile and path functionsLoads an image/stack/video without stopping the script on failure. On failure the destination becomes NULL and IO.LAST_ERROR() contains the reason.
IO.TRY_LOAD_WITH_METAFunctionFile / media IO statementsNon-fatal variant of IO.LOAD_WITH_META. It restores metadata when possible, otherwise stores the reason in IO.LAST_ERROR().
IO.TRY_LOAD_WITH_METAFunctionFile and path functionsNon-fatal variant of IO.LOAD_WITH_META. It restores metadata when possible, otherwise stores the reason in IO.LAST_ERROR().
IO.WRITE_CSV_ARRAYFunctionFile and path functionsWrites a 1D/2D array to CSV with a small #CVB_ARRAY shape header and returns TRUE.
IO.WRITE_TEXTFunctionFile and path functionsWrites UTF-8 text to a file and returns TRUE on success.
IO.WRITE_VIDEOCommandFile / media IO statementsWrites a stack as an AVI/MJPG video.

IO.ABS_PATH

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.ABS_PATH(path)

Returns the absolute version of a path.

Minimal example

value = IO.ABS_PATH(path)

IO.APPEND_TEXT

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.APPEND_TEXT(path,text)

Appends UTF-8 text to a file and returns TRUE on success.

Minimal example

value = IO.APPEND_TEXT(path,text)

IO.BASE_NAME

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.BASE_NAME(path)

File name without the final extension.

Minimal example

value = IO.BASE_NAME(path)

IO.CAMERA_GET

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File / media IO statements   Namespace: IO

IO.CAMERA_GET cameraIndex, property AS value

Reads an OpenCV VideoCapture property and assigns the numeric value.

Minimal example

IO.CAMERA_GET 0, FPS AS fps
PRINT fps

IO.CAMERA_GET

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CAMERA_GET cameraIndex, property AS value

Reads an OpenCV VideoCapture property and assigns the numeric value.

Minimal example

IO.CAMERA_GET 0, FPS AS fps
PRINT fps

IO.CAMERA_IS_OPEN

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CAMERA_IS_OPEN([cameraIndex])

Returns TRUE when the selected camera index is currently open inside the script runtime.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
cameraIndexOptional parameter. If omitted, the command uses its internal default.

Minimal example

PRINT IO.CAMERA_IS_OPEN(0)

IO.CAMERA_PROP_ID

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CAMERA_PROP_ID(property)

Returns the numeric OpenCV CAP_PROP id for a known friendly property name, or -1 if unknown.

Minimal example

PRINT IO.CAMERA_PROP_ID("EXPOSURE")

IO.CAMERA_PROPS

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File / media IO statements   Namespace: IO

IO.CAMERA_PROPS [cameraIndex] AS table

Returns a diagnostic table with columns: name, OpenCV property id, current value, writable flag.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
cameraIndexOptional parameter. If omitted, the command uses its internal default.

Minimal example

IO.CAMERA_PROPS 0 AS props
PRINT ARRAY.DIMSIZE(props, 0)

IO.CAMERA_PROPS

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CAMERA_PROPS [cameraIndex] AS table

Returns a diagnostic table with columns: name, OpenCV property id, current value, writable flag.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
cameraIndexOptional parameter. If omitted, the command uses its internal default.

Minimal example

IO.CAMERA_PROPS 0 AS props
PRINT ARRAY.DIMSIZE(props, 0)

IO.CAMERA_RELEASE

STATEMENTIOBATCH-FRIENDLYFILE I/O
Kind: Command   Category: File / media IO statements   Namespace: IO

IO.CAMERA_RELEASE [cameraIndex]

Releases an opened camera handle. Use this when a script has finished acquiring frames.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
cameraIndexOptional parameter. If omitted, the command uses its internal default.

Minimal example

IO.CAMERA_RELEASE 0

IO.CAMERA_SET

STATEMENTIOBATCH-FRIENDLYFILE I/O
Kind: Command   Category: File / media IO statements   Namespace: IO

IO.CAMERA_SET cameraIndex, property, value

Sets an OpenCV VideoCapture property. Property can be a friendly name such as FPS, WIDTH, HEIGHT, EXPOSURE or GAIN, quoted or bare.

Minimal example

IO.CAMERA_SET 0, WIDTH, 1280
IO.CAMERA_SET 0, HEIGHT, 720
IO.CAMERA_SET 0, FPS, 30

IO.CANONICAL_PATH

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CANONICAL_PATH(path)

Returns the canonical existing path with symlinks resolved when possible.

Minimal example

value = IO.CANONICAL_PATH(path)

IO.CAPTURE_FRAME

STATEMENTIOBATCH-FRIENDLYFILE I/O
Kind: Command   Category: File / media IO statements   Namespace: IO

IO.CAPTURE_FRAME [cameraIndex] AS img

Captures one BGR frame from a camera. The camera is opened lazily and kept open for following captures until IO.CAMERA_RELEASE is called.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
cameraIndexOptional parameter. If omitted, the command uses its internal default.

Minimal example

IO.CAPTURE_FRAME 0 AS frame
GUI.SHOW frame

IO.CLEAR_ERROR

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CLEAR_ERROR()

Clears the stored non-fatal runtime error and returns TRUE.

Minimal example

ok = IO.CLEAR_ERROR()

IO.COPY_FILE

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.COPY_FILE(source,target[,overwrite])

Copies a file and returns TRUE on success.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
overwriteOptional parameter. If omitted, the command uses its internal default.

Minimal example

value = IO.COPY_FILE(source,target[,overwrite])

IO.CSV_COLS

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CSV_COLS(path [, header [, delimiter]])

Returns the number of columns in a CSV/text table.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
headerCSV header policy, usually AUTO, TRUE or FALSE.
delimiterCSV delimiter override; omit it for auto-detection where supported.

Minimal example

n = IO.CSV_COLS("measurements.csv")

IO.CSV_COLUMN

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CSV_COLUMN(path, field [, header [, delimiter]])

Returns one selected CSV column as newline-separated text. The selector may be a header name or a zero-based index.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
headerCSV header policy, usually AUTO, TRUE or FALSE.
delimiterCSV delimiter override; omit it for auto-detection where supported.

Minimal example

values = IO.CSV_COLUMN("measurements.csv", "temperature")

IO.CSV_COLUMN_ARRAY

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CSV_COLUMN_ARRAY(path, field [, header [, numeric [, delimiter]]])

Loads a selected CSV column into a script array. Pass numeric=TRUE to force numeric conversion.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
headerCSV header policy, usually AUTO, TRUE or FALSE.
numericWhen true, forces numeric conversion of CSV values.
delimiterCSV delimiter override; omit it for auto-detection where supported.

Minimal example

temps = IO.CSV_COLUMN_ARRAY("measurements.csv", "temperature", "AUTO", TRUE)

IO.CSV_FIELD

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CSV_FIELD(path, row, field [, header [, delimiter]])

Returns one CSV cell as text. The field selector may be a header name or a zero-based column index.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
headerCSV header policy, usually AUTO, TRUE or FALSE.
delimiterCSV delimiter override; omit it for auto-detection where supported.

Minimal example

v = IO.CSV_FIELD("measurements.csv", 0, "temperature")

IO.CSV_HEADERS

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CSV_HEADERS(path [, header [, delimiter]])

Returns available CSV field names as newline-separated text. If no header exists, synthetic Column N names are returned.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
headerCSV header policy, usually AUTO, TRUE or FALSE.
delimiterCSV delimiter override; omit it for auto-detection where supported.

Minimal example

PRINT IO.CSV_HEADERS("measurements.csv")

IO.CSV_INFO

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CSV_INFO(path [, header [, delimiter]])

Analyzes and loads a CSV/text table using auto-detected delimiter and header by default, then returns a diagnostic text summary.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
headerCSV header policy, usually AUTO, TRUE or FALSE.
delimiterCSV delimiter override; omit it for auto-detection where supported.

Minimal example

PRINT IO.CSV_INFO("measurements.csv")

IO.CSV_NUMBER

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CSV_NUMBER(path, row, field [, header [, delimiter]])

Returns one CSV cell parsed as a flexible number, supporting decimal comma and decimal point.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
headerCSV header policy, usually AUTO, TRUE or FALSE.
delimiterCSV delimiter override; omit it for auto-detection where supported.

Minimal example

t = IO.CSV_NUMBER("measurements.csv", 0, "temperature")

IO.CSV_ROWS

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CSV_ROWS(path [, header [, delimiter]])

Returns the number of data rows in a CSV/text table.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
headerCSV header policy, usually AUTO, TRUE or FALSE.
delimiterCSV delimiter override; omit it for auto-detection where supported.

Minimal example

n = IO.CSV_ROWS("measurements.csv")

IO.CSV_TABLE_ARRAY

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CSV_TABLE_ARRAY(path [, header [, numeric [, delimiter]]])

Loads the whole CSV data table into a two-dimensional script array.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
headerCSV header policy, usually AUTO, TRUE or FALSE.
numericWhen true, forces numeric conversion of CSV values.
delimiterCSV delimiter override; omit it for auto-detection where supported.

Minimal example

table = IO.CSV_TABLE_ARRAY("measurements.csv", "AUTO", TRUE)

IO.CURRENT_DIR

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.CURRENT_DIR()

Returns the current working directory.

Minimal example

value = IO.CURRENT_DIR()

IO.DIR_EXISTS

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.DIR_EXISTS(path)

TRUE if a path exists and is a directory.

Minimal example

value = IO.DIR_EXISTS(path)

IO.DIR_LIST

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.DIR_LIST(path[,pattern[,mode]])

Returns a newline-separated directory listing.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
patternOptional parameter. If omitted, the command uses its internal default.
modeMode selector; accepted values are described in the command text.

Minimal example

value = IO.DIR_LIST(path[,pattern[,mode]])

IO.DIR_NAME

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.DIR_NAME(path)

Parent directory component of a path.

Minimal example

value = IO.DIR_NAME(path)

IO.EXT

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.EXT(path)

Final file extension without the dot.

Minimal example

value = IO.EXT(path)

IO.FCLOSE

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.FCLOSE(handle)

Closes a file handle and returns TRUE on success.

Minimal example

value = IO.FCLOSE(handle)

IO.FEOF

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.FEOF(handle)

Returns TRUE when the file handle is invalid or at end-of-file.

Minimal example

value = IO.FEOF(handle)

IO.FFLUSH

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.FFLUSH(handle)

Flushes pending writes on an open file handle.

Minimal example

value = IO.FFLUSH(handle)

IO.FILE_EXISTS

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.FILE_EXISTS(path)

TRUE if a path exists and is a file.

Minimal example

value = IO.FILE_EXISTS(path)

IO.FILE_NAME

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.FILE_NAME(path)

Final file or directory name component.

Minimal example

value = IO.FILE_NAME(path)

IO.FILE_SIZE

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.FILE_SIZE(path)

Size in bytes, or -1 when unavailable.

Minimal example

value = IO.FILE_SIZE(path)

IO.FOPEN

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.FOPEN(path[,mode])

Opens a file and returns a numeric runtime handle. Modes follow fopen-style strings such as r, w, a, rb, wb, r+, w+.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
modeMode selector; accepted values are described in the command text.

Minimal example

value = IO.FOPEN(path[,mode])

IO.FPRINTF

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.FPRINTF(handle,format[,v1[,v2...v8]])

Writes formatted text to an open file handle using simple %s, %d, %f, %g placeholders.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
v1Optional parameter. If omitted, the command uses its internal default.
v2Optional parameter. If omitted, the command uses its internal default.
v8Optional parameter. If omitted, the command uses its internal default.

Minimal example

value = IO.FPRINTF(handle,format[,v1[,v2...v8]])

IO.FREAD

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.FREAD(handle,byteCount)

Reads a byte block from an open file handle and returns it as text.

Minimal example

value = IO.FREAD(handle,byteCount)

IO.FREADLINE

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.FREADLINE(handle)

Reads one text line from an open file handle without the trailing newline.

Minimal example

value = IO.FREADLINE(handle)

IO.FSCANF

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.FSCANF(handle[,format])

Reads the next whitespace-separated token, optionally converting it using %s, %d, %f or %g.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
formatOptional parameter. If omitted, the command uses its internal default.

Minimal example

value = IO.FSCANF(handle[,format])

IO.FSEEK

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.FSEEK(handle,offset[,origin])

Moves the current file position. Origin can be SET, CUR or END.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
originOptional parameter. If omitted, the command uses its internal default.

Minimal example

value = IO.FSEEK(handle,offset[,origin])

IO.FTELL

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.FTELL(handle)

Returns the current byte position of an open file handle.

Minimal example

value = IO.FTELL(handle)

IO.FWRITE

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.FWRITE(handle,value)

Writes text/raw UTF-8 bytes to an open file handle and returns the number of bytes written.

Minimal example

value = IO.FWRITE(handle,value)

IO.HOME_DIR

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.HOME_DIR()

Returns the user's home directory.

Minimal example

value = IO.HOME_DIR()

IO.IS_ABSOLUTE

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.IS_ABSOLUTE(path)

TRUE if the path is absolute.

Minimal example

value = IO.IS_ABSOLUTE(path)

IO.LAST_ERROR

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.LAST_ERROR()

Returns the last non-fatal runtime error text, currently set by IO.TRY_LOAD and IO.TRY_LOAD_WITH_META.

Minimal example

PRINT IO.LAST_ERROR()

IO.LAST_ERROR_LINE

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.LAST_ERROR_LINE()

Returns the source line associated with IO.LAST_ERROR(), or -1 when unavailable.

Minimal example

PRINT IO.LAST_ERROR_LINE()

IO.LOAD

STATEMENTIOBATCH-FRIENDLYFILE I/O
Kind: Command   Category: File / media IO statements   Namespace: IO

IO.LOAD pathExpr AS variable // images, OT RAW, FITS, TIFF stacks, video

Loads an image, a FITS image/stack, a TIFF/TIFF stack, or a video; videos, multipage TIFF files and multi-HDU FITS files become in-memory stacks.

Minimal example

IO.LOAD pathExpr AS variable  // images, OT RAW, FITS, TIFF stacks, video

IO.LOAD_WITH_META

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File / media IO statements   Namespace: IO

IO.LOAD_WITH_META path AS image

Loads an image/stack and applies the optional path.cvbmeta sidecar when present.

Minimal example

IO.LOAD_WITH_META "out.png" AS img2

IO.LOAD_WITH_META

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.LOAD_WITH_META path AS image

Loads an image/stack and applies the optional path.cvbmeta sidecar when present.

Minimal example

IO.LOAD_WITH_META "out.png" AS img2

IO.META_PATH

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.META_PATH(mediaPath)

Returns the metadata sidecar path used by IO.SAVE_WITH_META.

Minimal example

sidecar = IO.META_PATH("out.png")

IO.MKDIR

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.MKDIR(path)

Creates a single directory level and returns TRUE on success.

Minimal example

value = IO.MKDIR(path)

IO.MKPATH

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.MKPATH(path)

Creates a directory tree and returns TRUE on success.

Minimal example

value = IO.MKPATH(path)

IO.MOVE_FILE

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.MOVE_FILE(source,target[,overwrite])

Moves or renames a file and returns TRUE on success.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
overwriteOptional parameter. If omitted, the command uses its internal default.

Minimal example

value = IO.MOVE_FILE(source,target[,overwrite])

IO.PATH_EXISTS

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.PATH_EXISTS(path)

TRUE if a path exists.

Minimal example

value = IO.PATH_EXISTS(path)

IO.PATH_JOIN

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.PATH_JOIN(base,child)

Joins a base path and a child component.

Minimal example

value = IO.PATH_JOIN(base,child)

IO.READ_CSV_ARRAY

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.READ_CSV_ARRAY(path [, numeric [, delimiter]])

Reads a CSV written by IO.WRITE_CSV_ARRAY, preserving 1D/2D shape when the #CVB_ARRAY header is present.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
numericWhen true, forces numeric conversion of CSV values.
delimiterCSV delimiter override; omit it for auto-detection where supported.

Minimal example

b = IO.READ_CSV_ARRAY("array.csv", TRUE)

IO.READ_TEXT

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.READ_TEXT(path)

Reads a text file as UTF-8, returning an empty string on failure.

Minimal example

value = IO.READ_TEXT(path)

IO.REMOVE_DIR

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.REMOVE_DIR(path)

Removes an empty directory and returns TRUE on success.

Minimal example

value = IO.REMOVE_DIR(path)

IO.REMOVE_DIR_TREE

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.REMOVE_DIR_TREE(path)

Removes a directory tree recursively and returns TRUE on success.

Minimal example

value = IO.REMOVE_DIR_TREE(path)

IO.REMOVE_FILE

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.REMOVE_FILE(path)

Deletes a file and returns TRUE on success.

Minimal example

value = IO.REMOVE_FILE(path)

IO.SAVE

STATEMENTIOBATCH-FRIENDLYFILE I/O
Kind: Command   Category: File / media IO statements   Namespace: IO

IO.SAVE media, path

Saves a single image to common image formats, or saves a stack to multipage TIFF when the target extension is .tif/.tiff.

Minimal example

IO.SAVE

IO.SAVE_WITH_META

STATEMENTIOBATCH-FRIENDLYFILE I/O
Kind: Command   Category: File / media IO statements   Namespace: IO

IO.SAVE_WITH_META media, path

Saves an image or stack and writes a path.cvbmeta sidecar containing ROI state and user metadata.

Minimal example

IO.SAVE_WITH_META img, "out.png"

IO.TEMP_DIR

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.TEMP_DIR()

Returns the system temporary directory.

Minimal example

value = IO.TEMP_DIR()

IO.TRY_LOAD

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File / media IO statements   Namespace: IO

IO.TRY_LOAD path AS image

Loads an image/stack/video without stopping the script on failure. On failure the destination becomes NULL and IO.LAST_ERROR() contains the reason.

Minimal example

IO.TRY_LOAD "input.png" AS img
IF NOT CV.IS_VALID(img) THEN
    PRINT "Load failed: "; IO.LAST_ERROR()
    EXIT
ENDIF

IO.TRY_LOAD

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.TRY_LOAD path AS image

Loads an image/stack/video without stopping the script on failure. On failure the destination becomes NULL and IO.LAST_ERROR() contains the reason.

Minimal example

IO.TRY_LOAD "input.png" AS img
IF NOT CV.IS_VALID(img) THEN
    PRINT "Load failed: "; IO.LAST_ERROR()
    EXIT
ENDIF

IO.TRY_LOAD_WITH_META

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File / media IO statements   Namespace: IO

IO.TRY_LOAD_WITH_META path AS image

Non-fatal variant of IO.LOAD_WITH_META. It restores metadata when possible, otherwise stores the reason in IO.LAST_ERROR().

Minimal example

IO.TRY_LOAD_WITH_META "out.png" AS img2
ASSERT CV.IS_VALID(img2), IO.LAST_ERROR()

IO.TRY_LOAD_WITH_META

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.TRY_LOAD_WITH_META path AS image

Non-fatal variant of IO.LOAD_WITH_META. It restores metadata when possible, otherwise stores the reason in IO.LAST_ERROR().

Minimal example

IO.TRY_LOAD_WITH_META "out.png" AS img2
ASSERT CV.IS_VALID(img2), IO.LAST_ERROR()

IO.WRITE_CSV_ARRAY

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.WRITE_CSV_ARRAY(path, array [, delimiter])

Writes a 1D/2D array to CSV with a small #CVB_ARRAY shape header and returns TRUE.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
delimiterCSV delimiter override; omit it for auto-detection where supported.

Minimal example

ok = IO.WRITE_CSV_ARRAY("array.csv", a)

IO.WRITE_TEXT

FUNCTIONIOBATCH-FRIENDLYFILE I/O
Kind: Function   Category: File and path functions   Namespace: IO

IO.WRITE_TEXT(path,text)

Writes UTF-8 text to a file and returns TRUE on success.

Minimal example

value = IO.WRITE_TEXT(path,text)

IO.WRITE_VIDEO

STATEMENTIOBATCH-FRIENDLYFILE I/OSTACK / VIDEO
Kind: Command   Category: File / media IO statements   Namespace: IO

IO.WRITE_VIDEO stack, path [, fps]

Writes a stack as an AVI/MJPG video.

Optional parameters

Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.

ParameterMeaning
fpsOptional parameter. If omitted, the command uses its internal default.

Minimal example

IO.WRITE_VIDEO