read_chc#

ktch.io.read_chc(file_path, as_frame=False)[source]#

Read chain code (.chc) file.

Chain codes represent 2D contours using directional codes from 0 to 7:

3 2 1
4 * 0
5 6 7

The chain code file format is: [Sample name] [X] [Y] [Area (mm2) per pixel] [Area (pixels)] [Chain code] -1

Parameters:
file_pathstr

Path to the chain code file.

as_framebool, default=False

If True, return a DataFrame.

Returns:
resultChainCodeData or list of ChainCodeData or pd.DataFrame

If a single record and as_frame=False, returns a ChainCodeData. If multiple records and as_frame=False, returns a list of ChainCodeData. If as_frame=True, returns a concatenated DataFrame.